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 Summary
Nested classes/interfaces inherited from class net.minecraft.world.item.Item
Item.Properties
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final float
static final int
private static final float
private static final int
private static final float
private boolean
private static final float
private boolean
private static final String
private static final String
Fields inherited from class net.minecraft.world.item.ProjectileWeaponItem
ARROW_ONLY, ARROW_OR_FIREWORK
Fields inherited from class net.minecraft.world.item.Item
BASE_ATTACK_DAMAGE_UUID, BASE_ATTACK_SPEED_UUID, BY_BLOCK, canRepair, EAT_DURATION, MAX_BAR_WIDTH, MAX_STACK_SIZE
Fields inherited from interface net.minecraft.world.flag.FeatureElement
FILTERED_REGISTRIES
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate static void
addChargedProjectile
(ItemStack p_40929_, ItemStack p_40930_) void
appendHoverText
(ItemStack p_40880_, Level p_40881_, List<Component> p_40882_, TooltipFlag p_40883_) private static void
clearChargedProjectiles
(ItemStack p_40944_) static boolean
containsChargedProjectile
(ItemStack p_40872_, Item p_40873_) private static AbstractArrow
getArrow
(Level p_40915_, LivingEntity p_40916_, ItemStack p_40917_, ItemStack p_40918_) getChargedProjectiles
(ItemStack p_40942_) static int
getChargeDuration
(ItemStack p_40940_) int
private static float
getPowerForTime
(int p_40854_, ItemStack p_40855_) private static float
getRandomShotPitch
(boolean p_220026_, RandomSource p_220027_) private static float
getShootingPower
(ItemStack p_40946_) private static float[]
getShotPitches
(RandomSource p_220024_) private SoundEvent
getStartSound
(int p_40852_) getUseAnimation
(ItemStack p_40935_) int
getUseDuration
(ItemStack p_40938_) static boolean
private static boolean
loadProjectile
(LivingEntity p_40863_, ItemStack p_40864_, ItemStack p_40865_, boolean p_40866_, boolean p_40867_) private static void
onCrossbowShot
(Level p_40906_, LivingEntity p_40907_, ItemStack p_40908_) void
onUseTick
(Level p_40910_, LivingEntity p_40911_, ItemStack p_40912_, int p_40913_) static void
performShooting
(Level p_40888_, LivingEntity p_40889_, InteractionHand p_40890_, ItemStack p_40891_, float p_40892_, float p_40893_) void
releaseUsing
(ItemStack p_40875_, Level p_40876_, LivingEntity p_40877_, int p_40878_) static void
setCharged
(ItemStack p_40885_, boolean p_40886_) private 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_) private static boolean
tryLoadProjectiles
(LivingEntity p_40860_, ItemStack p_40861_) use
(Level p_40920_, Player p_40921_, InteractionHand p_40922_) boolean
useOnRelease
(ItemStack p_150801_) Methods inherited from class net.minecraft.world.item.ProjectileWeaponItem
getEnchantmentValue, getHeldProjectile
Methods inherited from class net.minecraft.world.item.Item
asItem, 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, verifyTagAfterLoad
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
canApplyAtEnchantingTable, 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_DURATION
private static final int MAX_CHARGE_DURATION- See Also:
-
DEFAULT_RANGE
public static final int DEFAULT_RANGE- See Also:
-
startSoundPlayed
private boolean startSoundPlayed -
midLoadSoundPlayed
private boolean midLoadSoundPlayed -
START_SOUND_PERCENT
private static final float START_SOUND_PERCENT- See Also:
-
MID_SOUND_PERCENT
private static final float MID_SOUND_PERCENT- See Also:
-
ARROW_POWER
private static final float ARROW_POWER- See Also:
-
FIREWORK_POWER
private static final float FIREWORK_POWER- See Also:
-
-
Constructor Details
-
CrossbowItem
-
-
Method Details
-
getSupportedHeldProjectiles
- Overrides:
getSupportedHeldProjectiles
in classProjectileWeaponItem
-
getAllSupportedProjectiles
- Specified by:
getAllSupportedProjectiles
in classProjectileWeaponItem
-
use
public InteractionResultHolder<ItemStack> use(Level p_40920_, Player p_40921_, InteractionHand p_40922_) -
getShootingPower
-
releaseUsing
- Overrides:
releaseUsing
in classItem
-
tryLoadProjectiles
-
loadProjectile
private static boolean loadProjectile(LivingEntity p_40863_, ItemStack p_40864_, ItemStack p_40865_, boolean p_40866_, boolean p_40867_) -
isCharged
-
setCharged
-
addChargedProjectile
-
getChargedProjectiles
-
clearChargedProjectiles
-
containsChargedProjectile
-
shootProjectile
private 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_) -
getArrow
private static AbstractArrow getArrow(Level p_40915_, LivingEntity p_40916_, ItemStack p_40917_, ItemStack p_40918_) -
performShooting
public 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:
getUseDuration
in classItem
-
getChargeDuration
-
getUseAnimation
- Overrides:
getUseAnimation
in classItem
-
getStartSound
-
getPowerForTime
-
appendHoverText
public void appendHoverText(ItemStack p_40880_, @Nullable Level p_40881_, List<Component> p_40882_, TooltipFlag p_40883_) - Overrides:
appendHoverText
in classItem
-
useOnRelease
- Overrides:
useOnRelease
in classItem
-
getDefaultProjectileRange
public int getDefaultProjectileRange()- Specified by:
getDefaultProjectileRange
in classProjectileWeaponItem
-