Class BundleItem
- All Implemented Interfaces:
ItemConvertible,ToggleableFeature
- Mappings:
Namespace Name official cdzintermediary net/minecraft/class_5537named net/minecraft/item/BundleItem
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.item.Item
Item.Settings -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final intprivate static final Stringstatic final intFields inherited from class net.minecraft.item.Item
ATTACK_DAMAGE_MODIFIER_ID, ATTACK_SPEED_MODIFIER_ID, BLOCK_ITEMS, DEFAULT_MAX_COUNT, DEFAULT_MAX_USE_TIME, ITEM_BAR_STEPSFields inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
FEATURE_ENABLED_REGISTRY_KEYS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static intaddToBundle(ItemStack bundle, ItemStack stack) voidappendTooltip(ItemStack stack, World world, List<Text> tooltip, TooltipContext context) Called by the client to append tooltips to an item.private static Optional<NbtCompound>canMergeStack(ItemStack stack, NbtList items) private static booleandropAllBundledItems(ItemStack stack, PlayerEntity player) static floatgetAmountFilled(ItemStack stack) getBundledStacks(ItemStack stack) private static intgetBundleOccupancy(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.private static intgetItemOccupancy(ItemStack stack) 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) removeFirstStack(ItemStack stack) 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, damage, finishUsing, fromBlock, getAttributeModifiers, getDefaultStack, getDrinkSound, getEatSound, getEnchantability, getFoodComponent, getMaxCount, getMaxDamage, getMaxUseTime, getMiningSpeedMultiplier, getName, getName, getOrCreateTranslationKey, getRarity, getRawId, getRecipeRemainder, getRegistryEntry, getRequiredFeatures, getTranslationKey, getTranslationKey, getUseAction, hasGlint, hasRecipeRemainder, inventoryTick, isDamageable, isEnchantable, isFireproof, isFood, isNbtSynced, isNetworkSynced, isSuitableFor, isUsedOnRelease, onCraft, onStoppedUsing, postHit, postMine, postProcessNbt, 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
-
ITEMS_KEY
- See Also:
- Mappings:
Namespace Name Mixin selector official bLcdz;b:Ljava/lang/String;intermediary field_30858Lnet/minecraft/class_5537;field_30858:Ljava/lang/String;named ITEMS_KEYLnet/minecraft/item/BundleItem;ITEMS_KEY:Ljava/lang/String;
-
MAX_STORAGE
public static final int MAX_STORAGE- See Also:
- Mappings:
Namespace Name Mixin selector official aLcdz;a:Iintermediary field_30857Lnet/minecraft/class_5537;field_30857:Inamed MAX_STORAGELnet/minecraft/item/BundleItem;MAX_STORAGE:I
-
BUNDLE_ITEM_OCCUPANCY
private static final int BUNDLE_ITEM_OCCUPANCY- See Also:
- Mappings:
Namespace Name Mixin selector official cLcdz;c:Iintermediary field_30859Lnet/minecraft/class_5537;field_30859:Inamed BUNDLE_ITEM_OCCUPANCYLnet/minecraft/item/BundleItem;BUNDLE_ITEM_OCCUPANCY:I
-
ITEM_BAR_COLOR
private static final int ITEM_BAR_COLOR- Mappings:
Namespace Name Mixin selector official dLcdz;d:Iintermediary field_27016Lnet/minecraft/class_5537;field_27016:Inamed ITEM_BAR_COLORLnet/minecraft/item/BundleItem;ITEM_BAR_COLOR:I
-
-
Constructor Details
-
BundleItem
- Mappings:
Namespace Name Mixin selector official <init>Lcfs;<init>(Lcfs$a;)Vintermediary <init>Lnet/minecraft/class_1792;<init>(Lnet/minecraft/class_1792$class_1793;)Vnamed <init>Lnet/minecraft/item/Item;<init>(Lnet/minecraft/item/Item$Settings;)V
-
-
Method Details
-
getAmountFilled
- Mappings:
Namespace Name Mixin selector official dLcdz;d(Lcfx;)Fintermediary method_31561Lnet/minecraft/class_5537;method_31561(Lnet/minecraft/class_1799;)Fnamed getAmountFilledLnet/minecraft/item/BundleItem;getAmountFilled(Lnet/minecraft/item/ItemStack;)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 official aLcfs;a(Lcfx;Lccv;Lcbl;Lbym;)Zintermediary method_31565Lnet/minecraft/class_1792;method_31565(Lnet/minecraft/class_1799;Lnet/minecraft/class_1735;Lnet/minecraft/class_5536;Lnet/minecraft/class_1657;)Znamed onStackClickedLnet/minecraft/item/Item;onStackClicked(Lnet/minecraft/item/ItemStack;Lnet/minecraft/screen/slot/Slot;Lnet/minecraft/util/ClickType;Lnet/minecraft/entity/player/PlayerEntity;)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 official aLcfs;a(Lcfx;Lcfx;Lccv;Lcbl;Lbym;Lbgq;)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;)Znamed 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;)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 official aLcfs;a(Lcmk;Lbym;Lbdv;)Lbdx;intermediary method_7836Lnet/minecraft/class_1792;method_7836(Lnet/minecraft/class_1937;Lnet/minecraft/class_1657;Lnet/minecraft/class_1268;)Lnet/minecraft/class_1271;named useLnet/minecraft/item/Item;use(Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/TypedActionResult;
-
isItemBarVisible
Returns whether to show the item bar forstack.Item bar is usually used to display durability of the stack.
When overriding this,
Item.getItemBarStep(net.minecraft.item.ItemStack)andItem.getItemBarColor(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 official eLcfs;e(Lcfx;)Zintermediary method_31567Lnet/minecraft/class_1792;method_31567(Lnet/minecraft/class_1799;)Znamed isItemBarVisibleLnet/minecraft/item/Item;isItemBarVisible(Lnet/minecraft/item/ItemStack;)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,
Item.isItemBarVisible(net.minecraft.item.ItemStack)andItem.getItemBarColor(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 official fLcfs;f(Lcfx;)Iintermediary method_31569Lnet/minecraft/class_1792;method_31569(Lnet/minecraft/class_1799;)Inamed getItemBarStepLnet/minecraft/item/Item;getItemBarStep(Lnet/minecraft/item/ItemStack;)I
-
getItemBarColor
Returns the RGB color of the item bar, usually used for durability display.When overriding this,
Item.isItemBarVisible(net.minecraft.item.ItemStack)andItem.getItemBarStep(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 official gLcfs;g(Lcfx;)Iintermediary method_31571Lnet/minecraft/class_1792;method_31571(Lnet/minecraft/class_1799;)Inamed getItemBarColorLnet/minecraft/item/Item;getItemBarColor(Lnet/minecraft/item/ItemStack;)I
-
addToBundle
- Mappings:
Namespace Name Mixin selector official bLcdz;b(Lcfx;Lcfx;)Iintermediary method_31560Lnet/minecraft/class_5537;method_31560(Lnet/minecraft/class_1799;Lnet/minecraft/class_1799;)Inamed addToBundleLnet/minecraft/item/BundleItem;addToBundle(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ItemStack;)I
-
canMergeStack
- Mappings:
Namespace Name Mixin selector official aLcdz;a(Lcfx;Lqx;)Ljava/util/Optional;intermediary method_32344Lnet/minecraft/class_5537;method_32344(Lnet/minecraft/class_1799;Lnet/minecraft/class_2499;)Ljava/util/Optional;named canMergeStackLnet/minecraft/item/BundleItem;canMergeStack(Lnet/minecraft/item/ItemStack;Lnet/minecraft/nbt/NbtList;)Ljava/util/Optional;
-
getItemOccupancy
- Mappings:
Namespace Name Mixin selector official kLcdz;k(Lcfx;)Iintermediary method_31562Lnet/minecraft/class_5537;method_31562(Lnet/minecraft/class_1799;)Inamed getItemOccupancyLnet/minecraft/item/BundleItem;getItemOccupancy(Lnet/minecraft/item/ItemStack;)I
-
getBundleOccupancy
- Mappings:
Namespace Name Mixin selector official oLcdz;o(Lcfx;)Iintermediary method_31563Lnet/minecraft/class_5537;method_31563(Lnet/minecraft/class_1799;)Inamed getBundleOccupancyLnet/minecraft/item/BundleItem;getBundleOccupancy(Lnet/minecraft/item/ItemStack;)I
-
removeFirstStack
- Mappings:
Namespace Name Mixin selector official pLcdz;p(Lcfx;)Ljava/util/Optional;intermediary method_32759Lnet/minecraft/class_5537;method_32759(Lnet/minecraft/class_1799;)Ljava/util/Optional;named removeFirstStackLnet/minecraft/item/BundleItem;removeFirstStack(Lnet/minecraft/item/ItemStack;)Ljava/util/Optional;
-
dropAllBundledItems
- Mappings:
Namespace Name Mixin selector official aLcdz;a(Lcfx;Lbym;)Zintermediary method_32757Lnet/minecraft/class_5537;method_32757(Lnet/minecraft/class_1799;Lnet/minecraft/class_1657;)Znamed dropAllBundledItemsLnet/minecraft/item/BundleItem;dropAllBundledItems(Lnet/minecraft/item/ItemStack;Lnet/minecraft/entity/player/PlayerEntity;)Z
-
getBundledStacks
- Mappings:
Namespace Name Mixin selector official qLcdz;q(Lcfx;)Ljava/util/stream/Stream;intermediary method_32345Lnet/minecraft/class_5537;method_32345(Lnet/minecraft/class_1799;)Ljava/util/stream/Stream;named getBundledStacksLnet/minecraft/item/BundleItem;getBundledStacks(Lnet/minecraft/item/ItemStack;)Ljava/util/stream/Stream;
-
getTooltipData
- Overrides:
getTooltipDatain classItem- Mappings:
Namespace Name Mixin selector official hLcfs;h(Lcfx;)Ljava/util/Optional;intermediary method_32346Lnet/minecraft/class_1792;method_32346(Lnet/minecraft/class_1799;)Ljava/util/Optional;named getTooltipDataLnet/minecraft/item/Item;getTooltipData(Lnet/minecraft/item/ItemStack;)Ljava/util/Optional;
-
appendTooltip
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 official aLcfs;a(Lcfx;Lcmk;Ljava/util/List;Lcho;)Vintermediary method_7851Lnet/minecraft/class_1792;method_7851(Lnet/minecraft/class_1799;Lnet/minecraft/class_1937;Ljava/util/List;Lnet/minecraft/class_1836;)Vnamed appendTooltipLnet/minecraft/item/Item;appendTooltip(Lnet/minecraft/item/ItemStack;Lnet/minecraft/world/World;Ljava/util/List;Lnet/minecraft/client/item/TooltipContext;)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 official aLcfs;a(Lbvf;)Vintermediary method_33261Lnet/minecraft/class_1792;method_33261(Lnet/minecraft/class_1542;)Vnamed onItemEntityDestroyedLnet/minecraft/item/Item;onItemEntityDestroyed(Lnet/minecraft/entity/ItemEntity;)V
-
playRemoveOneSound
- Mappings:
Namespace Name Mixin selector official aLcdz;a(Lbfh;)Vintermediary method_38074Lnet/minecraft/class_5537;method_38074(Lnet/minecraft/class_1297;)Vnamed playRemoveOneSoundLnet/minecraft/item/BundleItem;playRemoveOneSound(Lnet/minecraft/entity/Entity;)V
-
playInsertSound
- Mappings:
Namespace Name Mixin selector official bLcdz;b(Lbfh;)Vintermediary method_38076Lnet/minecraft/class_5537;method_38076(Lnet/minecraft/class_1297;)Vnamed playInsertSoundLnet/minecraft/item/BundleItem;playInsertSound(Lnet/minecraft/entity/Entity;)V
-
playDropContentsSound
- Mappings:
Namespace Name Mixin selector official cLcdz;c(Lbfh;)Vintermediary method_38077Lnet/minecraft/class_5537;method_38077(Lnet/minecraft/class_1297;)Vnamed playDropContentsSoundLnet/minecraft/item/BundleItem;playDropContentsSound(Lnet/minecraft/entity/Entity;)V
-