Class BundleItem
- All Implemented Interfaces:
ItemConvertible
,ToggleableFeature
- Mappings:
Namespace Name named net/minecraft/item/BundleItem
intermediary net/minecraft/class_5537
official csw
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.item.Item
Item.Settings, Item.TooltipContext
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final int
private static final int
Fields 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_COUNT
Fields inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
FEATURE_ENABLED_REGISTRY_KEYS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
appendTooltip
(ItemStack stack, Item.TooltipContext context, List<Text> tooltip, TooltipType type) Called by the client to append tooltips to an item.private static boolean
dropAllBundledItems
(ItemStack stack, PlayerEntity player) static float
getAmountFilled
(ItemStack stack) int
getItemBarColor
(ItemStack stack) Returns the RGB color of the item bar, usually used for durability display.int
getItemBarStep
(ItemStack stack) Returns the step, or the length of the colored area of the item bar, forstack
.getTooltipData
(ItemStack stack) boolean
isItemBarVisible
(ItemStack stack) Returns whether to show the item bar forstack
.boolean
onClicked
(ItemStack stack, ItemStack otherStack, Slot slot, ClickType clickType, PlayerEntity player, StackReference cursorStackReference) Called when the item atslot
gets clicked by the cursor holdingotherStack
.void
onItemEntityDestroyed
(ItemEntity entity) Called on the server when anItemEntity
holding this item gets destroyed.boolean
onStackClicked
(ItemStack stack, Slot slot, ClickType clickType, PlayerEntity player) Called when the item at the cursor is clicked atslot
.private void
playDropContentsSound
(Entity entity) private void
playInsertSound
(Entity entity) private void
playRemoveOneSound
(Entity entity) 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
asItem, byRawId, canBeNested, canMine, canRepair, finishUsing, fromBlock, getAttributeModifiers, getBonusAttackDamage, getBreakSound, getComponents, getDefaultStack, getDrinkSound, getEatSound, getEnchantability, getMaxCount, getMaxUseTime, getMiningSpeed, getName, getName, getOrCreateTranslationKey, getRawId, getRecipeRemainder, getRegistryEntry, getRequiredFeatures, getTranslationKey, getTranslationKey, getUseAction, hasGlint, hasRecipeRemainder, inventoryTick, isCorrectForDrops, isEnchantable, isNetworkSynced, isUsedOnRelease, onCraft, onCraftByPlayer, onStoppedUsing, postDamageEntity, postHit, postMine, postProcessComponents, raycast, toString, usageTick, useOnBlock, useOnEntity
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
isEnabled
-
Field Details
-
ITEM_BAR_COLOR
private static final int ITEM_BAR_COLOR- Mappings:
Namespace Name Mixin selector named ITEM_BAR_COLOR
Lnet/minecraft/item/BundleItem;ITEM_BAR_COLOR:I
intermediary field_27016
Lnet/minecraft/class_5537;field_27016:I
official a
Lcsw;a:I
-
field_51352
private static final int field_51352- See Also:
- Mappings:
Namespace Name Mixin selector named field_51352
Lnet/minecraft/item/BundleItem;field_51352:I
intermediary field_51352
Lnet/minecraft/class_5537;field_51352:I
official b
Lcsw;b:I
-
-
Constructor Details
-
BundleItem
- 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>
Lcul;<init>(Lcul$a;)V
-
-
Method Details
-
getAmountFilled
- Mappings:
Namespace Name Mixin selector named getAmountFilled
Lnet/minecraft/item/BundleItem;getAmountFilled(Lnet/minecraft/item/ItemStack;)F
intermediary method_31561
Lnet/minecraft/class_5537;method_31561(Lnet/minecraft/class_1799;)F
official c
Lcsw;c(Lcuq;)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
BundleItem
when the cursor holds a bundle and the player clicks on the slot.- Overrides:
onStackClicked
in classItem
- Parameters:
stack
- the stack the cursor holdsslot
- the clicked slot- Returns:
- whether the action was successful
- Mappings:
Namespace Name Mixin selector named onStackClicked
Lnet/minecraft/item/Item;onStackClicked(Lnet/minecraft/item/ItemStack;Lnet/minecraft/screen/slot/Slot;Lnet/minecraft/util/ClickType;Lnet/minecraft/entity/player/PlayerEntity;)Z
intermediary method_31565
Lnet/minecraft/class_1792;method_31565(Lnet/minecraft/class_1799;Lnet/minecraft/class_1735;Lnet/minecraft/class_5536;Lnet/minecraft/class_1657;)Z
official a
Lcul;a(Lcuq;Lcrq;Lcqd;Lcmx;)Z
-
onClicked
public boolean onClicked(ItemStack stack, ItemStack otherStack, Slot slot, ClickType clickType, PlayerEntity player, StackReference cursorStackReference) Called when the item atslot
gets 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
BundleItem
when the cursor holds an item and the player clicks on the slot that has a bundle.- Overrides:
onClicked
in 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 onClicked
Lnet/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;)Z
intermediary method_31566
Lnet/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;)Z
official a
Lcul;a(Lcuq;Lcuq;Lcrq;Lcqd;Lcmx;Lbug;)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,
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:
use
in 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 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
Lcul;a(Ldcw;Lcmx;Lbqq;)Lbqs;
-
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:
isItemBarVisible
in classItem
- Returns:
- whether to show the item bar for
stack
- Mappings:
Namespace Name Mixin selector named isItemBarVisible
Lnet/minecraft/item/Item;isItemBarVisible(Lnet/minecraft/item/ItemStack;)Z
intermediary method_31567
Lnet/minecraft/class_1792;method_31567(Lnet/minecraft/class_1799;)Z
official d
Lcul;d(Lcuq;)Z
-
getItemBarStep
Returns the step, or the length of the colored area of the item bar, forstack
.This is between
0.0f
and {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:
getItemBarStep
in classItem
- Returns:
- the step, or the length of the colored area of the item bar, for
stack
- Mappings:
Namespace Name Mixin selector named getItemBarStep
Lnet/minecraft/item/Item;getItemBarStep(Lnet/minecraft/item/ItemStack;)I
intermediary method_31569
Lnet/minecraft/class_1792;method_31569(Lnet/minecraft/class_1799;)I
official e
Lcul;e(Lcuq;)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:
getItemBarColor
in classItem
- Returns:
- the RGB color of the item bar, usually used for durability display
- Mappings:
Namespace Name Mixin selector named getItemBarColor
Lnet/minecraft/item/Item;getItemBarColor(Lnet/minecraft/item/ItemStack;)I
intermediary method_31571
Lnet/minecraft/class_1792;method_31571(Lnet/minecraft/class_1799;)I
official f
Lcul;f(Lcuq;)I
-
dropAllBundledItems
- Mappings:
Namespace Name Mixin selector named dropAllBundledItems
Lnet/minecraft/item/BundleItem;dropAllBundledItems(Lnet/minecraft/item/ItemStack;Lnet/minecraft/entity/player/PlayerEntity;)Z
intermediary method_32757
Lnet/minecraft/class_5537;method_32757(Lnet/minecraft/class_1799;Lnet/minecraft/class_1657;)Z
official a
Lcsw;a(Lcuq;Lcmx;)Z
-
getTooltipData
- Overrides:
getTooltipData
in classItem
- Mappings:
Namespace Name Mixin selector named getTooltipData
Lnet/minecraft/item/Item;getTooltipData(Lnet/minecraft/item/ItemStack;)Ljava/util/Optional;
intermediary method_32346
Lnet/minecraft/class_1792;method_32346(Lnet/minecraft/class_1799;)Ljava/util/Optional;
official g
Lcul;g(Lcuq;)Ljava/util/Optional;
-
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 totooltip
list.- Overrides:
appendTooltip
in classItem
- 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/item/tooltip/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
Lcul;a(Lcuq;Lcul$b;Ljava/util/List;Lcwm;)V
-
onItemEntityDestroyed
Called on the server when anItemEntity
holding 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:
onItemEntityDestroyed
in classItem
- See Also:
- Mappings:
Namespace Name Mixin selector named onItemEntityDestroyed
Lnet/minecraft/item/Item;onItemEntityDestroyed(Lnet/minecraft/entity/ItemEntity;)V
intermediary method_33261
Lnet/minecraft/class_1792;method_33261(Lnet/minecraft/class_1542;)V
official a
Lcul;a(Lcjh;)V
-
playRemoveOneSound
- Mappings:
Namespace Name Mixin selector named playRemoveOneSound
Lnet/minecraft/item/BundleItem;playRemoveOneSound(Lnet/minecraft/entity/Entity;)V
intermediary method_38074
Lnet/minecraft/class_5537;method_38074(Lnet/minecraft/class_1297;)V
official a
Lcsw;a(Lbsr;)V
-
playInsertSound
- Mappings:
Namespace Name Mixin selector named playInsertSound
Lnet/minecraft/item/BundleItem;playInsertSound(Lnet/minecraft/entity/Entity;)V
intermediary method_38076
Lnet/minecraft/class_5537;method_38076(Lnet/minecraft/class_1297;)V
official b
Lcsw;b(Lbsr;)V
-
playDropContentsSound
- Mappings:
Namespace Name Mixin selector named playDropContentsSound
Lnet/minecraft/item/BundleItem;playDropContentsSound(Lnet/minecraft/entity/Entity;)V
intermediary method_38077
Lnet/minecraft/class_5537;method_38077(Lnet/minecraft/class_1297;)V
official c
Lcsw;c(Lbsr;)V
-