Class BundleItem
- All Implemented Interfaces:
ItemConvertible,ToggleableFeature
- Mappings:
Namespace Name named net/minecraft/item/BundleItemintermediary net/minecraft/class_5537official csw
-
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 intFields 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_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 booleandropAllBundledItems(ItemStack stack, PlayerEntity player) static floatgetAmountFilled(ItemStack stack) 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.getTooltipData(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.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 voidplayDropContentsSound(Entity entity) private voidplayInsertSound(Entity entity) private voidplayRemoveOneSound(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, 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
-
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 aLcsw;a:I
-
field_51352
private static final int field_51352- See Also:
- Mappings:
Namespace Name Mixin selector named field_51352Lnet/minecraft/item/BundleItem;field_51352:Iintermediary field_51352Lnet/minecraft/class_5537;field_51352:Iofficial bLcsw;b: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>Lcul;<init>(Lcul$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 cLcsw;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
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 aLcul;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 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 aLcul;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:
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 aLcul;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:
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 dLcul;d(Lcuq;)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 eLcul;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:
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 fLcul;f(Lcuq;)I
-
dropAllBundledItems
- Mappings:
Namespace Name Mixin selector named dropAllBundledItemsLnet/minecraft/item/BundleItem;dropAllBundledItems(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 aLcsw;a(Lcuq;Lcmx;)Z
-
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 gLcul;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 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/item/tooltip/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 aLcul;a(Lcuq;Lcul$b;Ljava/util/List;Lcwm;)V
-
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 aLcul;a(Lcjh;)V
-
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 aLcsw;a(Lbsr;)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 bLcsw;b(Lbsr;)V
-
playDropContentsSound
- Mappings:
Namespace Name Mixin selector named playDropContentsSoundLnet/minecraft/item/BundleItem;playDropContentsSound(Lnet/minecraft/entity/Entity;)Vintermediary method_38077Lnet/minecraft/class_5537;method_38077(Lnet/minecraft/class_1297;)Vofficial cLcsw;c(Lbsr;)V
-