Package org.bukkit.projectiles
Interface ProjectileSource
- All Known Subinterfaces:
AbstractHorse
,AbstractSkeleton
,AbstractVillager
,Ageable
,Allay
,Ambient
,Animals
,Armadillo
,ArmorStand
,Axolotl
,Bat
,Bee
,Blaze
,BlockProjectileSource
,Bogged
,Breedable
,Breeze
,Camel
,Cat
,CaveSpider
,ChestedHorse
,Chicken
,Cod
,CollarColorable
,ComplexLivingEntity
,Cow
,Creature
,Creeper
,Dolphin
,Donkey
,Drowned
,ElderGuardian
,EnderDragon
,Enderman
,Endermite
,Enemy
,Evoker
,Fish
,Flying
,Fox
,Frog
,Ghast
,Giant
,GlowSquid
,Goat
,Golem
,Guardian
,Hoglin
,Horse
,HumanEntity
,Husk
,Illager
,Illusioner
,IronGolem
,LivingEntity
,Llama
,MagmaCube
,Mob
,Monster
,Mule
,MushroomCow
,NPC
,Ocelot
,Panda
,Parrot
,Phantom
,Pig
,Piglin
,PiglinAbstract
,PiglinBrute
,PigZombie
,Pillager
,Player
,PolarBear
,PufferFish
,Rabbit
,Raider
,RangedEntity
,Ravager
,Salmon
,SchoolableFish
,Sheep
,Shulker
,Silverfish
,Skeleton
,SkeletonHorse
,Slime
,Sniffer
,Snowman
,Spellcaster
,Spider
,Squid
,Steerable
,Stray
,Strider
,Tadpole
,Tameable
,TraderLlama
,TropicalFish
,Turtle
,Vex
,Villager
,Vindicator
,WanderingTrader
,Warden
,WaterMob
,Witch
,Wither
,WitherSkeleton
,Wolf
,Zoglin
,Zombie
,ZombieHorse
,ZombieVillager
public interface ProjectileSource
Represents a valid source of a projectile.
-
Method Summary
Modifier and TypeMethodDescription<T extends Projectile>
TlaunchProjectile
(@NotNull Class<? extends T> projectile) Launches aProjectile
from the ProjectileSource.<T extends Projectile>
TlaunchProjectile
(@NotNull Class<? extends T> projectile, @Nullable Vector velocity) Launches aProjectile
from the ProjectileSource with an initial velocity.<T extends Projectile>
TlaunchProjectile
(@NotNull Class<? extends T> projectile, @Nullable Vector velocity, @Nullable Consumer<? super T> function) Launches aProjectile
from the ProjectileSource with an initial velocity, with the supplied function run before the entity is added to the world.
-
Method Details
-
launchProjectile
Launches aProjectile
from the ProjectileSource.The family of launchProjectile methods only promise the ability to launch projectile types that the
ProjectileSource
is capable of firing in vanilla. Any other types of projectiles *may* be implemented but are not part of the method contract.- Type Parameters:
T
- a projectile subclass- Parameters:
projectile
- class of the projectile to launch- Returns:
- the launched projectile
-
launchProjectile
@NotNull <T extends Projectile> T launchProjectile(@NotNull @NotNull Class<? extends T> projectile, @Nullable @Nullable Vector velocity) Launches aProjectile
from the ProjectileSource with an initial velocity.The family of launchProjectile methods only promise the ability to launch projectile types that the
ProjectileSource
is capable of firing in vanilla. Any other types of projectiles *may* be implemented but are not part of the method contract.- Type Parameters:
T
- a projectile subclass- Parameters:
projectile
- class of the projectile to launchvelocity
- the velocity with which to launch- Returns:
- the launched projectile
-
launchProjectile
@NotNull <T extends Projectile> T launchProjectile(@NotNull @NotNull Class<? extends T> projectile, @Nullable @Nullable Vector velocity, @Nullable Consumer<? super T> function) Launches aProjectile
from the ProjectileSource with an initial velocity, with the supplied function run before the entity is added to the world.
Note that when the function is run, the entity will not be actually in the world. Any operation involving such as teleporting the entity is undefined until after this function returns.The family of launchProjectile methods only promise the ability to launch projectile types that the
ProjectileSource
is capable of firing in vanilla. Any other types of projectiles *may* be implemented but are not part of the method contract.- Type Parameters:
T
- a projectile subclass- Parameters:
projectile
- class of the projectile to launchvelocity
- the velocity with which to launchfunction
- the function to be run before the entity is spawned- Returns:
- the launched projectile
-