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 cty
-
Nested Class Summary
Nested ClassesNested 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_MAX_COUNT, ITEM_BAR_STEPS, MAX_MAX_COUNTFields inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
FEATURE_ENABLED_REGISTRY_KEYS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappendTooltip(ItemStack stack, Item.TooltipContext context, List<Text> tooltip, TooltipType type) Called by the client to append tooltips to an item.private 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) voidonStoppedUsing(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
asItem, byRawId, canBeNested, canMine, canRepair, finishUsing, fromBlock, getAttributeModifiers, getBonusAttackDamage, getBreakSound, getComponents, getDefaultStack, getDrinkSound, getEatSound, getEnchantability, getItemBarColor, getItemBarStep, getMaxCount, getMiningSpeed, getName, getName, getOrCreateTranslationKey, getRawId, getRecipeRemainder, getRegistryEntry, getRequiredFeatures, getTooltipData, getTranslationKey, getTranslationKey, hasGlint, hasRecipeRemainder, inventoryTick, isCorrectForDrops, isEnchantable, isItemBarVisible, isNetworkSynced, onClicked, onCraft, onCraftByPlayer, onItemEntityDestroyed, onStackClicked, postDamageEntity, postHit, postMine, postProcessComponents, raycast, 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 kLcty;k: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 aLcty;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 nLcty;n: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 oLcty;o: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 pLcty;p: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 qLcty;q: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 bLcty;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 rLcty;r:Lcty$a;
-
charged
private boolean charged- Mappings:
Namespace Name Mixin selector named chargedLnet/minecraft/item/CrossbowItem;charged:Zintermediary field_7937Lnet/minecraft/class_1764;field_7937:Zofficial lLcty;l: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 mLcty;m:Z
-
-
Constructor Details
-
CrossbowItem
-
-
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 dLcwi;d()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 bLcwi;b()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 aLcvg;a(Ldds;Lcnp;Lbrj;)Lbrk;
-
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 aLcty;a(Lcxz;)F
-
onStoppedUsing
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)Vintermediary method_7840Lnet/minecraft/class_1792;method_7840(Lnet/minecraft/class_1799;Lnet/minecraft/class_1937;Lnet/minecraft/class_1309;I)Vofficial aLcvg;a(Lcvl;Ldds;Lbuf;I)V
-
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 aLcty;a(Lbuf;Lcvl;)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 hLcty;h(Lcvl;)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 aLcwi;a(Lbuf;Lcoi;IFFFLbuf;)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 aLcty;a(Lbuf;Leye;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 aLcwi;a(Ldds;Lbuf;Lcvl;Lcvl;Z)Lcoi;
-
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 iLcwi;i(Lcvl;)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 aLcty;a(Ldds;Lbuf;Lbrj;Lcvl;FFLbuf;)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 aLcty;a(Lazk;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 aLcty;a(ZLazk;)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 aLcvg;a(Ldds;Lbuf;Lcvl;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 aLcvg;a(Lcvl;Lbuf;)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 bLcty;b(Lcvl;Lbuf;)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/util/UseAction;intermediary method_7853Lnet/minecraft/class_1792;method_7853(Lnet/minecraft/class_1799;)Lnet/minecraft/class_1839;official bLcvg;b(Lcvl;)Lcxh;
-
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 jLcty;j(Lcvl;)Lcty$a;
-
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 aLcty;a(ILcvl;Lbuf;)F
-
appendTooltip
public void appendTooltip(ItemStack stack, Item.TooltipContext context, List<Text> tooltip, TooltipType type) Called by the client to append tooltips to an item. Subclasses can override this and add custom tooltips totooltiplist.- Overrides:
appendTooltipin classItem- Parameters:
tooltip- the list of tooltips to show- Mappings:
Namespace Name Mixin selector named appendTooltipLnet/minecraft/item/Item;appendTooltip(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/Item$TooltipContext;Ljava/util/List;Lnet/minecraft/item/tooltip/TooltipType;)Vintermediary method_7851Lnet/minecraft/class_1792;method_7851(Lnet/minecraft/class_1799;Lnet/minecraft/class_1792$class_9635;Ljava/util/List;Lnet/minecraft/class_1836;)Vofficial aLcvg;a(Lcvl;Lcvg$b;Ljava/util/List;Lcxf;)V
-
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 lLcvg;l(Lcvl;)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 cLcwi;c()I
-