Package net.minecraft.world.item
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
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.world.item.Item
Item.Properties, Item.TooltipContext
-
Field Summary
Modifier and TypeFieldDescriptionFields inherited from class net.minecraft.world.item.Item
ABSOLUTE_MAX_STACK_SIZE, BASE_ATTACK_DAMAGE_ID, BASE_ATTACK_SPEED_ID, BY_BLOCK, canRepair, DEFAULT_MAX_STACK_SIZE, MAX_BAR_WIDTH
Fields inherited from interface net.minecraft.world.flag.FeatureElement
FILTERED_REGISTRIES
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Projectile
createProjectile
(Level p_331008_, LivingEntity p_330781_, ItemStack p_330846_, ItemStack p_331497_, boolean p_331305_) customArrow
(AbstractArrow arrow, ItemStack projectileStack, ItemStack weaponStack) draw
(ItemStack p_331565_, ItemStack p_330406_, LivingEntity p_330823_) getDefaultCreativeAmmo
(Player player, ItemStack projectileWeaponItem) Neo: Controls what ammo ItemStack that Creative Mode should return if the player has no valid ammo in inventory.abstract int
protected int
getDurabilityUse
(ItemStack p_331003_) int
static ItemStack
getHeldProjectile
(LivingEntity p_43011_, Predicate<ItemStack> p_43012_) 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_, LivingEntity p_331167_) protected abstract void
shootProjectile
(LivingEntity p_330966_, Projectile p_332201_, int p_331696_, float p_331444_, float p_331156_, float p_331718_, LivingEntity p_331705_) protected static ItemStack
useAmmo
(ItemStack p_331207_, ItemStack p_331434_, LivingEntity p_330302_, boolean p_330934_) Methods inherited from class net.minecraft.world.item.Item
appendHoverText, asItem, builtInRegistryHolder, byBlock, byId, canAttackBlock, canFitInsideContainerItems, components, finishUsingItem, getAttackDamageBonus, getBarColor, getBarWidth, getBreakingSound, getCraftingRemainingItem, getDefaultAttributeModifiers, getDefaultInstance, getDefaultMaxStackSize, getDescription, getDescriptionId, getDescriptionId, getDestroySpeed, getDrinkingSound, getEatingSound, getId, getName, getOrCreateDescriptionId, getPlayerPOVHitResult, getRenderPropertiesInternal, getTooltipImage, getUseAnimation, getUseDuration, hasCraftingRemainingItem, hurtEnemy, initializeClient, interactLivingEntity, inventoryTick, isBarVisible, isComplex, isCorrectToolForDrops, isEnchantable, isFoil, isRepairable, isValidRepairItem, mineBlock, modifyDefaultComponentsFrom, onCraftedBy, onCraftedPostProcess, onDestroyed, onUseTick, overrideOtherStackedOnMe, overrideStackedOnOther, postHurtEnemy, releaseUsing, requiredFeatures, toString, use, useOn, useOnRelease, verifyComponentsAfterLoad
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraft.world.flag.FeatureElement
isEnabled
Methods inherited from interface net.neoforged.neoforge.common.extensions.IItemExtension
canContinueUsing, canDisableShield, canElytraFly, canEquip, canGrindstoneRepair, canPerformAction, canWalkOnPowderedSnow, createEntity, damageItem, doesSneakBypassUse, elytraFlightTick, getAllEnchantments, getArmorTexture, getBurnTime, getCraftingRemainingItem, getCreatorModId, getDamage, getDefaultAttributeModifiers, getEnchantmentLevel, getEnchantmentValue, getEntityLifespan, getEquipmentSlot, getFoodProperties, getHighlightTip, getMaxDamage, getMaxStackSize, getSweepHitBox, getXpRepairRatio, hasCraftingRemainingItem, hasCustomEntity, isBookEnchantable, isDamageable, isDamaged, isEnderMask, isNotReplaceableByPickAction, isPiglinCurrency, isPrimaryItemFor, makesPiglinsNeutral, onAnimalArmorTick, onDestroyed, onDroppedByPlayer, onEntityItemUpdate, onEntitySwing, onItemUseFirst, onLeftClickEntity, onStopUsing, setDamage, shouldCauseBlockBreakReset, shouldCauseReequipAnimation
-
Field Details
-
ARROW_ONLY
-
ARROW_OR_FIREWORK
-
-
Constructor Details
-
ProjectileWeaponItem
-
-
Method Details
-
getSupportedHeldProjectiles
-
getAllSupportedProjectiles
-
getHeldProjectile
-
getEnchantmentValue
public int getEnchantmentValue()- Overrides:
getEnchantmentValue
in classItem
-
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
-
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
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 weaponprojectileWeaponItem
- The weapon ItemStack the ammo is for- Returns:
- The default ammo ItemStack for this weapon
-