Class ProjectileWeaponItem

java.lang.Object
net.minecraft.world.item.Item
net.minecraft.world.item.ProjectileWeaponItem
All Implemented Interfaces:
FeatureElement, ItemLike, IItemExtension
Direct Known Subclasses:
BowItem, CrossbowItem

public abstract class ProjectileWeaponItem extends Item
  • Field Details

  • Constructor Details

    • ProjectileWeaponItem

      public ProjectileWeaponItem(Item.Properties p_43009_)
  • Method Details

    • getSupportedHeldProjectiles

      public Predicate<ItemStack> getSupportedHeldProjectiles()
    • getAllSupportedProjectiles

      public abstract Predicate<ItemStack> getAllSupportedProjectiles()
    • getHeldProjectile

      public static ItemStack getHeldProjectile(LivingEntity p_43011_, Predicate<ItemStack> p_43012_)
    • getEnchantmentValue

      public int getEnchantmentValue()
      Overrides:
      getEnchantmentValue in class Item
    • getDefaultProjectileRange

      public abstract int getDefaultProjectileRange()
    • shoot

      protected void shoot(ServerLevel p_346125_, LivingEntity p_330728_, InteractionHand p_331152_, ItemStack p_330646_, List<ItemStack> p_331726_, float p_331007_, float p_331445_, boolean p_331107_, @Nullable LivingEntity p_331167_)
    • getDurabilityUse

      protected int getDurabilityUse(ItemStack p_331003_)
    • shootProjectile

      protected abstract void shootProjectile(LivingEntity p_330966_, Projectile p_332201_, int p_331696_, float p_331444_, float p_331156_, float p_331718_, @Nullable LivingEntity p_331705_)
    • createProjectile

      protected Projectile createProjectile(Level p_331008_, LivingEntity p_330781_, ItemStack p_330846_, ItemStack p_331497_, boolean p_331305_)
    • draw

      protected static List<ItemStack> draw(ItemStack p_331565_, ItemStack p_330406_, LivingEntity p_330823_)
    • useAmmo

      protected static ItemStack useAmmo(ItemStack p_331207_, ItemStack p_331434_, LivingEntity p_330302_, boolean p_330934_)
    • customArrow

      public AbstractArrow customArrow(AbstractArrow arrow, ItemStack projectileStack, ItemStack weaponStack)
    • getDefaultCreativeAmmo

      public ItemStack getDefaultCreativeAmmo(@Nullable Player player, ItemStack projectileWeaponItem)
      Neo: Controls what ammo ItemStack that Creative Mode should return if the player has no valid ammo in inventory. Modded weapons should override this to return their own ammo if they do not use vanilla arrows.
      Parameters:
      player - The player (if in context) firing the weapon
      projectileWeaponItem - The weapon ItemStack the ammo is for
      Returns:
      The default ammo ItemStack for this weapon