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 official cqfintermediary net/minecraft/class_1764named net/minecraft/item/CrossbowItem
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.item.Item
Item.Settings -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final floatprivate booleanprivate static final intprivate 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
ATTACK_DAMAGE_MODIFIER_ID, ATTACK_SPEED_MODIFIER_ID, BLOCK_ITEMS, DEFAULT_MAX_COUNT, DEFAULT_MAX_USE_TIME, ITEM_BAR_STEPSFields inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
FEATURE_ENABLED_REGISTRY_KEYS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappendTooltip(ItemStack stack, @Nullable World world, List<Text> tooltip, TooltipContext context) 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) intgetMaxUseTime(ItemStack stack) Returns the maximum use (right-click) time of this item, in ticks.private static floatgetPullProgress(int useTicks, ItemStack stack) static intgetPullTime(ItemStack stack) private SoundEventgetQuickChargeSound(int stage) 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 livingEntity) 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
getEnchantability, getHeldProjectile, getProjectile, isInfinity, load, shootAllMethods inherited from class net.minecraft.item.Item
asItem, byRawId, canBeNested, canMine, canRepair, damage, finishUsing, fromBlock, getAttributeModifiers, getBreakSound, getComponents, getDefaultStack, getDrinkSound, getEatSound, getFoodComponent, getItemBarColor, getItemBarStep, getMaxCount, getMaxDamage, getMiningSpeedMultiplier, getName, getName, getOrCreateTranslationKey, getRarity, getRawId, getRecipeRemainder, getRegistryEntry, getRequiredFeatures, getTooltipData, getTranslationKey, getTranslationKey, hasGlint, hasRecipeRemainder, inventoryTick, isDamageable, isEnchantable, isFireproof, isFood, isItemBarVisible, isNetworkSynced, isSuitableFor, onClicked, onCraft, onCraftByPlayer, onItemEntityDestroyed, onStackClicked, 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 int DEFAULT_PULL_TIME- See Also:
- Mappings:
Namespace Name Mixin selector official kLcqf;k:Iintermediary field_30866Lnet/minecraft/class_1764;field_30866:Inamed DEFAULT_PULL_TIMELnet/minecraft/item/CrossbowItem;DEFAULT_PULL_TIME:I
-
RANGE
public static final int RANGE- See Also:
- Mappings:
Namespace Name Mixin selector official aLcqf;a:Iintermediary field_30863Lnet/minecraft/class_1764;field_30863:Inamed RANGELnet/minecraft/item/CrossbowItem;RANGE:I
-
CHARGE_PROGRESS
private static final float CHARGE_PROGRESS- See Also:
- Mappings:
Namespace Name Mixin selector official nLcqf;n:Fintermediary field_30867Lnet/minecraft/class_1764;field_30867:Fnamed CHARGE_PROGRESSLnet/minecraft/item/CrossbowItem;CHARGE_PROGRESS:F
-
LOAD_PROGRESS
private static final float LOAD_PROGRESS- See Also:
- Mappings:
Namespace Name Mixin selector official oLcqf;o:Fintermediary field_30868Lnet/minecraft/class_1764;field_30868:Fnamed LOAD_PROGRESSLnet/minecraft/item/CrossbowItem;LOAD_PROGRESS:F
-
DEFAULT_SPEED
private static final float DEFAULT_SPEED- See Also:
- Mappings:
Namespace Name Mixin selector official pLcqf;p:Fintermediary field_30869Lnet/minecraft/class_1764;field_30869:Fnamed DEFAULT_SPEEDLnet/minecraft/item/CrossbowItem;DEFAULT_SPEED:F
-
FIREWORK_ROCKET_SPEED
private static final float FIREWORK_ROCKET_SPEED- See Also:
- Mappings:
Namespace Name Mixin selector official qLcqf;q:Fintermediary field_30870Lnet/minecraft/class_1764;field_30870:Fnamed FIREWORK_ROCKET_SPEEDLnet/minecraft/item/CrossbowItem;FIREWORK_ROCKET_SPEED:F
-
field_49258
public static final float field_49258- See Also:
- Mappings:
Namespace Name Mixin selector official bLcqf;b:Fintermediary field_49258Lnet/minecraft/class_1764;field_49258:Fnamed field_49258Lnet/minecraft/item/CrossbowItem;field_49258:F
-
charged
private boolean charged- Mappings:
Namespace Name Mixin selector official lLcqf;l:Zintermediary field_7937Lnet/minecraft/class_1764;field_7937:Znamed chargedLnet/minecraft/item/CrossbowItem;charged:Z
-
loaded
private boolean loaded- Mappings:
Namespace Name Mixin selector official mLcqf;m:Zintermediary field_7936Lnet/minecraft/class_1764;field_7936:Znamed loadedLnet/minecraft/item/CrossbowItem;loaded:Z
-
-
Constructor Details
-
CrossbowItem
- Mappings:
Namespace Name Mixin selector official <init>Lcrn;<init>(Lcrn$a;)Vintermediary <init>Lnet/minecraft/class_1792;<init>(Lnet/minecraft/class_1792$class_1793;)Vnamed <init>Lnet/minecraft/item/Item;<init>(Lnet/minecraft/item/Item$Settings;)V
-
-
Method Details
-
getHeldProjectiles
- Overrides:
getHeldProjectilesin classRangedWeaponItem- Mappings:
Namespace Name Mixin selector official dLcsi;d()Ljava/util/function/Predicate;intermediary method_20310Lnet/minecraft/class_1811;method_20310()Ljava/util/function/Predicate;named getHeldProjectilesLnet/minecraft/item/RangedWeaponItem;getHeldProjectiles()Ljava/util/function/Predicate;
-
getProjectiles
- Specified by:
getProjectilesin classRangedWeaponItem- Mappings:
Namespace Name Mixin selector official bLcsi;b()Ljava/util/function/Predicate;intermediary method_19268Lnet/minecraft/class_1811;method_19268()Ljava/util/function/Predicate;named getProjectilesLnet/minecraft/item/RangedWeaponItem;getProjectiles()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,
Item.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 official aLcrn;a(Lczg;Lcka;Lboe;)Lbog;intermediary method_7836Lnet/minecraft/class_1792;method_7836(Lnet/minecraft/class_1937;Lnet/minecraft/class_1657;Lnet/minecraft/class_1268;)Lnet/minecraft/class_1271;named useLnet/minecraft/item/Item;use(Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/TypedActionResult;
-
getSpeed
- Mappings:
Namespace Name Mixin selector official aLcqf;a(Lcub;)Fintermediary method_20309Lnet/minecraft/class_1764;method_20309(Lnet/minecraft/class_9278;)Fnamed getSpeedLnet/minecraft/item/CrossbowItem;getSpeed(Lnet/minecraft/component/type/ChargedProjectilesComponent;)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 official aLcrn;a(Lcrs;Lczg;Lbqt;I)Vintermediary method_7840Lnet/minecraft/class_1792;method_7840(Lnet/minecraft/class_1799;Lnet/minecraft/class_1937;Lnet/minecraft/class_1309;I)Vnamed onStoppedUsingLnet/minecraft/item/Item;onStoppedUsing(Lnet/minecraft/item/ItemStack;Lnet/minecraft/world/World;Lnet/minecraft/entity/LivingEntity;I)V
-
loadProjectiles
- Mappings:
Namespace Name Mixin selector official aLcqf;a(Lbqt;Lcrs;)Zintermediary method_7767Lnet/minecraft/class_1764;method_7767(Lnet/minecraft/class_1309;Lnet/minecraft/class_1799;)Znamed loadProjectilesLnet/minecraft/item/CrossbowItem;loadProjectiles(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;)Z
-
isCharged
- Mappings:
Namespace Name Mixin selector official jLcqf;j(Lcrs;)Zintermediary method_7781Lnet/minecraft/class_1764;method_7781(Lnet/minecraft/class_1799;)Znamed isChargedLnet/minecraft/item/CrossbowItem;isCharged(Lnet/minecraft/item/ItemStack;)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 official aLcsi;a(Lbqt;Lcks;IFFFLbqt;)Vintermediary method_7763Lnet/minecraft/class_1811;method_7763(Lnet/minecraft/class_1309;Lnet/minecraft/class_1676;IFFFLnet/minecraft/class_1309;)Vnamed shootLnet/minecraft/item/RangedWeaponItem;shoot(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/entity/projectile/ProjectileEntity;IFFFLnet/minecraft/entity/LivingEntity;)V
-
calcVelocity
- Mappings:
Namespace Name Mixin selector official aLcqf;a(Lbqt;Lesj;F)Lorg/joml/Vector3f;intermediary method_57343Lnet/minecraft/class_1764;method_57343(Lnet/minecraft/class_1309;Lnet/minecraft/class_243;F)Lorg/joml/Vector3f;named calcVelocityLnet/minecraft/item/CrossbowItem;calcVelocity(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/util/math/Vec3d;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 official aLcsi;a(Lczg;Lbqt;Lcrs;Lcrs;Z)Lcks;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;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;
-
getWeaponStackDamage
- Overrides:
getWeaponStackDamagein classRangedWeaponItem- Mappings:
Namespace Name Mixin selector official kLcsi;k(Lcrs;)Iintermediary method_57345Lnet/minecraft/class_1811;method_57345(Lnet/minecraft/class_1799;)Inamed getWeaponStackDamageLnet/minecraft/item/RangedWeaponItem;getWeaponStackDamage(Lnet/minecraft/item/ItemStack;)I
-
shootAll
public void shootAll(World world, LivingEntity shooter, Hand hand, ItemStack stack, float speed, float divergence, @Nullable @Nullable LivingEntity livingEntity) - Mappings:
Namespace Name Mixin selector official aLcqf;a(Lczg;Lbqt;Lboe;Lcrs;FFLbqt;)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;)Vnamed 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;)V
-
getSoundPitch
- Mappings:
Namespace Name Mixin selector official aLcqf;a(Laxt;I)Fintermediary method_57342Lnet/minecraft/class_1764;method_57342(Lnet/minecraft/class_5819;I)Fnamed getSoundPitchLnet/minecraft/item/CrossbowItem;getSoundPitch(Lnet/minecraft/util/math/random/Random;I)F
-
getSoundPitch
- Mappings:
Namespace Name Mixin selector official aLcqf;a(ZLaxt;)Fintermediary method_7784Lnet/minecraft/class_1764;method_7784(ZLnet/minecraft/class_5819;)Fnamed getSoundPitchLnet/minecraft/item/CrossbowItem;getSoundPitch(ZLnet/minecraft/util/math/random/Random;)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,Item.getMaxUseTime(net.minecraft.item.ItemStack)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 official aLcrn;a(Lczg;Lbqt;Lcrs;I)Vintermediary method_7852Lnet/minecraft/class_1792;method_7852(Lnet/minecraft/class_1937;Lnet/minecraft/class_1309;Lnet/minecraft/class_1799;I)Vnamed usageTickLnet/minecraft/item/Item;usageTick(Lnet/minecraft/world/World;Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;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 official bLcrn;b(Lcrs;)Iintermediary method_7881Lnet/minecraft/class_1792;method_7881(Lnet/minecraft/class_1799;)Inamed getMaxUseTimeLnet/minecraft/item/Item;getMaxUseTime(Lnet/minecraft/item/ItemStack;)I
-
getPullTime
- Mappings:
Namespace Name Mixin selector official lLcqf;l(Lcrs;)Iintermediary method_7775Lnet/minecraft/class_1764;method_7775(Lnet/minecraft/class_1799;)Inamed getPullTimeLnet/minecraft/item/CrossbowItem;getPullTime(Lnet/minecraft/item/ItemStack;)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 official cLcrn;c(Lcrs;)Lctk;intermediary method_7853Lnet/minecraft/class_1792;method_7853(Lnet/minecraft/class_1799;)Lnet/minecraft/class_1839;named getUseActionLnet/minecraft/item/Item;getUseAction(Lnet/minecraft/item/ItemStack;)Lnet/minecraft/util/UseAction;
-
getQuickChargeSound
- Mappings:
Namespace Name Mixin selector official aLcqf;a(I)Laun;intermediary method_7773Lnet/minecraft/class_1764;method_7773(I)Lnet/minecraft/class_3414;named getQuickChargeSoundLnet/minecraft/item/CrossbowItem;getQuickChargeSound(I)Lnet/minecraft/sound/SoundEvent;
-
getPullProgress
- Mappings:
Namespace Name Mixin selector official aLcqf;a(ILcrs;)Fintermediary method_7770Lnet/minecraft/class_1764;method_7770(ILnet/minecraft/class_1799;)Fnamed getPullProgressLnet/minecraft/item/CrossbowItem;getPullProgress(ILnet/minecraft/item/ItemStack;)F
-
appendTooltip
public void appendTooltip(ItemStack stack, @Nullable @Nullable World world, List<Text> tooltip, TooltipContext context) 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 official aLcrn;a(Lcrs;Lczg;Ljava/util/List;Lcti;)Vintermediary method_7851Lnet/minecraft/class_1792;method_7851(Lnet/minecraft/class_1799;Lnet/minecraft/class_1937;Ljava/util/List;Lnet/minecraft/class_1836;)Vnamed appendTooltipLnet/minecraft/item/Item;appendTooltip(Lnet/minecraft/item/ItemStack;Lnet/minecraft/world/World;Ljava/util/List;Lnet/minecraft/client/item/TooltipContext;)V
-
isUsedOnRelease
- Overrides:
isUsedOnReleasein classItem- Mappings:
Namespace Name Mixin selector official mLcrn;m(Lcrs;)Zintermediary method_7838Lnet/minecraft/class_1792;method_7838(Lnet/minecraft/class_1799;)Znamed isUsedOnReleaseLnet/minecraft/item/Item;isUsedOnRelease(Lnet/minecraft/item/ItemStack;)Z
-
getRange
public int getRange()- Specified by:
getRangein classRangedWeaponItem- Mappings:
Namespace Name Mixin selector official cLcsi;c()Iintermediary method_24792Lnet/minecraft/class_1811;method_24792()Inamed getRangeLnet/minecraft/item/RangedWeaponItem;getRange()I
-