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 ctb
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.item.Item
Item.Settings, Item.TooltipContext -
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, 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) 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, finishUsing, fromBlock, getAttributeModifiers, getBonusAttackDamage, getBreakSound, getComponents, getDefaultStack, getDrinkSound, getEatSound, 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, 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 named DEFAULT_PULL_TIMELnet/minecraft/item/CrossbowItem;DEFAULT_PULL_TIME:Iintermediary field_30866Lnet/minecraft/class_1764;field_30866:Iofficial kLctb;k:I
-
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 aLctb;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 nLctb;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 oLctb;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 pLctb;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 qLctb;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 bLctb;b:F
-
charged
private boolean charged- Mappings:
Namespace Name Mixin selector named chargedLnet/minecraft/item/CrossbowItem;charged:Zintermediary field_7937Lnet/minecraft/class_1764;field_7937:Zofficial lLctb;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 mLctb;m: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>Lcuj;<init>(Lcuj$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 dLcvh;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 bLcvh;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/TypedActionResult;intermediary method_7836Lnet/minecraft/class_1792;method_7836(Lnet/minecraft/class_1937;Lnet/minecraft/class_1657;Lnet/minecraft/class_1268;)Lnet/minecraft/class_1271;official aLcuj;a(Ldbx;Lcmw;Lbqs;)Lbqu;
-
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 aLctb;a(Lcxc;)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 aLcuj;a(Lcuo;Ldbx;Lbto;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 aLctb;a(Lbto;Lcuo;)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 jLctb;j(Lcuo;)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 aLcvh;a(Lbto;Lcno;IFFFLbto;)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 aLctb;a(Lbto;Levq;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 aLcvh;a(Ldbx;Lbto;Lcuo;Lcuo;Z)Lcno;
-
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 kLcvh;k(Lcuo;)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 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 aLctb;a(Ldbx;Lbto;Lbqs;Lcuo;FFLbto;)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 aLctb;a(Lazg;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 aLctb;a(ZLazg;)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)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 aLcuj;a(Ldbx;Lbto;Lcuo;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;)Iintermediary method_7881Lnet/minecraft/class_1792;method_7881(Lnet/minecraft/class_1799;)Iofficial bLcuj;b(Lcuo;)I
-
getPullTime
- Mappings:
Namespace Name Mixin selector named getPullTimeLnet/minecraft/item/CrossbowItem;getPullTime(Lnet/minecraft/item/ItemStack;)Iintermediary method_7775Lnet/minecraft/class_1764;method_7775(Lnet/minecraft/class_1799;)Iofficial lLctb;l(Lcuo;)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 cLcuj;c(Lcuo;)Lcwj;
-
getQuickChargeSound
- Mappings:
Namespace Name Mixin selector named getQuickChargeSoundLnet/minecraft/item/CrossbowItem;getQuickChargeSound(I)Lnet/minecraft/sound/SoundEvent;intermediary method_7773Lnet/minecraft/class_1764;method_7773(I)Lnet/minecraft/class_3414;official aLctb;a(I)Lavy;
-
getPullProgress
- Mappings:
Namespace Name Mixin selector named getPullProgressLnet/minecraft/item/CrossbowItem;getPullProgress(ILnet/minecraft/item/ItemStack;)Fintermediary method_7770Lnet/minecraft/class_1764;method_7770(ILnet/minecraft/class_1799;)Fofficial aLctb;a(ILcuo;)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/client/item/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 aLcuj;a(Lcuo;Lcuj$b;Ljava/util/List;Lcwh;)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 mLcuj;m(Lcuo;)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 cLcvh;c()I
-