Class LivingGetProjectileEvent
java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.event.entity.EntityEvent
net.minecraftforge.event.entity.living.LivingEvent
net.minecraftforge.event.entity.living.LivingGetProjectileEvent
This event is fired when a living entity attempts to get a projectile with the
 
LivingEntity.getProjectile(ItemStack) method. The item stack given is usually the item stack of a
 ProjectileWeaponItem and the item stack returned is usually the item stack of a
 Projectile.
 
 This event is not Cancelable.
 
 This event does not have a result. Event.HasResult
 
 This event is fired on the MinecraftForge.EVENT_BUS.
- 
Nested Class SummaryNested classes/interfaces inherited from class net.minecraftforge.event.entity.living.LivingEventLivingEvent.LivingJumpEvent, LivingEvent.LivingTickEvent, LivingEvent.LivingVisibilityEventNested classes/interfaces inherited from class net.minecraftforge.event.entity.EntityEventEntityEvent.EnteringSection, EntityEvent.EntityConstructingNested classes/interfaces inherited from class net.minecraftforge.eventbus.api.Eventnet.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionLivingGetProjectileEvent(LivingEntity livingEntity, ItemStack projectileWeaponItemStack, ItemStack ammo) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidsetProjectileItemStack(ItemStack projectileItemStack) Sets the projectile itemstack to be used.Methods inherited from class net.minecraftforge.event.entity.living.LivingEventgetEntityMethods inherited from class net.minecraftforge.eventbus.api.EventgetListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult
- 
Field Details- 
projectileWeaponItemStack
- 
projectileItemStack
 
- 
- 
Constructor Details- 
LivingGetProjectileEventpublic LivingGetProjectileEvent(LivingEntity livingEntity, ItemStack projectileWeaponItemStack, ItemStack ammo) 
 
- 
- 
Method Details- 
getProjectileWeaponItemStack- Returns:
- The itemstack of the itrm that is looking for a projectile. With vanilla behavior, this usually returns
 an itemstack of a ProjectileWeaponItem, but it's possible for that to not be the case if modder uses a different implementation ofLivingEntity.getProjectile(ItemStack).
 
- 
getProjectileItemStack- Returns:
- The itemstack of the projectile found. Initially this is set to the projectile found by vanilla
 behaviour, but it's possible for thatnot to be the case if a modder uses a different implementation of
 LivingEntity.getProjectile(ItemStack).
 
- 
setProjectileItemStackSets the projectile itemstack to be used.If the entity is a player: whenever the projectile is fired/consumed the stack will be shrunk by one. To disable this behaviour you can copy the stack before giving it to the event. For bows, you can use ArrowLooseEventto remove the arrow yourself.Be aware that since this event fires every time a living entity gets a projectile, whether or not its Entity.levelis client-side, you will want to make a conditional to always set the item stack to what you'd want it to be to avoid client-server desyncs.
 
-