public class BundleItem extends Item
Item.Settings| Modifier and Type | Field and Description |
|---|---|
private static int |
ITEM_BAR_COLOR |
ATTACK_DAMAGE_MODIFIER_ID, ATTACK_SPEED_MODIFIER_ID, BLOCK_ITEMS, group| Constructor and Description |
|---|
BundleItem(Item.Settings settings) |
| Modifier and Type | Method and Description |
|---|---|
private static void |
addToBundle(ItemStack bundle,
ItemStack stack) |
void |
appendTooltip(ItemStack stack,
World world,
List<Text> tooltip,
TooltipContext context) |
private static void |
emptyBundle(ItemStack itemStack,
PlayerInventory playerInventory) |
static float |
getAmountFilled(ItemStack itemStack) |
private static int |
getBundleOccupancy(ItemStack itemStack) |
int |
getItemBarColor(ItemStack itemStack) |
int |
getItemBarStep(ItemStack itemStack) |
private static int |
getItemOccupancy(ItemStack itemStack) |
boolean |
isItemBarVisible(ItemStack itemStack) |
boolean |
onClicked(ItemStack itemStack,
ItemStack itemStack2,
ClickType clickType,
PlayerInventory playerInventory) |
boolean |
onStackClicked(ItemStack itemStack,
ItemStack itemStack2,
ClickType clickType,
PlayerInventory playerInventory) |
TypedActionResult<ItemStack> |
use(World world,
PlayerEntity user,
Hand hand)
Called when an item is used by a player.
|
appendStacks, asItem, byRawId, canMine, canRepair, damage, finishUsing, fromBlock, getAttributeModifiers, getDefaultStack, getDrinkSound, getEatSound, getEnchantability, getFoodComponent, getGroup, getMaxCount, getMaxDamage, getMaxUseTime, getMiningSpeedMultiplier, getName, getName, getOrCreateTranslationKey, getRarity, getRawId, getRecipeRemainder, getTranslationKey, getTranslationKey, getUseAction, hasGlint, hasRecipeRemainder, hasStoredInventory, inventoryTick, isDamageable, isEffectiveOn, isEnchantable, isFireproof, isFood, isIn, isNetworkSynced, isUsedOnRelease, method_31570, onCraft, onStoppedUsing, postHit, postMine, postProcessTag, raycast, shouldSyncTagToClient, toString, usageTick, useOnBlock, useOnEntitypublic BundleItem(Item.Settings settings)
@Environment(value=CLIENT) public static float getAmountFilled(ItemStack itemStack)
public boolean onStackClicked(ItemStack itemStack, ItemStack itemStack2, ClickType clickType, PlayerInventory playerInventory)
onStackClicked in class Itempublic boolean onClicked(ItemStack itemStack, ItemStack itemStack2, ClickType clickType, PlayerInventory playerInventory)
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand)
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().
use in class Itemworld - the world the item was used inuser - the player who used the itemhand - the hand used@Environment(value=CLIENT) public boolean isItemBarVisible(ItemStack itemStack)
isItemBarVisible in class Item@Environment(value=CLIENT) public int getItemBarStep(ItemStack itemStack)
getItemBarStep in class Item@Environment(value=CLIENT) public int getItemBarColor(ItemStack itemStack)
getItemBarColor in class Itemprivate static int getItemOccupancy(ItemStack itemStack)
private static int getBundleOccupancy(ItemStack itemStack)
private static void emptyBundle(ItemStack itemStack, PlayerInventory playerInventory)
@Environment(value=CLIENT) public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> tooltip, TooltipContext context)
appendTooltip in class Item