Package net.minecraft.item
Class CrossbowItem
java.lang.Object
net.minecraft.item.Item
net.minecraft.item.RangedWeaponItem
net.minecraft.item.CrossbowItem
- All Implemented Interfaces:
ItemConvertible,ToggleableFeature
- Mappings:
Namespace Name named net/minecraft/item/CrossbowItemintermediary net/minecraft/class_1764official czd
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic final recordNested classes/interfaces inherited from class net.minecraft.item.Item
Item.Settings, Item.TooltipContext -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final floatprivate booleanprivate static final CrossbowItem.LoadingSoundsprivate static final floatprivate static final floatstatic final floatprivate static final floatprivate static final floatprivate booleanstatic final intFields inherited from class net.minecraft.item.RangedWeaponItem
BOW_PROJECTILES, CROSSBOW_HELD_PROJECTILESFields inherited from class net.minecraft.item.Item
BASE_ATTACK_DAMAGE_MODIFIER_ID, BASE_ATTACK_SPEED_MODIFIER_ID, BLOCK_ITEMS, DEFAULT_BLOCKS_ATTACKS_MAX_USE_TIME, DEFAULT_MAX_COUNT, ENTRY_CODEC, ENTRY_PACKET_CODEC, ITEM_BAR_STEPS, MAX_MAX_COUNT, translationKeyFields inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
FEATURE_ENABLED_REGISTRY_KEYS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static Vector3fcalcVelocity(LivingEntity shooter, Vec3d direction, float yaw) protected ProjectileEntitycreateArrowEntity(World world, LivingEntity shooter, ItemStack weaponStack, ItemStack projectileStack, boolean critical) (package private) CrossbowItem.LoadingSoundsgetLoadingSounds(ItemStack stack) intgetMaxUseTime(ItemStack stack, LivingEntity user) Returns the maximum use (right-click) time of this item, in ticks.private static floatgetPullProgress(int useTicks, ItemStack stack, LivingEntity user) static intgetPullTime(ItemStack stack, LivingEntity user) intgetRange()private static floatgetSoundPitch(boolean flag, Random random) private static floatgetSoundPitch(Random random, int index) private static floatgetUseAction(ItemStack stack) Returns the use action the item should perform.protected intgetWeaponStackDamage(ItemStack projectile) static booleanbooleanisUsedOnRelease(ItemStack stack) private static booleanloadProjectiles(LivingEntity shooter, ItemStack crossbow) booleanonStoppedUsing(ItemStack stack, World world, LivingEntity user, int remainingUseTicks) Called on both the client and the server when an entity stops using an item before reaching the maximum use time.protected voidshoot(LivingEntity shooter, ProjectileEntity projectile, int index, float speed, float divergence, float yaw, @Nullable LivingEntity target) voidshootAll(World world, LivingEntity shooter, Hand hand, ItemStack stack, float speed, float divergence, @Nullable LivingEntity target) voidusageTick(World world, LivingEntity user, ItemStack stack, int remainingUseTicks) Called on both the server and the client every tick while an entity uses the item.use(World world, PlayerEntity user, Hand hand) Called when the player uses (or starts using) the item.Methods inherited from class net.minecraft.item.RangedWeaponItem
getHeldProjectile, getProjectile, load, shootAllMethods inherited from class net.minecraft.item.Item
appendTooltip, asItem, byRawId, canBeNested, canMine, finishUsing, fromBlock, getBonusAttackDamage, getComponents, getDamageSource, getDefaultStack, getItemBarColor, getItemBarStep, getMaxCount, getMiningSpeed, getName, getName, getRawId, getRecipeRemainder, getRegistryEntry, getRequiredFeatures, getTooltipData, getTranslationKey, hasGlint, inventoryTick, isCorrectForDrops, isItemBarVisible, onClicked, onCraft, onCraftByPlayer, onItemEntityDestroyed, onStackClicked, postDamageEntity, postHit, postMine, postProcessComponents, raycast, shouldShowOperatorBlockWarnings, toString, useOnBlock, useOnEntityMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
isEnabled
-
Field Details
-
DEFAULT_PULL_TIME
private static final float DEFAULT_PULL_TIME- See Also:
- Mappings:
Namespace Name Mixin selector named DEFAULT_PULL_TIMELnet/minecraft/item/CrossbowItem;DEFAULT_PULL_TIME:Fintermediary field_30866Lnet/minecraft/class_1764;field_30866:Fofficial oLczd;o:F
-
RANGE
public static final int RANGE- See Also:
- Mappings:
Namespace Name Mixin selector named RANGELnet/minecraft/item/CrossbowItem;RANGE:Iintermediary field_30863Lnet/minecraft/class_1764;field_30863:Iofficial aLczd;a:I
-
CHARGE_PROGRESS
private static final float CHARGE_PROGRESS- See Also:
- Mappings:
Namespace Name Mixin selector named CHARGE_PROGRESSLnet/minecraft/item/CrossbowItem;CHARGE_PROGRESS:Fintermediary field_30867Lnet/minecraft/class_1764;field_30867:Fofficial rLczd;r:F
-
LOAD_PROGRESS
private static final float LOAD_PROGRESS- See Also:
- Mappings:
Namespace Name Mixin selector named LOAD_PROGRESSLnet/minecraft/item/CrossbowItem;LOAD_PROGRESS:Fintermediary field_30868Lnet/minecraft/class_1764;field_30868:Fofficial sLczd;s:F
-
DEFAULT_SPEED
private static final float DEFAULT_SPEED- See Also:
- Mappings:
Namespace Name Mixin selector named DEFAULT_SPEEDLnet/minecraft/item/CrossbowItem;DEFAULT_SPEED:Fintermediary field_30869Lnet/minecraft/class_1764;field_30869:Fofficial tLczd;t:F
-
FIREWORK_ROCKET_SPEED
private static final float FIREWORK_ROCKET_SPEED- See Also:
- Mappings:
Namespace Name Mixin selector named FIREWORK_ROCKET_SPEEDLnet/minecraft/item/CrossbowItem;FIREWORK_ROCKET_SPEED:Fintermediary field_30870Lnet/minecraft/class_1764;field_30870:Fofficial uLczd;u:F
-
field_49258
public static final float field_49258- See Also:
- Mappings:
Namespace Name Mixin selector named field_49258Lnet/minecraft/item/CrossbowItem;field_49258:Fintermediary field_49258Lnet/minecraft/class_1764;field_49258:Fofficial bLczd;b:F
-
DEFAULT_LOADING_SOUNDS
- Mappings:
Namespace Name Mixin selector named DEFAULT_LOADING_SOUNDSLnet/minecraft/item/CrossbowItem;DEFAULT_LOADING_SOUNDS:Lnet/minecraft/item/CrossbowItem$LoadingSounds;intermediary field_51626Lnet/minecraft/class_1764;field_51626:Lnet/minecraft/class_1764$class_9693;official vLczd;v:Lczd$b;
-
charged
private boolean charged- Mappings:
Namespace Name Mixin selector named chargedLnet/minecraft/item/CrossbowItem;charged:Zintermediary field_7937Lnet/minecraft/class_1764;field_7937:Zofficial pLczd;p:Z
-
loaded
private boolean loaded- Mappings:
Namespace Name Mixin selector named loadedLnet/minecraft/item/CrossbowItem;loaded:Zintermediary field_7936Lnet/minecraft/class_1764;field_7936:Zofficial qLczd;q:Z
-
-
Constructor Details
-
CrossbowItem
- Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/item/Item;<init>(Lnet/minecraft/item/Item$Settings;)Vintermediary <init>Lnet/minecraft/class_1792;<init>(Lnet/minecraft/class_1792$class_1793;)Vofficial <init>Ldag;<init>(Ldag$a;)V
-
-
Method Details
-
getHeldProjectiles
- Overrides:
getHeldProjectilesin classRangedWeaponItem- Mappings:
Namespace Name Mixin selector named getHeldProjectilesLnet/minecraft/item/RangedWeaponItem;getHeldProjectiles()Ljava/util/function/Predicate;intermediary method_20310Lnet/minecraft/class_1811;method_20310()Ljava/util/function/Predicate;official cLdbf;c()Ljava/util/function/Predicate;
-
getProjectiles
- Specified by:
getProjectilesin classRangedWeaponItem- Mappings:
Namespace Name Mixin selector named getProjectilesLnet/minecraft/item/RangedWeaponItem;getProjectiles()Ljava/util/function/Predicate;intermediary method_19268Lnet/minecraft/class_1811;method_19268()Ljava/util/function/Predicate;official aLdbf;a()Ljava/util/function/Predicate;
-
use
Called when the player uses (or starts using) the item. The use action, by default, is bound to the right mouse button. This method checks the player's hunger when the item is a food, and will pass in all other cases by default.If the item can be used for multiple ticks, then this will only be called when the player starts using it. After that,
usageTick(net.minecraft.world.World, net.minecraft.entity.LivingEntity, net.minecraft.item.ItemStack, int)is called every tick until the player finishes using the item.This method is called on both the logical client and logical server, so take caution when overriding this method. The logical side can be checked using
world.isClient().- Overrides:
usein classItem- Parameters:
world- the world the item was used inuser- the player who used the itemhand- the hand used- Returns:
- a typed action result that specifies whether using the item was successful. The action result contains the new item stack that the player's hand will be set to.
- Mappings:
Namespace Name Mixin selector named useLnet/minecraft/item/Item;use(Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/ActionResult;intermediary method_7836Lnet/minecraft/class_1792;method_7836(Lnet/minecraft/class_1937;Lnet/minecraft/class_1657;Lnet/minecraft/class_1268;)Lnet/minecraft/class_1269;official aLdag;a(Ldkj;Lcsi;Lbvb;)Lbvc;
-
getSpeed
- Mappings:
Namespace Name Mixin selector named getSpeedLnet/minecraft/item/CrossbowItem;getSpeed(Lnet/minecraft/component/type/ChargedProjectilesComponent;)Fintermediary method_20309Lnet/minecraft/class_1764;method_20309(Lnet/minecraft/class_9278;)Fofficial aLczd;a(Ldco;)F
-
onStoppedUsing
public boolean onStoppedUsing(ItemStack stack, World world, LivingEntity user, int remainingUseTicks) Called on both the client and the server when an entity stops using an item before reaching the maximum use time. If the time was reached,Item.finishUsing(net.minecraft.item.ItemStack, net.minecraft.world.World, net.minecraft.entity.LivingEntity)is called instead.This method is called on both the logical client and logical server, so take caution when overriding this method. The logical side can be checked using
World.isClient.usermight not be a player in some cases. For example, this occurs when an entity uses a crossbow.- Overrides:
onStoppedUsingin classItem- Mappings:
Namespace Name Mixin selector named onStoppedUsingLnet/minecraft/item/Item;onStoppedUsing(Lnet/minecraft/item/ItemStack;Lnet/minecraft/world/World;Lnet/minecraft/entity/LivingEntity;I)Zintermediary method_7840Lnet/minecraft/class_1792;method_7840(Lnet/minecraft/class_1799;Lnet/minecraft/class_1937;Lnet/minecraft/class_1309;I)Zofficial aLdag;a(Ldak;Ldkj;Lbyf;I)Z
-
loadProjectiles
- Mappings:
Namespace Name Mixin selector named loadProjectilesLnet/minecraft/item/CrossbowItem;loadProjectiles(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;)Zintermediary method_7767Lnet/minecraft/class_1764;method_7767(Lnet/minecraft/class_1309;Lnet/minecraft/class_1799;)Zofficial aLczd;a(Lbyf;Ldak;)Z
-
isCharged
- Mappings:
Namespace Name Mixin selector named isChargedLnet/minecraft/item/CrossbowItem;isCharged(Lnet/minecraft/item/ItemStack;)Zintermediary method_7781Lnet/minecraft/class_1764;method_7781(Lnet/minecraft/class_1799;)Zofficial gLczd;g(Ldak;)Z
-
shoot
protected void shoot(LivingEntity shooter, ProjectileEntity projectile, int index, float speed, float divergence, float yaw, @Nullable @Nullable LivingEntity target) - Specified by:
shootin classRangedWeaponItem- Mappings:
Namespace Name Mixin selector named shootLnet/minecraft/item/RangedWeaponItem;shoot(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/entity/projectile/ProjectileEntity;IFFFLnet/minecraft/entity/LivingEntity;)Vintermediary method_7763Lnet/minecraft/class_1811;method_7763(Lnet/minecraft/class_1309;Lnet/minecraft/class_1676;IFFFLnet/minecraft/class_1309;)Vofficial aLdbf;a(Lbyf;Lctd;IFFFLbyf;)V
-
calcVelocity
- Mappings:
Namespace Name Mixin selector named calcVelocityLnet/minecraft/item/CrossbowItem;calcVelocity(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/util/math/Vec3d;F)Lorg/joml/Vector3f;intermediary method_57343Lnet/minecraft/class_1764;method_57343(Lnet/minecraft/class_1309;Lnet/minecraft/class_243;F)Lorg/joml/Vector3f;official aLczd;a(Lbyf;Lfgc;F)Lorg/joml/Vector3f;
-
createArrowEntity
protected ProjectileEntity createArrowEntity(World world, LivingEntity shooter, ItemStack weaponStack, ItemStack projectileStack, boolean critical) - Overrides:
createArrowEntityin classRangedWeaponItem- Mappings:
Namespace Name Mixin selector named createArrowEntityLnet/minecraft/item/RangedWeaponItem;createArrowEntity(Lnet/minecraft/world/World;Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ItemStack;Z)Lnet/minecraft/entity/projectile/ProjectileEntity;intermediary method_57344Lnet/minecraft/class_1811;method_57344(Lnet/minecraft/class_1937;Lnet/minecraft/class_1309;Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;Z)Lnet/minecraft/class_1676;official aLdbf;a(Ldkj;Lbyf;Ldak;Ldak;Z)Lctd;
-
getWeaponStackDamage
- Overrides:
getWeaponStackDamagein classRangedWeaponItem- Mappings:
Namespace Name Mixin selector named getWeaponStackDamageLnet/minecraft/item/RangedWeaponItem;getWeaponStackDamage(Lnet/minecraft/item/ItemStack;)Iintermediary method_57345Lnet/minecraft/class_1811;method_57345(Lnet/minecraft/class_1799;)Iofficial hLdbf;h(Ldak;)I
-
shootAll
public void shootAll(World world, LivingEntity shooter, Hand hand, ItemStack stack, float speed, float divergence, @Nullable @Nullable LivingEntity target) - Mappings:
Namespace Name Mixin selector named shootAllLnet/minecraft/item/CrossbowItem;shootAll(Lnet/minecraft/world/World;Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/util/Hand;Lnet/minecraft/item/ItemStack;FFLnet/minecraft/entity/LivingEntity;)Vintermediary method_7777Lnet/minecraft/class_1764;method_7777(Lnet/minecraft/class_1937;Lnet/minecraft/class_1309;Lnet/minecraft/class_1268;Lnet/minecraft/class_1799;FFLnet/minecraft/class_1309;)Vofficial aLczd;a(Ldkj;Lbyf;Lbvb;Ldak;FFLbyf;)V
-
getSoundPitch
- Mappings:
Namespace Name Mixin selector named getSoundPitchLnet/minecraft/item/CrossbowItem;getSoundPitch(Lnet/minecraft/util/math/random/Random;I)Fintermediary method_57342Lnet/minecraft/class_1764;method_57342(Lnet/minecraft/class_5819;I)Fofficial aLczd;a(Lbai;I)F
-
getSoundPitch
- Mappings:
Namespace Name Mixin selector named getSoundPitchLnet/minecraft/item/CrossbowItem;getSoundPitch(ZLnet/minecraft/util/math/random/Random;)Fintermediary method_7784Lnet/minecraft/class_1764;method_7784(ZLnet/minecraft/class_5819;)Fofficial aLczd;a(ZLbai;)F
-
usageTick
Called on both the server and the client every tick while an entity uses the item. Currently used byCrossbowItemto charge the crossbow. If this is overridden,getMaxUseTime(net.minecraft.item.ItemStack, net.minecraft.entity.LivingEntity)should also be overridden to return a positive value.- Overrides:
usageTickin classItem- Parameters:
remainingUseTicks- how long it's left until the entity finishes using the item, in ticks- See Also:
- Mappings:
Namespace Name Mixin selector named usageTickLnet/minecraft/item/Item;usageTick(Lnet/minecraft/world/World;Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;I)Vintermediary method_7852Lnet/minecraft/class_1792;method_7852(Lnet/minecraft/class_1937;Lnet/minecraft/class_1309;Lnet/minecraft/class_1799;I)Vofficial aLdag;a(Ldkj;Lbyf;Ldak;I)V
-
getMaxUseTime
Returns the maximum use (right-click) time of this item, in ticks. Once a player has used an item for said number of ticks, they stop using it, andItem.finishUsing(net.minecraft.item.ItemStack, net.minecraft.world.World, net.minecraft.entity.LivingEntity)is called.- Overrides:
getMaxUseTimein classItem- Returns:
- the maximum use (right-click) time of this item, in ticks
- Mappings:
Namespace Name Mixin selector named getMaxUseTimeLnet/minecraft/item/Item;getMaxUseTime(Lnet/minecraft/item/ItemStack;Lnet/minecraft/entity/LivingEntity;)Iintermediary method_7881Lnet/minecraft/class_1792;method_7881(Lnet/minecraft/class_1799;Lnet/minecraft/class_1309;)Iofficial aLdag;a(Ldak;Lbyf;)I
-
getPullTime
- Mappings:
Namespace Name Mixin selector named getPullTimeLnet/minecraft/item/CrossbowItem;getPullTime(Lnet/minecraft/item/ItemStack;Lnet/minecraft/entity/LivingEntity;)Iintermediary method_7775Lnet/minecraft/class_1764;method_7775(Lnet/minecraft/class_1799;Lnet/minecraft/class_1309;)Iofficial bLczd;b(Ldak;Lbyf;)I
-
getUseAction
Returns the use action the item should perform.- Overrides:
getUseActionin classItem- Returns:
- the use action the item should perform
- Mappings:
Namespace Name Mixin selector named getUseActionLnet/minecraft/item/Item;getUseAction(Lnet/minecraft/item/ItemStack;)Lnet/minecraft/item/consume/UseAction;intermediary method_7853Lnet/minecraft/class_1792;method_7853(Lnet/minecraft/class_1799;)Lnet/minecraft/class_1839;official bLdag;b(Ldak;)Ldam;
-
getLoadingSounds
- Mappings:
Namespace Name Mixin selector named getLoadingSoundsLnet/minecraft/item/CrossbowItem;getLoadingSounds(Lnet/minecraft/item/ItemStack;)Lnet/minecraft/item/CrossbowItem$LoadingSounds;intermediary method_59976Lnet/minecraft/class_1764;method_59976(Lnet/minecraft/class_1799;)Lnet/minecraft/class_1764$class_9693;official iLczd;i(Ldak;)Lczd$b;
-
getPullProgress
- Mappings:
Namespace Name Mixin selector named getPullProgressLnet/minecraft/item/CrossbowItem;getPullProgress(ILnet/minecraft/item/ItemStack;Lnet/minecraft/entity/LivingEntity;)Fintermediary method_7770Lnet/minecraft/class_1764;method_7770(ILnet/minecraft/class_1799;Lnet/minecraft/class_1309;)Fofficial aLczd;a(ILdak;Lbyf;)F
-
isUsedOnRelease
- Overrides:
isUsedOnReleasein classItem- Mappings:
Namespace Name Mixin selector named isUsedOnReleaseLnet/minecraft/item/Item;isUsedOnRelease(Lnet/minecraft/item/ItemStack;)Zintermediary method_7838Lnet/minecraft/class_1792;method_7838(Lnet/minecraft/class_1799;)Zofficial e_Ldag;e_(Ldak;)Z
-
getRange
public int getRange()- Specified by:
getRangein classRangedWeaponItem- Mappings:
Namespace Name Mixin selector named getRangeLnet/minecraft/item/RangedWeaponItem;getRange()Iintermediary method_24792Lnet/minecraft/class_1811;method_24792()Iofficial bLdbf;b()I
-