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, APPROXIMATELY_INFINITE_USE_DURATION, BASE_ATTACK_DAMAGE_ID, BASE_ATTACK_SPEED_ID, BY_BLOCK, canCombineRepair, CODEC, DEFAULT_MAX_STACK_SIZE, descriptionId, MAX_BAR_WIDTH, STREAM_CODECFields inherited from interface net.minecraft.world.flag.FeatureElement
FILTERED_REGISTRIES -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ProjectilecreateProjectile(Level level, LivingEntity shooter, ItemStack weapon, ItemStack ammo, boolean isCrit) static intgetChargeDuration(ItemStack stack, LivingEntity shooter) (package private) CrossbowItem.ChargingSoundsgetChargingSounds(ItemStack stack) intprotected intgetDurabilityUse(ItemStack stack) private static floatgetPowerForTime(int timeLeft, ItemStack stack, LivingEntity shooter) private static Vector3fgetProjectileShotVector(LivingEntity shooter, Vec3 distance, float angle) private static floatgetRandomShotPitch(boolean isHighPitched, RandomSource random) private static floatgetShootingPower(ChargedProjectiles projectile) private static floatgetShotPitch(RandomSource random, int index) getUseAnimation(ItemStack stack) intgetUseDuration(ItemStack stack, LivingEntity entity) static booleanvoidonUseTick(Level level, LivingEntity livingEntity, ItemStack stack, int count) Called as the item is being used by an entity.voidperformShooting(Level level, LivingEntity shooter, InteractionHand hand, ItemStack weapon, float velocity, float inaccuracy, LivingEntity target) booleanreleaseUsing(ItemStack stack, Level level, LivingEntity entity, int timeLeft) protected voidshootProjectile(LivingEntity shooter, Projectile projectile, int index, float velocity, float inaccuracy, float angle, LivingEntity target) private static booleantryLoadProjectiles(LivingEntity shooter, ItemStack crossbowStack) use(Level level, Player player, InteractionHand hand) booleanuseOnRelease(ItemStack stack) 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
appendHoverText, asItem, builtInRegistryHolder, byBlock, byId, canDestroyBlock, canFitInsideContainerItems, components, finishUsingItem, getAttackDamageBonus, getBarColor, getBarWidth, 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, canEquip, canFitInsideContainerItems, canGrindstoneRepair, canPerformAction, canWalkOnPowderedSnow, createEntity, damageItem, doesSneakBypassUse, getAllEnchantments, getBurnTime, getCraftingRemainder, getCreatorModId, getDamage, getDefaultAttributeModifiers, getEnchantmentLevel, getEntityLifespan, getEquipmentSlot, getHighlightTip, getMaxDamage, getMaxStackSize, getSweepHitBox, getXpRepairRatio, hasCustomEntity, 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
- Overrides:
releaseUsingin classItem
-
tryLoadProjectiles
-
isCharged
-
shootProjectile
protected void shootProjectile(LivingEntity shooter, Projectile projectile, int index, float velocity, float inaccuracy, float angle, @Nullable LivingEntity target) - Specified by:
shootProjectilein classProjectileWeaponItem
-
getProjectileShotVector
-
createProjectile
protected Projectile createProjectile(Level level, LivingEntity shooter, ItemStack weapon, ItemStack ammo, boolean isCrit) - Overrides:
createProjectilein classProjectileWeaponItem
-
getDurabilityUse
- Overrides:
getDurabilityUsein classProjectileWeaponItem
-
performShooting
public void performShooting(Level level, LivingEntity shooter, InteractionHand hand, ItemStack weapon, float velocity, float inaccuracy, @Nullable LivingEntity target) -
getShotPitch
-
getRandomShotPitch
-
onUseTick
Called as the item is being used by an entity. -
getUseDuration
- Overrides:
getUseDurationin classItem
-
getChargeDuration
-
getUseAnimation
- Overrides:
getUseAnimationin classItem
-
getChargingSounds
-
getPowerForTime
-
useOnRelease
If this stack's item is a crossbow- Overrides:
useOnReleasein classItem
-
getDefaultProjectileRange
public int getDefaultProjectileRange()- Specified by:
getDefaultProjectileRangein classProjectileWeaponItem
-