Class CrossbowItem

All Implemented Interfaces:
ItemConvertible, ToggleableFeature

public class CrossbowItem extends RangedWeaponItem
Mappings:
Namespace Name
named net/minecraft/item/CrossbowItem
intermediary net/minecraft/class_1764
official csq
  • Field Details

    • DEFAULT_PULL_TIME

      private static final float DEFAULT_PULL_TIME
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named DEFAULT_PULL_TIME Lnet/minecraft/item/CrossbowItem;DEFAULT_PULL_TIME:F
      intermediary field_30866 Lnet/minecraft/class_1764;field_30866:F
      official k Lcsq;k:F
    • RANGE

      public static final int RANGE
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named RANGE Lnet/minecraft/item/CrossbowItem;RANGE:I
      intermediary field_30863 Lnet/minecraft/class_1764;field_30863:I
      official a Lcsq;a:I
    • CHARGE_PROGRESS

      private static final float CHARGE_PROGRESS
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named CHARGE_PROGRESS Lnet/minecraft/item/CrossbowItem;CHARGE_PROGRESS:F
      intermediary field_30867 Lnet/minecraft/class_1764;field_30867:F
      official n Lcsq;n:F
    • LOAD_PROGRESS

      private static final float LOAD_PROGRESS
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named LOAD_PROGRESS Lnet/minecraft/item/CrossbowItem;LOAD_PROGRESS:F
      intermediary field_30868 Lnet/minecraft/class_1764;field_30868:F
      official o Lcsq;o:F
    • DEFAULT_SPEED

      private static final float DEFAULT_SPEED
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named DEFAULT_SPEED Lnet/minecraft/item/CrossbowItem;DEFAULT_SPEED:F
      intermediary field_30869 Lnet/minecraft/class_1764;field_30869:F
      official p Lcsq;p:F
    • FIREWORK_ROCKET_SPEED

      private static final float FIREWORK_ROCKET_SPEED
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named FIREWORK_ROCKET_SPEED Lnet/minecraft/item/CrossbowItem;FIREWORK_ROCKET_SPEED:F
      intermediary field_30870 Lnet/minecraft/class_1764;field_30870:F
      official q Lcsq;q:F
    • field_49258

      public static final float field_49258
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named field_49258 Lnet/minecraft/item/CrossbowItem;field_49258:F
      intermediary field_49258 Lnet/minecraft/class_1764;field_49258:F
      official b Lcsq;b:F
    • DEFAULT_LOADING_SOUNDS

      private static final CrossbowItem.LoadingSounds DEFAULT_LOADING_SOUNDS
      Mappings:
      Namespace Name Mixin selector
      named DEFAULT_LOADING_SOUNDS Lnet/minecraft/item/CrossbowItem;DEFAULT_LOADING_SOUNDS:Lnet/minecraft/item/CrossbowItem$LoadingSounds;
      intermediary field_51626 Lnet/minecraft/class_1764;field_51626:Lnet/minecraft/class_1764$class_9693;
      official r Lcsq;r:Lcsq$a;
    • charged

      private boolean charged
      Mappings:
      Namespace Name Mixin selector
      named charged Lnet/minecraft/item/CrossbowItem;charged:Z
      intermediary field_7937 Lnet/minecraft/class_1764;field_7937:Z
      official l Lcsq;l:Z
    • loaded

      private boolean loaded
      Mappings:
      Namespace Name Mixin selector
      named loaded Lnet/minecraft/item/CrossbowItem;loaded:Z
      intermediary field_7936 Lnet/minecraft/class_1764;field_7936:Z
      official m Lcsq;m:Z
  • Constructor Details

    • CrossbowItem

      public CrossbowItem(Item.Settings settings)
      Mappings:
      Namespace Name Mixin selector
      named <init> Lnet/minecraft/item/Item;<init>(Lnet/minecraft/item/Item$Settings;)V
      intermediary <init> Lnet/minecraft/class_1792;<init>(Lnet/minecraft/class_1792$class_1793;)V
      official <init> Lcty;<init>(Lcty$a;)V
  • Method Details

    • getHeldProjectiles

      public Predicate<ItemStack> getHeldProjectiles()
      Overrides:
      getHeldProjectiles in class RangedWeaponItem
      Mappings:
      Namespace Name Mixin selector
      named getHeldProjectiles Lnet/minecraft/item/RangedWeaponItem;getHeldProjectiles()Ljava/util/function/Predicate;
      intermediary method_20310 Lnet/minecraft/class_1811;method_20310()Ljava/util/function/Predicate;
      official d Lcuw;d()Ljava/util/function/Predicate;
    • getProjectiles

      public Predicate<ItemStack> getProjectiles()
      Specified by:
      getProjectiles in class RangedWeaponItem
      Mappings:
      Namespace Name Mixin selector
      named getProjectiles Lnet/minecraft/item/RangedWeaponItem;getProjectiles()Ljava/util/function/Predicate;
      intermediary method_19268 Lnet/minecraft/class_1811;method_19268()Ljava/util/function/Predicate;
      official b Lcuw;b()Ljava/util/function/Predicate;
    • use

      public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand)
      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:
      use in class Item
      Parameters:
      world - the world the item was used in
      user - the player who used the item
      hand - 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 use Lnet/minecraft/item/Item;use(Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/TypedActionResult;
      intermediary method_7836 Lnet/minecraft/class_1792;method_7836(Lnet/minecraft/class_1937;Lnet/minecraft/class_1657;Lnet/minecraft/class_1268;)Lnet/minecraft/class_1271;
      official a Lcty;a(Ldcg;Lcml;Lbqg;)Lbqi;
    • getSpeed

      private static float getSpeed(ChargedProjectilesComponent stack)
      Mappings:
      Namespace Name Mixin selector
      named getSpeed Lnet/minecraft/item/CrossbowItem;getSpeed(Lnet/minecraft/component/type/ChargedProjectilesComponent;)F
      intermediary method_20309 Lnet/minecraft/class_1764;method_20309(Lnet/minecraft/class_9278;)F
      official a Lcsq;a(Lcwq;)F
    • onStoppedUsing

      public void 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.

      user might not be a player in some cases. For example, this occurs when an entity uses a crossbow.

      Overrides:
      onStoppedUsing in class Item
      Mappings:
      Namespace Name Mixin selector
      named onStoppedUsing Lnet/minecraft/item/Item;onStoppedUsing(Lnet/minecraft/item/ItemStack;Lnet/minecraft/world/World;Lnet/minecraft/entity/LivingEntity;I)V
      intermediary method_7840 Lnet/minecraft/class_1792;method_7840(Lnet/minecraft/class_1799;Lnet/minecraft/class_1937;Lnet/minecraft/class_1309;I)V
      official a Lcty;a(Lcud;Ldcg;Lbtc;I)V
    • loadProjectiles

      private static boolean loadProjectiles(LivingEntity shooter, ItemStack crossbow)
      Mappings:
      Namespace Name Mixin selector
      named loadProjectiles Lnet/minecraft/item/CrossbowItem;loadProjectiles(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;)Z
      intermediary method_7767 Lnet/minecraft/class_1764;method_7767(Lnet/minecraft/class_1309;Lnet/minecraft/class_1799;)Z
      official a Lcsq;a(Lbtc;Lcud;)Z
    • isCharged

      public static boolean isCharged(ItemStack stack)
      Mappings:
      Namespace Name Mixin selector
      named isCharged Lnet/minecraft/item/CrossbowItem;isCharged(Lnet/minecraft/item/ItemStack;)Z
      intermediary method_7781 Lnet/minecraft/class_1764;method_7781(Lnet/minecraft/class_1799;)Z
      official i Lcsq;i(Lcud;)Z
    • shoot

      protected void shoot(LivingEntity shooter, ProjectileEntity projectile, int index, float speed, float divergence, float yaw, @Nullable @Nullable LivingEntity target)
      Specified by:
      shoot in class RangedWeaponItem
      Mappings:
      Namespace Name Mixin selector
      named shoot Lnet/minecraft/item/RangedWeaponItem;shoot(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/entity/projectile/ProjectileEntity;IFFFLnet/minecraft/entity/LivingEntity;)V
      intermediary method_7763 Lnet/minecraft/class_1811;method_7763(Lnet/minecraft/class_1309;Lnet/minecraft/class_1676;IFFFLnet/minecraft/class_1309;)V
      official a Lcuw;a(Lbtc;Lcnd;IFFFLbtc;)V
    • calcVelocity

      private static Vector3f calcVelocity(LivingEntity shooter, Vec3d direction, float yaw)
      Mappings:
      Namespace Name Mixin selector
      named calcVelocity Lnet/minecraft/item/CrossbowItem;calcVelocity(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/util/math/Vec3d;F)Lorg/joml/Vector3f;
      intermediary method_57343 Lnet/minecraft/class_1764;method_57343(Lnet/minecraft/class_1309;Lnet/minecraft/class_243;F)Lorg/joml/Vector3f;
      official a Lcsq;a(Lbtc;Lewh;F)Lorg/joml/Vector3f;
    • createArrowEntity

      protected ProjectileEntity createArrowEntity(World world, LivingEntity shooter, ItemStack weaponStack, ItemStack projectileStack, boolean critical)
      Overrides:
      createArrowEntity in class RangedWeaponItem
      Mappings:
      Namespace Name Mixin selector
      named createArrowEntity Lnet/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_57344 Lnet/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 a Lcuw;a(Ldcg;Lbtc;Lcud;Lcud;Z)Lcnd;
    • getWeaponStackDamage

      protected int getWeaponStackDamage(ItemStack projectile)
      Overrides:
      getWeaponStackDamage in class RangedWeaponItem
      Mappings:
      Namespace Name Mixin selector
      named getWeaponStackDamage Lnet/minecraft/item/RangedWeaponItem;getWeaponStackDamage(Lnet/minecraft/item/ItemStack;)I
      intermediary method_57345 Lnet/minecraft/class_1811;method_57345(Lnet/minecraft/class_1799;)I
      official j Lcuw;j(Lcud;)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 shootAll Lnet/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
      intermediary method_7777 Lnet/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;)V
      official a Lcsq;a(Ldcg;Lbtc;Lbqg;Lcud;FFLbtc;)V
    • getSoundPitch

      private static float getSoundPitch(Random random, int index)
      Mappings:
      Namespace Name Mixin selector
      named getSoundPitch Lnet/minecraft/item/CrossbowItem;getSoundPitch(Lnet/minecraft/util/math/random/Random;I)F
      intermediary method_57342 Lnet/minecraft/class_1764;method_57342(Lnet/minecraft/class_5819;I)F
      official a Lcsq;a(Layo;I)F
    • getSoundPitch

      private static float getSoundPitch(boolean flag, Random random)
      Mappings:
      Namespace Name Mixin selector
      named getSoundPitch Lnet/minecraft/item/CrossbowItem;getSoundPitch(ZLnet/minecraft/util/math/random/Random;)F
      intermediary method_7784 Lnet/minecraft/class_1764;method_7784(ZLnet/minecraft/class_5819;)F
      official a Lcsq;a(ZLayo;)F
    • usageTick

      public void usageTick(World world, LivingEntity user, ItemStack stack, int remainingUseTicks)
      Called on both the server and the client every tick while an entity uses the item. Currently used by CrossbowItem to 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:
      usageTick in class Item
      Parameters:
      remainingUseTicks - how long it's left until the entity finishes using the item, in ticks
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named usageTick Lnet/minecraft/item/Item;usageTick(Lnet/minecraft/world/World;Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;I)V
      intermediary method_7852 Lnet/minecraft/class_1792;method_7852(Lnet/minecraft/class_1937;Lnet/minecraft/class_1309;Lnet/minecraft/class_1799;I)V
      official a Lcty;a(Ldcg;Lbtc;Lcud;I)V
    • getMaxUseTime

      public int getMaxUseTime(ItemStack stack, LivingEntity user)
      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, and Item.finishUsing(net.minecraft.item.ItemStack, net.minecraft.world.World, net.minecraft.entity.LivingEntity) is called.
      Overrides:
      getMaxUseTime in class Item
      Returns:
      the maximum use (right-click) time of this item, in ticks
      Mappings:
      Namespace Name Mixin selector
      named getMaxUseTime Lnet/minecraft/item/Item;getMaxUseTime(Lnet/minecraft/item/ItemStack;Lnet/minecraft/entity/LivingEntity;)I
      intermediary method_7881 Lnet/minecraft/class_1792;method_7881(Lnet/minecraft/class_1799;Lnet/minecraft/class_1309;)I
      official a Lcty;a(Lcud;Lbtc;)I
    • getPullTime

      public static int getPullTime(LivingEntity user)
      Mappings:
      Namespace Name Mixin selector
      named getPullTime Lnet/minecraft/item/CrossbowItem;getPullTime(Lnet/minecraft/entity/LivingEntity;)I
      intermediary method_7775 Lnet/minecraft/class_1764;method_7775(Lnet/minecraft/class_1309;)I
      official a Lcsq;a(Lbtc;)I
    • getUseAction

      public UseAction getUseAction(ItemStack stack)
      Returns the use action the item should perform.
      Overrides:
      getUseAction in class Item
      Returns:
      the use action the item should perform
      Mappings:
      Namespace Name Mixin selector
      named getUseAction Lnet/minecraft/item/Item;getUseAction(Lnet/minecraft/item/ItemStack;)Lnet/minecraft/util/UseAction;
      intermediary method_7853 Lnet/minecraft/class_1792;method_7853(Lnet/minecraft/class_1799;)Lnet/minecraft/class_1839;
      official b Lcty;b(Lcud;)Lcvy;
    • getLoadingSounds

      CrossbowItem.LoadingSounds getLoadingSounds(ItemStack stack)
      Mappings:
      Namespace Name Mixin selector
      named getLoadingSounds Lnet/minecraft/item/CrossbowItem;getLoadingSounds(Lnet/minecraft/item/ItemStack;)Lnet/minecraft/item/CrossbowItem$LoadingSounds;
      intermediary method_59976 Lnet/minecraft/class_1764;method_59976(Lnet/minecraft/class_1799;)Lnet/minecraft/class_1764$class_9693;
      official k Lcsq;k(Lcud;)Lcsq$a;
    • getPullProgress

      private static float getPullProgress(int useTicks, ItemStack stack, LivingEntity user)
      Mappings:
      Namespace Name Mixin selector
      named getPullProgress Lnet/minecraft/item/CrossbowItem;getPullProgress(ILnet/minecraft/item/ItemStack;Lnet/minecraft/entity/LivingEntity;)F
      intermediary method_7770 Lnet/minecraft/class_1764;method_7770(ILnet/minecraft/class_1799;Lnet/minecraft/class_1309;)F
      official a Lcsq;a(ILcud;Lbtc;)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 to tooltip list.
      Overrides:
      appendTooltip in class Item
      Parameters:
      tooltip - the list of tooltips to show
      Mappings:
      Namespace Name Mixin selector
      named appendTooltip Lnet/minecraft/item/Item;appendTooltip(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/Item$TooltipContext;Ljava/util/List;Lnet/minecraft/client/item/TooltipType;)V
      intermediary method_7851 Lnet/minecraft/class_1792;method_7851(Lnet/minecraft/class_1799;Lnet/minecraft/class_1792$class_9635;Ljava/util/List;Lnet/minecraft/class_1836;)V
      official a Lcty;a(Lcud;Lcty$b;Ljava/util/List;Lcvw;)V
    • isUsedOnRelease

      public boolean isUsedOnRelease(ItemStack stack)
      Overrides:
      isUsedOnRelease in class Item
      Mappings:
      Namespace Name Mixin selector
      named isUsedOnRelease Lnet/minecraft/item/Item;isUsedOnRelease(Lnet/minecraft/item/ItemStack;)Z
      intermediary method_7838 Lnet/minecraft/class_1792;method_7838(Lnet/minecraft/class_1799;)Z
      official l Lcty;l(Lcud;)Z
    • getRange

      public int getRange()
      Specified by:
      getRange in class RangedWeaponItem
      Mappings:
      Namespace Name Mixin selector
      named getRange Lnet/minecraft/item/RangedWeaponItem;getRange()I
      intermediary method_24792 Lnet/minecraft/class_1811;method_24792()I
      official c Lcuw;c()I