Package net.minecraft.item
Class BundleItem
java.lang.Object
net.minecraft.item.Item
net.minecraft.item.BundleItem
- All Implemented Interfaces:
ItemConvertible
public class BundleItem extends Item
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.item.Item
Item.Settings
-
Field Summary
Fields Modifier and Type Field Description private static int
ITEM_BAR_COLOR
Fields inherited from class net.minecraft.item.Item
ATTACK_DAMAGE_MODIFIER_ID, ATTACK_SPEED_MODIFIER_ID, BLOCK_ITEMS, group
-
Constructor Summary
Constructors Constructor Description BundleItem(Item.Settings settings)
-
Method Summary
Modifier and Type Method Description private static int
addToBundle(ItemStack bundle, ItemStack stack)
void
appendTooltip(ItemStack stack, World world, List<Text> tooltip, TooltipContext context)
private static boolean
dropAllBundledItems(ItemStack stack, PlayerEntity player)
static float
getAmountFilled(ItemStack stack)
private static Stream<ItemStack>
getBundledStacks(ItemStack stack)
private static int
getBundleOccupancy(ItemStack stack)
int
getItemBarColor(ItemStack stack)
int
getItemBarStep(ItemStack stack)
private static int
getItemOccupancy(ItemStack stack)
Optional<TooltipData>
getTooltipData(ItemStack stack)
boolean
isItemBarVisible(ItemStack stack)
private static Optional<CompoundTag>
method_32344(ItemStack itemStack, ListTag listTag)
private static Optional<ItemStack>
method_32759(ItemStack itemStack)
void
method_33261(ItemEntity itemEntity)
boolean
onClicked(ItemStack stack, ItemStack otherStack, Slot slot, ClickType clickType, PlayerInventory playerInventory)
boolean
onStackClicked(ItemStack stack, Slot slot, ClickType clickType, PlayerInventory playerInventory)
TypedActionResult<ItemStack>
use(World world, PlayerEntity user, Hand hand)
Called when an item is used by a player.Methods inherited from class net.minecraft.item.Item
appendStacks, asItem, byRawId, canMine, canRepair, damage, finishUsing, fromBlock, getAttributeModifiers, getDefaultStack, getDrinkSound, getEatSound, getEnchantability, getEquipSound, getFoodComponent, getGroup, getMaxCount, getMaxDamage, getMaxUseTime, getMiningSpeedMultiplier, getName, getName, getOrCreateTranslationKey, getRarity, getRawId, getRecipeRemainder, getTranslationKey, getTranslationKey, getUseAction, hasGlint, hasRecipeRemainder, hasStoredInventory, inventoryTick, isDamageable, isEnchantable, isFireproof, isFood, isIn, isNetworkSynced, isSuitableFor, isUsedOnRelease, onCraft, onStoppedUsing, postHit, postMine, postProcessTag, raycast, shouldSyncTagToClient, toString, usageTick, useOnBlock, useOnEntity
-
Field Details
-
ITEM_BAR_COLOR
private static final int ITEM_BAR_COLOR
-
-
Constructor Details
-
BundleItem
-
-
Method Details
-
getAmountFilled
-
onStackClicked
public boolean onStackClicked(ItemStack stack, Slot slot, ClickType clickType, PlayerInventory playerInventory)- Overrides:
onStackClicked
in classItem
-
onClicked
public boolean onClicked(ItemStack stack, ItemStack otherStack, Slot slot, ClickType clickType, PlayerInventory playerInventory) -
use
Called when an item is used by a player. The use action, by default, is bound to the right mouse button.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.
-
isItemBarVisible
- Overrides:
isItemBarVisible
in classItem
-
getItemBarStep
- Overrides:
getItemBarStep
in classItem
-
getItemBarColor
- Overrides:
getItemBarColor
in classItem
-
addToBundle
-
method_32344
-
getItemOccupancy
-
getBundleOccupancy
-
method_32759
-
dropAllBundledItems
-
getBundledStacks
-
getTooltipData
- Overrides:
getTooltipData
in classItem
-
appendTooltip
@Environment(CLIENT) public void appendTooltip(ItemStack stack, World world, List<Text> tooltip, TooltipContext context)- Overrides:
appendTooltip
in classItem
-
method_33261
- Overrides:
method_33261
in classItem
-