Class BundleItem
- All Implemented Interfaces:
ItemConvertible,ToggleableFeature
- Mappings:
Namespace Name named net/minecraft/item/BundleItemintermediary net/minecraft/class_5537official cyz
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.item.Item
Item.Settings, Item.TooltipContext -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final intprivate static final intprivate static final intstatic final intstatic final intprivate static final intstatic final intstatic final intFields 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 voiddropContentsOnUse(World world, PlayerEntity player, ItemStack stack) private booleandropFirstBundledStack(ItemStack stack, PlayerEntity player) static floatgetAmountFilled(ItemStack stack) static Itemstatic List<BundleItem> intgetItemBarColor(ItemStack stack) Returns the RGB color of the item bar, usually used for durability display.intgetItemBarStep(ItemStack stack) Returns the step, or the length of the colored area of the item bar, forstack.intgetMaxUseTime(ItemStack stack, LivingEntity user) Returns the maximum use (right-click) time of this item, in ticks.static intgetNumberOfStacksShown(ItemStack stack) static ItemStackgetSelectedStack(ItemStack stack) static intgetSelectedStackIndex(ItemStack stack) getTooltipData(ItemStack stack) getUseAction(ItemStack stack) Returns the use action the item should perform.static booleanhasSelectedStack(ItemStack stack) booleanisItemBarVisible(ItemStack stack) Returns whether to show the item bar forstack.booleanonClicked(ItemStack stack, ItemStack otherStack, Slot slot, ClickType clickType, PlayerEntity player, StackReference cursorStackReference) Called when the item atslotgets clicked by the cursor holdingotherStack.private voidonContentChanged(PlayerEntity user) voidonItemEntityDestroyed(ItemEntity entity) Called on the server when anItemEntityholding this item gets destroyed.booleanonStackClicked(ItemStack stack, Slot slot, ClickType clickType, PlayerEntity player) Called when the item at the cursor is clicked atslot.private static voidplayDropContentsSound(World world, Entity entity) private static voidplayInsertFailSound(Entity entity) private static voidplayInsertSound(Entity entity) private static voidplayRemoveOneSound(Entity entity) popFirstBundledStack(ItemStack stack, PlayerEntity player, BundleContentsComponent contents) static voidsetSelectedStackIndex(ItemStack stack, int selectedStackIndex) 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.Item
appendTooltip, asItem, byRawId, canBeNested, canMine, finishUsing, fromBlock, getBonusAttackDamage, getComponents, getDamageSource, getDefaultStack, getMaxCount, getMiningSpeed, getName, getName, getRawId, getRecipeRemainder, getRegistryEntry, getRequiredFeatures, getTranslationKey, hasGlint, inventoryTick, isCorrectForDrops, isUsedOnRelease, onCraft, onCraftByPlayer, onStoppedUsing, 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
-
TOOLTIP_STACKS_COLUMNS
public static final int TOOLTIP_STACKS_COLUMNS- See Also:
- Mappings:
Namespace Name Mixin selector named TOOLTIP_STACKS_COLUMNSLnet/minecraft/item/BundleItem;TOOLTIP_STACKS_COLUMNS:Iintermediary field_52575Lnet/minecraft/class_5537;field_52575:Iofficial aLcyz;a:I
-
TOOLTIP_STACKS_ROWS
public static final int TOOLTIP_STACKS_ROWS- See Also:
- Mappings:
Namespace Name Mixin selector named TOOLTIP_STACKS_ROWSLnet/minecraft/item/BundleItem;TOOLTIP_STACKS_ROWS:Iintermediary field_52576Lnet/minecraft/class_5537;field_52576:Iofficial bLcyz;b:I
-
MAX_TOOLTIP_STACKS_SHOWN
public static final int MAX_TOOLTIP_STACKS_SHOWN- See Also:
- Mappings:
Namespace Name Mixin selector named MAX_TOOLTIP_STACKS_SHOWNLnet/minecraft/item/BundleItem;MAX_TOOLTIP_STACKS_SHOWN:Iintermediary field_52577Lnet/minecraft/class_5537;field_52577:Iofficial cLcyz;c:I
-
MAX_TOOLTIP_STACKS_SHOWN_WHEN_TOO_MANY_TYPES
public static final int MAX_TOOLTIP_STACKS_SHOWN_WHEN_TOO_MANY_TYPES- See Also:
- Mappings:
Namespace Name Mixin selector named MAX_TOOLTIP_STACKS_SHOWN_WHEN_TOO_MANY_TYPESLnet/minecraft/item/BundleItem;MAX_TOOLTIP_STACKS_SHOWN_WHEN_TOO_MANY_TYPES:Iintermediary field_52578Lnet/minecraft/class_5537;field_52578:Iofficial dLcyz;d:I
-
FULL_ITEM_BAR_COLOR
private static final int FULL_ITEM_BAR_COLOR- Mappings:
Namespace Name Mixin selector named FULL_ITEM_BAR_COLORLnet/minecraft/item/BundleItem;FULL_ITEM_BAR_COLOR:Iintermediary field_52579Lnet/minecraft/class_5537;field_52579:Iofficial oLcyz;o:I
-
ITEM_BAR_COLOR
private static final int ITEM_BAR_COLOR- Mappings:
Namespace Name Mixin selector named ITEM_BAR_COLORLnet/minecraft/item/BundleItem;ITEM_BAR_COLOR:Iintermediary field_27016Lnet/minecraft/class_5537;field_27016:Iofficial pLcyz;p:I
-
field_54109
private static final int field_54109- See Also:
- Mappings:
Namespace Name Mixin selector named field_54109Lnet/minecraft/item/BundleItem;field_54109:Iintermediary field_54109Lnet/minecraft/class_5537;field_54109:Iofficial qLcyz;q:I
-
field_54110
private static final int field_54110- See Also:
- Mappings:
Namespace Name Mixin selector named field_54110Lnet/minecraft/item/BundleItem;field_54110:Iintermediary field_54110Lnet/minecraft/class_5537;field_54110:Iofficial rLcyz;r:I
-
MAX_USE_TIME
private static final int MAX_USE_TIME- See Also:
- Mappings:
Namespace Name Mixin selector named MAX_USE_TIMELnet/minecraft/item/BundleItem;MAX_USE_TIME:Iintermediary field_54111Lnet/minecraft/class_5537;field_54111:Iofficial sLcyz;s:I
-
-
Constructor Details
-
BundleItem
- 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
-
getAmountFilled
- Mappings:
Namespace Name Mixin selector named getAmountFilledLnet/minecraft/item/BundleItem;getAmountFilled(Lnet/minecraft/item/ItemStack;)Fintermediary method_31561Lnet/minecraft/class_5537;method_31561(Lnet/minecraft/class_1799;)Fofficial cLcyz;c(Ldak;)F
-
onStackClicked
Called when the item at the cursor is clicked atslot.While this method is usually called on the logical server, it can also be called on the logical client, so take caution when overriding this method. The logical side can be checked using
World.isClient.For example, this is called on
BundleItemwhen the cursor holds a bundle and the player clicks on the slot.- Overrides:
onStackClickedin classItem- Parameters:
stack- the stack the cursor holdsslot- the clicked slot- Returns:
- whether the action was successful
- Mappings:
Namespace Name Mixin selector named onStackClickedLnet/minecraft/item/Item;onStackClicked(Lnet/minecraft/item/ItemStack;Lnet/minecraft/screen/slot/Slot;Lnet/minecraft/util/ClickType;Lnet/minecraft/entity/player/PlayerEntity;)Zintermediary method_31565Lnet/minecraft/class_1792;method_31565(Lnet/minecraft/class_1799;Lnet/minecraft/class_1735;Lnet/minecraft/class_5536;Lnet/minecraft/class_1657;)Zofficial aLdag;a(Ldak;Lcxz;Lcwl;Lcsi;)Z
-
onClicked
public boolean onClicked(ItemStack stack, ItemStack otherStack, Slot slot, ClickType clickType, PlayerEntity player, StackReference cursorStackReference) Called when the item atslotgets clicked by the cursor holdingotherStack.While this method is usually called on the logical server, it can also be called on the logical client, so take caution when overriding this method. The logical side can be checked using
World.isClient.For example, this is called on
BundleItemwhen the cursor holds an item and the player clicks on the slot that has a bundle.- Overrides:
onClickedin classItem- Parameters:
stack- the slot's stackotherStack- the stack the cursor holdsslot- the clicked slot- Returns:
- whether the action was successful
- Mappings:
Namespace Name Mixin selector named onClickedLnet/minecraft/item/Item;onClicked(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ItemStack;Lnet/minecraft/screen/slot/Slot;Lnet/minecraft/util/ClickType;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/inventory/StackReference;)Zintermediary method_31566Lnet/minecraft/class_1792;method_31566(Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;Lnet/minecraft/class_1735;Lnet/minecraft/class_5536;Lnet/minecraft/class_1657;Lnet/minecraft/class_5630;)Zofficial aLdag;a(Ldak;Ldak;Lcxz;Lcwl;Lcsi;Lbyw;)Z
-
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;
-
dropContentsOnUse
- Mappings:
Namespace Name Mixin selector named dropContentsOnUseLnet/minecraft/item/BundleItem;dropContentsOnUse(Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/item/ItemStack;)Vintermediary method_63675Lnet/minecraft/class_5537;method_63675(Lnet/minecraft/class_1937;Lnet/minecraft/class_1657;Lnet/minecraft/class_1799;)Vofficial aLcyz;a(Ldkj;Lcsi;Ldak;)V
-
isItemBarVisible
Returns whether to show the item bar forstack.Item bar is usually used to display durability of the stack.
When overriding this,
getItemBarStep(net.minecraft.item.ItemStack)andgetItemBarColor(net.minecraft.item.ItemStack)should also be overridden.- Overrides:
isItemBarVisiblein classItem- Returns:
- whether to show the item bar for
stack - Mappings:
Namespace Name Mixin selector named isItemBarVisibleLnet/minecraft/item/Item;isItemBarVisible(Lnet/minecraft/item/ItemStack;)Zintermediary method_31567Lnet/minecraft/class_1792;method_31567(Lnet/minecraft/class_1799;)Zofficial dLdag;d(Ldak;)Z
-
getItemBarStep
Returns the step, or the length of the colored area of the item bar, forstack.This is between
0.0fand {code 13.0f}. By default, this isdurability * 13.0f / maxDurability.When overriding this,
isItemBarVisible(net.minecraft.item.ItemStack)andgetItemBarColor(net.minecraft.item.ItemStack)should also be overridden.- Overrides:
getItemBarStepin classItem- Returns:
- the step, or the length of the colored area of the item bar, for
stack - Mappings:
Namespace Name Mixin selector named getItemBarStepLnet/minecraft/item/Item;getItemBarStep(Lnet/minecraft/item/ItemStack;)Iintermediary method_31569Lnet/minecraft/class_1792;method_31569(Lnet/minecraft/class_1799;)Iofficial eLdag;e(Ldak;)I
-
getItemBarColor
Returns the RGB color of the item bar, usually used for durability display.When overriding this,
isItemBarVisible(net.minecraft.item.ItemStack)andgetItemBarStep(net.minecraft.item.ItemStack)should also be overridden.- Overrides:
getItemBarColorin classItem- Returns:
- the RGB color of the item bar, usually used for durability display
- Mappings:
Namespace Name Mixin selector named getItemBarColorLnet/minecraft/item/Item;getItemBarColor(Lnet/minecraft/item/ItemStack;)Iintermediary method_31571Lnet/minecraft/class_1792;method_31571(Lnet/minecraft/class_1799;)Iofficial fLdag;f(Ldak;)I
-
setSelectedStackIndex
- Mappings:
Namespace Name Mixin selector named setSelectedStackIndexLnet/minecraft/item/BundleItem;setSelectedStackIndex(Lnet/minecraft/item/ItemStack;I)Vintermediary method_61637Lnet/minecraft/class_5537;method_61637(Lnet/minecraft/class_1799;I)Vofficial aLcyz;a(Ldak;I)V
-
hasSelectedStack
- Mappings:
Namespace Name Mixin selector named hasSelectedStackLnet/minecraft/item/BundleItem;hasSelectedStack(Lnet/minecraft/item/ItemStack;)Zintermediary method_61642Lnet/minecraft/class_5537;method_61642(Lnet/minecraft/class_1799;)Zofficial gLcyz;g(Ldak;)Z
-
getSelectedStackIndex
- Mappings:
Namespace Name Mixin selector named getSelectedStackIndexLnet/minecraft/item/BundleItem;getSelectedStackIndex(Lnet/minecraft/item/ItemStack;)Iintermediary method_61643Lnet/minecraft/class_5537;method_61643(Lnet/minecraft/class_1799;)Iofficial hLcyz;h(Ldak;)I
-
getSelectedStack
- Mappings:
Namespace Name Mixin selector named getSelectedStackLnet/minecraft/item/BundleItem;getSelectedStack(Lnet/minecraft/item/ItemStack;)Lnet/minecraft/item/ItemStack;intermediary method_61644Lnet/minecraft/class_5537;method_61644(Lnet/minecraft/class_1799;)Lnet/minecraft/class_1799;official iLcyz;i(Ldak;)Ldak;
-
getNumberOfStacksShown
- Mappings:
Namespace Name Mixin selector named getNumberOfStacksShownLnet/minecraft/item/BundleItem;getNumberOfStacksShown(Lnet/minecraft/item/ItemStack;)Iintermediary method_61645Lnet/minecraft/class_5537;method_61645(Lnet/minecraft/class_1799;)Iofficial jLcyz;j(Ldak;)I
-
dropFirstBundledStack
- Mappings:
Namespace Name Mixin selector named dropFirstBundledStackLnet/minecraft/item/BundleItem;dropFirstBundledStack(Lnet/minecraft/item/ItemStack;Lnet/minecraft/entity/player/PlayerEntity;)Zintermediary method_32757Lnet/minecraft/class_5537;method_32757(Lnet/minecraft/class_1799;Lnet/minecraft/class_1657;)Zofficial bLcyz;b(Ldak;Lcsi;)Z
-
popFirstBundledStack
private static Optional<ItemStack> popFirstBundledStack(ItemStack stack, PlayerEntity player, BundleContentsComponent contents) - Mappings:
Namespace Name Mixin selector named popFirstBundledStackLnet/minecraft/item/BundleItem;popFirstBundledStack(Lnet/minecraft/item/ItemStack;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/component/type/BundleContentsComponent;)Ljava/util/Optional;intermediary method_63676Lnet/minecraft/class_5537;method_63676(Lnet/minecraft/class_1799;Lnet/minecraft/class_1657;Lnet/minecraft/class_9276;)Ljava/util/Optional;official aLcyz;a(Ldak;Lcsi;Ldcn;)Ljava/util/Optional;
-
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
-
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;
-
getTooltipData
- Overrides:
getTooltipDatain classItem- Mappings:
Namespace Name Mixin selector named getTooltipDataLnet/minecraft/item/Item;getTooltipData(Lnet/minecraft/item/ItemStack;)Ljava/util/Optional;intermediary method_32346Lnet/minecraft/class_1792;method_32346(Lnet/minecraft/class_1799;)Ljava/util/Optional;official kLdag;k(Ldak;)Ljava/util/Optional;
-
onItemEntityDestroyed
Called on the server when anItemEntityholding this item gets destroyed. This can happen due to fire, lava, cactus, explosion, etc. Items that can hold other items should override this to drop its contents.- Overrides:
onItemEntityDestroyedin classItem- See Also:
- Mappings:
Namespace Name Mixin selector named onItemEntityDestroyedLnet/minecraft/item/Item;onItemEntityDestroyed(Lnet/minecraft/entity/ItemEntity;)Vintermediary method_33261Lnet/minecraft/class_1792;method_33261(Lnet/minecraft/class_1542;)Vofficial aLdag;a(Lcoo;)V
-
getBundles
- Mappings:
Namespace Name Mixin selector named getBundlesLnet/minecraft/item/BundleItem;getBundles()Ljava/util/List;intermediary method_64975Lnet/minecraft/class_5537;method_64975()Ljava/util/List;official aLcyz;a()Ljava/util/List;
-
getBundle
- Mappings:
Namespace Name Mixin selector named getBundleLnet/minecraft/item/BundleItem;getBundle(Lnet/minecraft/util/DyeColor;)Lnet/minecraft/item/Item;intermediary method_64277Lnet/minecraft/class_5537;method_64277(Lnet/minecraft/class_1767;)Lnet/minecraft/class_1792;official aLcyz;a(Lczi;)Ldag;
-
playRemoveOneSound
- Mappings:
Namespace Name Mixin selector named playRemoveOneSoundLnet/minecraft/item/BundleItem;playRemoveOneSound(Lnet/minecraft/entity/Entity;)Vintermediary method_38074Lnet/minecraft/class_5537;method_38074(Lnet/minecraft/class_1297;)Vofficial aLcyz;a(Lbxe;)V
-
playInsertSound
- Mappings:
Namespace Name Mixin selector named playInsertSoundLnet/minecraft/item/BundleItem;playInsertSound(Lnet/minecraft/entity/Entity;)Vintermediary method_38076Lnet/minecraft/class_5537;method_38076(Lnet/minecraft/class_1297;)Vofficial bLcyz;b(Lbxe;)V
-
playInsertFailSound
- Mappings:
Namespace Name Mixin selector named playInsertFailSoundLnet/minecraft/item/BundleItem;playInsertFailSound(Lnet/minecraft/entity/Entity;)Vintermediary method_61641Lnet/minecraft/class_5537;method_61641(Lnet/minecraft/class_1297;)Vofficial cLcyz;c(Lbxe;)V
-
playDropContentsSound
- Mappings:
Namespace Name Mixin selector named playDropContentsSoundLnet/minecraft/item/BundleItem;playDropContentsSound(Lnet/minecraft/world/World;Lnet/minecraft/entity/Entity;)Vintermediary method_38077Lnet/minecraft/class_5537;method_38077(Lnet/minecraft/class_1937;Lnet/minecraft/class_1297;)Vofficial aLcyz;a(Ldkj;Lbxe;)V
-
onContentChanged
- Mappings:
Namespace Name Mixin selector named onContentChangedLnet/minecraft/item/BundleItem;onContentChanged(Lnet/minecraft/entity/player/PlayerEntity;)Vintermediary method_64502Lnet/minecraft/class_5537;method_64502(Lnet/minecraft/class_1657;)Vofficial aLcyz;a(Lcsi;)V
-