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,ItemLike,IItemExtension
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic final recordNested classes/interfaces inherited from class net.minecraft.world.item.Item
Item.Properties, Item.TooltipContext -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final floatstatic final intprivate static final CrossbowItem.ChargingSoundsprivate static final floatprivate static final floatprivate static final floatprivate booleanSet totruewhen the crossbow is 50% charged.static final floatprivate static final floatprivate booleanSet totruewhen the crossbow is 20% charged.Fields inherited from class net.minecraft.world.item.ProjectileWeaponItem
ARROW_ONLY, ARROW_OR_FIREWORKFields inherited from class net.minecraft.world.item.Item
ABSOLUTE_MAX_STACK_SIZE, BASE_ATTACK_DAMAGE_ID, BASE_ATTACK_SPEED_ID, BY_BLOCK, canCombineRepair, CODEC, DEFAULT_MAX_STACK_SIZE, descriptionId, MAX_BAR_WIDTHFields inherited from interface net.minecraft.world.flag.FeatureElement
FILTERED_REGISTRIES -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappendHoverText(ItemStack p_40880_, Item.TooltipContext p_339686_, List<Component> p_40882_, TooltipFlag p_40883_) protected ProjectilecreateProjectile(Level p_331583_, LivingEntity p_40863_, ItemStack p_40864_, ItemStack p_40865_, boolean p_40866_) static intgetChargeDuration(ItemStack pStack, LivingEntity pShooter) (package private) CrossbowItem.ChargingSoundsgetChargingSounds(ItemStack pStack) intprotected intgetDurabilityUse(ItemStack p_331489_) private static floatgetPowerForTime(int pTimeLeft, ItemStack pStack, LivingEntity pShooter) private static Vector3fgetProjectileShotVector(LivingEntity pShooter, Vec3 pDistance, float pAngle) private static floatgetRandomShotPitch(boolean pIsHighPitched, RandomSource pRandom) private static floatgetShootingPower(ChargedProjectiles pProjectile) private static floatgetShotPitch(RandomSource pRandom, int pIndex) getUseAnimation(ItemStack p_40935_) intgetUseDuration(ItemStack p_40938_, LivingEntity p_344898_) static booleanvoidonUseTick(Level pLevel, LivingEntity pLivingEntity, ItemStack pStack, int pCount) Called as the item is being used by an entity.voidperformShooting(Level pLevel, LivingEntity pShooter, InteractionHand pHand, ItemStack pWeapon, float pVelocity, float pInaccuracy, LivingEntity pTarget) booleanreleaseUsing(ItemStack p_40875_, Level p_40876_, LivingEntity p_40877_, int p_40878_) protected voidshootProjectile(LivingEntity p_40896_, Projectile p_332122_, int p_331865_, float p_40900_, float p_40902_, float p_40903_, LivingEntity p_330303_) private static booleantryLoadProjectiles(LivingEntity pShooter, ItemStack pCrossbowStack) use(Level p_40920_, Player p_40921_, InteractionHand p_40922_) booleanuseOnRelease(ItemStack p_150801_) If this stack's item is a crossbowMethods inherited from class net.minecraft.world.item.ProjectileWeaponItem
customArrow, draw, getAllSupportedProjectiles, getDefaultCreativeAmmo, getHeldProjectile, getSupportedHeldProjectiles, shoot, useAmmoMethods inherited from class net.minecraft.world.item.Item
asItem, builtInRegistryHolder, byBlock, byId, canAttackBlock, canFitInsideContainerItems, components, finishUsingItem, getAttackDamageBonus, getBarColor, getBarWidth, getBreakingSound, getCraftingRemainder, getDamageSource, getDefaultInstance, getDefaultMaxStackSize, getDescriptionId, getDestroySpeed, getId, getName, getName, getPlayerPOVHitResult, getTooltipImage, hurtEnemy, interactLivingEntity, inventoryTick, isBarVisible, isCombineRepairable, isCorrectToolForDrops, isFoil, mineBlock, modifyDefaultComponentsFrom, onCraftedBy, onCraftedPostProcess, onDestroyed, overrideOtherStackedOnMe, overrideStackedOnOther, postHurtEnemy, requiredFeatures, shouldPrintOpWarning, toString, useOn, verifyComponentsAfterLoadMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.world.flag.FeatureElement
isEnabledMethods inherited from interface net.neoforged.neoforge.common.extensions.IItemExtension
applyEnchantments, canBeHurtBy, canContinueUsing, canDisableShield, canEquip, canGrindstoneRepair, canPerformAction, canWalkOnPowderedSnow, createEntity, damageItem, doesSneakBypassUse, getAllEnchantments, getBurnTime, getCraftingRemainder, getCreatorModId, getDamage, getDefaultAttributeModifiers, getEnchantmentLevel, getEntityLifespan, getEquipmentSlot, getHighlightTip, getMaxDamage, getMaxStackSize, getSweepHitBox, getXpRepairRatio, hasCustomEntity, isBookEnchantable, isDamageable, isDamaged, isGazeDisguise, isNotReplaceableByPickAction, isPiglinCurrency, isPrimaryItemFor, makesPiglinsNeutral, onAnimalArmorTick, onDestroyed, onDroppedByPlayer, onEntityItemUpdate, onEntitySwing, onItemUseFirst, onLeftClickEntity, onStopUsing, setDamage, shouldCauseBlockBreakReset, shouldCauseReequipAnimation, supportsEnchantment
-
Field Details
-
MAX_CHARGE_DURATION
private static final float MAX_CHARGE_DURATION- See Also:
-
DEFAULT_RANGE
public static final int DEFAULT_RANGE- See Also:
-
startSoundPlayed
private boolean startSoundPlayedSet totruewhen the crossbow is 20% charged. -
midLoadSoundPlayed
private boolean midLoadSoundPlayedSet totruewhen the crossbow is 50% charged. -
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:
-
MOB_ARROW_POWER
public static final float MOB_ARROW_POWER- See Also:
-
DEFAULT_SOUNDS
-
-
Constructor Details
-
CrossbowItem
-
-
Method Details
-
getSupportedHeldProjectiles
- Overrides:
getSupportedHeldProjectilesin classProjectileWeaponItem
-
getAllSupportedProjectiles
- Specified by:
getAllSupportedProjectilesin classProjectileWeaponItem
-
use
-
getShootingPower
-
releaseUsing
public boolean releaseUsing(ItemStack p_40875_, Level p_40876_, LivingEntity p_40877_, int p_40878_) - Overrides:
releaseUsingin classItem
-
tryLoadProjectiles
-
isCharged
-
shootProjectile
protected void shootProjectile(LivingEntity p_40896_, Projectile p_332122_, int p_331865_, float p_40900_, float p_40902_, float p_40903_, @Nullable LivingEntity p_330303_) - Specified by:
shootProjectilein classProjectileWeaponItem
-
getProjectileShotVector
private static Vector3f getProjectileShotVector(LivingEntity pShooter, Vec3 pDistance, float pAngle) -
createProjectile
protected Projectile createProjectile(Level p_331583_, LivingEntity p_40863_, ItemStack p_40864_, ItemStack p_40865_, boolean p_40866_) - Overrides:
createProjectilein classProjectileWeaponItem
-
getDurabilityUse
- Overrides:
getDurabilityUsein classProjectileWeaponItem
-
performShooting
public void performShooting(Level pLevel, LivingEntity pShooter, InteractionHand pHand, ItemStack pWeapon, float pVelocity, float pInaccuracy, @Nullable LivingEntity pTarget) -
getShotPitch
-
getRandomShotPitch
-
onUseTick
Called as the item is being used by an entity. -
getUseDuration
- Overrides:
getUseDurationin classItem
-
getChargeDuration
-
getUseAnimation
- Overrides:
getUseAnimationin classItem
-
getChargingSounds
-
getPowerForTime
-
appendHoverText
public void appendHoverText(ItemStack p_40880_, Item.TooltipContext p_339686_, List<Component> p_40882_, TooltipFlag p_40883_) - Overrides:
appendHoverTextin classItem
-
useOnRelease
Description copied from class:ItemIf this stack's item is a crossbow- Overrides:
useOnReleasein classItem
-
getDefaultProjectileRange
public int getDefaultProjectileRange()- Specified by:
getDefaultProjectileRangein classProjectileWeaponItem
-