Package net.minecraft.world.item
Class CrossbowItem
java.lang.Object
net.minecraft.world.item.Item
net.minecraft.world.item.ProjectileWeaponItem
net.minecraft.world.item.CrossbowItem
- All Implemented Interfaces:
- FeatureElement,- Vanishable,- ItemLike,- IItemExtension
- 
Nested Class SummaryNested classes/interfaces inherited from class net.minecraft.world.item.ItemItem.Properties
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate static final floatstatic final intprivate static final floatprivate static final intprivate static final floatprivate booleanprivate static final floatprivate booleanprivate static final Stringprivate static final StringFields inherited from class net.minecraft.world.item.ProjectileWeaponItemARROW_ONLY, ARROW_OR_FIREWORKFields inherited from class net.minecraft.world.item.ItemBASE_ATTACK_DAMAGE_UUID, BASE_ATTACK_SPEED_UUID, BY_BLOCK, canRepair, EAT_DURATION, MAX_BAR_WIDTH, MAX_STACK_SIZEFields inherited from interface net.minecraft.world.flag.FeatureElementFILTERED_REGISTRIES
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprivate static voidaddChargedProjectile(ItemStack p_40929_, ItemStack p_40930_) voidappendHoverText(ItemStack p_40880_, Level p_40881_, List<Component> p_40882_, TooltipFlag p_40883_) private static voidclearChargedProjectiles(ItemStack p_40944_) static booleancontainsChargedProjectile(ItemStack p_40872_, Item p_40873_) private static AbstractArrowgetArrow(Level p_40915_, LivingEntity p_40916_, ItemStack p_40917_, ItemStack p_40918_) getChargedProjectiles(ItemStack p_40942_) static intgetChargeDuration(ItemStack p_40940_) intprivate static floatgetPowerForTime(int p_40854_, ItemStack p_40855_) private static floatgetRandomShotPitch(boolean p_220026_, RandomSource p_220027_) private static floatgetShootingPower(ItemStack p_40946_) private static float[]getShotPitches(RandomSource p_220024_) private SoundEventgetStartSound(int p_40852_) getUseAnimation(ItemStack p_40935_) intgetUseDuration(ItemStack p_40938_) static booleanprivate static booleanloadProjectile(LivingEntity p_40863_, ItemStack p_40864_, ItemStack p_40865_, boolean p_40866_, boolean p_40867_) private static voidonCrossbowShot(Level p_40906_, LivingEntity p_40907_, ItemStack p_40908_) voidonUseTick(Level p_40910_, LivingEntity p_40911_, ItemStack p_40912_, int p_40913_) static voidperformShooting(Level p_40888_, LivingEntity p_40889_, InteractionHand p_40890_, ItemStack p_40891_, float p_40892_, float p_40893_) voidreleaseUsing(ItemStack p_40875_, Level p_40876_, LivingEntity p_40877_, int p_40878_) static voidsetCharged(ItemStack p_40885_, boolean p_40886_) private static voidshootProjectile(Level p_40895_, LivingEntity p_40896_, InteractionHand p_40897_, ItemStack p_40898_, ItemStack p_40899_, float p_40900_, boolean p_40901_, float p_40902_, float p_40903_, float p_40904_) private static booleantryLoadProjectiles(LivingEntity p_40860_, ItemStack p_40861_) use(Level p_40920_, Player p_40921_, InteractionHand p_40922_) booleanuseOnRelease(ItemStack p_150801_) Methods inherited from class net.minecraft.world.item.ProjectileWeaponItemgetEnchantmentValue, getHeldProjectileMethods inherited from class net.minecraft.world.item.ItemasItem, builtInRegistryHolder, byBlock, byId, canAttackBlock, canBeDepleted, canBeHurtBy, canFitInsideContainerItems, finishUsingItem, getBarColor, getBarWidth, getCraftingRemainingItem, getDefaultAttributeModifiers, getDefaultInstance, getDescription, getDescriptionId, getDescriptionId, getDestroySpeed, getDrinkingSound, getEatingSound, getFoodProperties, getId, getMaxDamage, getMaxStackSize, getName, getOrCreateDescriptionId, getPlayerPOVHitResult, getRarity, getRenderPropertiesInternal, getTooltipImage, hasCraftingRemainingItem, hurtEnemy, initializeClient, interactLivingEntity, inventoryTick, isBarVisible, isComplex, isCorrectToolForDrops, isEdible, isEnchantable, isFireResistant, isFoil, isRepairable, isValidRepairItem, mineBlock, onCraftedBy, onCraftedPostProcess, onDestroyed, overrideOtherStackedOnMe, overrideStackedOnOther, requiredFeatures, shouldOverrideMultiplayerNbt, toString, useOn, verifyTagAfterLoadMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.world.flag.FeatureElementisEnabledMethods inherited from interface net.neoforged.neoforge.common.extensions.IItemExtensioncanApplyAtEnchantingTable, canContinueUsing, canDisableShield, canElytraFly, canEquip, canGrindstoneRepair, canPerformAction, canWalkOnPowderedSnow, createEntity, damageItem, doesSneakBypassUse, elytraFlightTick, getAllEnchantments, getArmorTexture, getAttributeModifiers, getBurnTime, getCraftingRemainingItem, getCreatorModId, getDamage, getDefaultTooltipHideFlags, getEnchantmentLevel, getEnchantmentValue, getEntityLifespan, getEquipmentSlot, getFoodProperties, getHighlightTip, getMaxDamage, getMaxStackSize, getSweepHitBox, getXpRepairRatio, hasCraftingRemainingItem, hasCustomEntity, isBookEnchantable, isCorrectToolForDrops, isDamageable, isDamaged, isEnderMask, isNotReplaceableByPickAction, isPiglinCurrency, makesPiglinsNeutral, onArmorTick, onBlockStartBreak, onDestroyed, onDroppedByPlayer, onEntityItemUpdate, onEntitySwing, onHorseArmorTick, onItemUseFirst, onLeftClickEntity, onStopUsing, setDamage, shouldCauseBlockBreakReset, shouldCauseReequipAnimation
- 
Field Details- 
TAG_CHARGED- See Also:
 
- 
TAG_CHARGED_PROJECTILES- See Also:
 
- 
MAX_CHARGE_DURATIONprivate static final int MAX_CHARGE_DURATION- See Also:
 
- 
DEFAULT_RANGEpublic static final int DEFAULT_RANGE- See Also:
 
- 
startSoundPlayedprivate boolean startSoundPlayed
- 
midLoadSoundPlayedprivate boolean midLoadSoundPlayed
- 
START_SOUND_PERCENTprivate static final float START_SOUND_PERCENT- See Also:
 
- 
MID_SOUND_PERCENTprivate static final float MID_SOUND_PERCENT- See Also:
 
- 
ARROW_POWERprivate static final float ARROW_POWER- See Also:
 
- 
FIREWORK_POWERprivate static final float FIREWORK_POWER- See Also:
 
 
- 
- 
Constructor Details- 
CrossbowItem
 
- 
- 
Method Details- 
getSupportedHeldProjectiles- Overrides:
- getSupportedHeldProjectilesin class- ProjectileWeaponItem
 
- 
getAllSupportedProjectiles- Specified by:
- getAllSupportedProjectilesin class- ProjectileWeaponItem
 
- 
usepublic InteractionResultHolder<ItemStack> use(Level p_40920_, Player p_40921_, InteractionHand p_40922_) 
- 
getShootingPower
- 
releaseUsing- Overrides:
- releaseUsingin class- Item
 
- 
tryLoadProjectiles
- 
loadProjectileprivate static boolean loadProjectile(LivingEntity p_40863_, ItemStack p_40864_, ItemStack p_40865_, boolean p_40866_, boolean p_40867_) 
- 
isCharged
- 
setCharged
- 
addChargedProjectile
- 
getChargedProjectiles
- 
clearChargedProjectiles
- 
containsChargedProjectile
- 
shootProjectileprivate static void shootProjectile(Level p_40895_, LivingEntity p_40896_, InteractionHand p_40897_, ItemStack p_40898_, ItemStack p_40899_, float p_40900_, boolean p_40901_, float p_40902_, float p_40903_, float p_40904_) 
- 
getArrowprivate static AbstractArrow getArrow(Level p_40915_, LivingEntity p_40916_, ItemStack p_40917_, ItemStack p_40918_) 
- 
performShootingpublic static void performShooting(Level p_40888_, LivingEntity p_40889_, InteractionHand p_40890_, ItemStack p_40891_, float p_40892_, float p_40893_) 
- 
getShotPitches
- 
getRandomShotPitch
- 
onCrossbowShot
- 
onUseTick
- 
getUseDuration- Overrides:
- getUseDurationin class- Item
 
- 
getChargeDuration
- 
getUseAnimation- Overrides:
- getUseAnimationin class- Item
 
- 
getStartSound
- 
getPowerForTime
- 
appendHoverTextpublic void appendHoverText(ItemStack p_40880_, @Nullable Level p_40881_, List<Component> p_40882_, TooltipFlag p_40883_) - Overrides:
- appendHoverTextin class- Item
 
- 
useOnRelease- Overrides:
- useOnReleasein class- Item
 
- 
getDefaultProjectileRangepublic int getDefaultProjectileRange()- Specified by:
- getDefaultProjectileRangein class- ProjectileWeaponItem
 
 
-