Package net.minecraft.world.item
Class ItemStack
java.lang.Object
net.minecraftforge.common.capabilities.CapabilityProvider<ItemStack>
net.minecraft.world.item.ItemStack
- All Implemented Interfaces:
ICapabilityProvider
,ICapabilityProviderImpl<ItemStack>
,ICapabilitySerializable<CompoundTag>
,IForgeItemStack
,INBTSerializable<CompoundTag>
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraftforge.common.capabilities.CapabilityProvider
CapabilityProvider.AsField<B extends ICapabilityProviderImpl<B>>
-
Field Summary
Modifier and TypeFieldDescriptionprivate AdventureModeCheck
private AdventureModeCheck
static final DecimalFormat
private CompoundTag
static final com.mojang.serialization.Codec<ItemStack>
private int
private final Holder.Reference<Item>
private static final Component
private static final int
static final ItemStack
private boolean
private Entity
private final Item
Deprecated.private static final org.slf4j.Logger
private static final Style
private int
private CompoundTag
private static final String
private static final String
static final String
static final String
static final String
static final String
static final String
private static final String
static final String
private static final String
private static final String
-
Constructor Summary
ModifierConstructorDescriptionprivate
ItemStack
(CompoundTag p_41608_) private
ItemStack
(ItemLike p_41604_, int p_41605_, Optional<CompoundTag> p_41606_) ItemStack
(ItemLike p_41604_, int p_41605_, CompoundTag p_41606_) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAttributeModifier
(Attribute p_41644_, AttributeModifier p_41645_, EquipmentSlot p_41646_) void
addTagElement
(String p_41701_, Tag p_41702_) static void
appendEnchantmentNames
(List<Component> p_41710_, ListTag p_41711_) copy()
copyWithCount
(int p_256354_) void
void
enchant
(Enchantment p_41664_, int p_41665_) private static Collection<Component>
expandBlockState
(String p_41762_) finishUsingItem
(Level p_41672_, LivingEntity p_41673_) private void
Set up forge's ItemStack additions.com.google.common.collect.Multimap<Attribute,
AttributeModifier> getAttributeModifiers
(EquipmentSlot p_41639_) int
int
int
int
getCount()
int
float
getDestroySpeed
(BlockState p_41692_) getFrame()
private int
getItem()
int
int
getOrCreateTagElement
(String p_41699_) int
getTag()
getTagElement
(String p_41738_) getTags()
getTooltipLines
(Player p_41652_, TooltipFlag p_41653_) int
void
grow
(int p_41770_) boolean
hasAdventureModeBreakTagForBlock
(Registry<Block> p_204129_, BlockInWorld p_204130_) boolean
hasAdventureModePlaceTagForBlock
(Registry<Block> p_204122_, BlockInWorld p_204123_) boolean
boolean
hasFoil()
boolean
hasTag()
void
hideTooltipPart
(ItemStack.TooltipPart p_41655_) boolean
hurt
(int p_220158_, RandomSource p_220159_, ServerPlayer p_220160_) <T extends LivingEntity>
voidhurtAndBreak
(int p_41623_, T p_41624_, Consumer<T> p_41625_) void
hurtEnemy
(LivingEntity p_41641_, Player p_41642_) interactLivingEntity
(Player p_41648_, LivingEntity p_41649_, InteractionHand p_41650_) void
inventoryTick
(Level p_41667_, Entity p_41668_, int p_41669_, boolean p_41670_) boolean
boolean
boolean
boolean
boolean
boolean
isCorrectToolForDrops
(BlockState p_41736_) boolean
boolean
boolean
isEdible()
boolean
isEmpty()
boolean
boolean
boolean
isFramed()
boolean
isItemEnabled
(FeatureFlagSet p_250869_) static boolean
static boolean
isSameItemSameTags
(ItemStack p_150943_, ItemStack p_150944_) boolean
private boolean
static boolean
void
mineBlock
(Level p_41687_, BlockState p_41688_, BlockPos p_41689_, Player p_41690_) static ItemStack
of
(CompoundTag p_41713_) void
onCraftedBy
(Level p_41679_, Player p_41680_, int p_41681_) void
onDestroyed
(ItemEntity p_150925_) Deprecated.private InteractionResult
onItemUse
(UseOnContext p_41662_, Function<UseOnContext, InteractionResult> callback) onItemUseFirst
(UseOnContext p_41662_) void
onUseTick
(Level p_41732_, LivingEntity p_41733_, int p_41734_) boolean
overrideOtherStackedOnMe
(ItemStack p_150933_, Slot p_150934_, ClickAction p_150935_, Player p_150936_, SlotAccess p_150937_) boolean
overrideStackedOnOther
(Slot p_150927_, ClickAction p_150928_, Player p_150929_) void
releaseUsing
(Level p_41675_, LivingEntity p_41676_, int p_41677_) void
removeTagKey
(String p_41750_) void
boolean
save
(CompoundTag p_41740_) void
setCount
(int p_41765_) void
setDamageValue
(int p_41722_) void
setEntityRepresentation
(Entity p_41637_) setHoverName
(Component p_41715_) void
setPopTime
(int p_41755_) void
setRepairCost
(int p_41743_) void
setTag
(CompoundTag p_41752_) private static boolean
shouldShowInTooltip
(int p_41627_, ItemStack.TooltipPart p_41628_) void
shrink
(int p_41775_) split
(int p_41621_) static boolean
tagMatches
(ItemStack p_41659_, ItemStack p_41660_) toString()
private void
use
(Level p_41683_, Player p_41684_, InteractionHand p_41685_) useOn
(UseOnContext p_41662_) boolean
Methods inherited from class net.minecraftforge.common.capabilities.CapabilityProvider
areCapsCompatible, areCapsCompatible, deserializeCaps, gatherCapabilities, gatherCapabilities, gatherCapabilities, getCapabilities, getCapability, invalidateCaps, reviveCaps, serializeCaps
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraftforge.common.capabilities.ICapabilityProvider
getCapability, getCapability
Methods inherited from interface net.minecraftforge.common.extensions.IForgeItemStack
areShareTagsEqual, canApplyAtEnchantingTable, canDisableShield, canElytraFly, canEquip, canGrindstoneRepair, canPerformAction, canWalkOnPowderedSnow, doesSneakBypassUse, elytraFlightTick, equals, getAllEnchantments, getBurnTime, getCraftingRemainingItem, getEnchantmentLevel, getEnchantmentValue, getEntityLifespan, getEquipmentSlot, getFoodProperties, getHighlightTip, getShareTag, getSweepHitBox, getXpRepairRatio, hasCraftingRemainingItem, isBookEnchantable, isEnderMask, isNotReplaceableByPickAction, isPiglinCurrency, isRepairable, makesPiglinsNeutral, onArmorTick, onBlockStartBreak, onDestroyed, onDroppedByPlayer, onEntityItemUpdate, onEntitySwing, onHorseArmorTick, onStopUsing, onUsingTick, readShareTag, serializeNBT, shouldCauseBlockBreakReset
-
Field Details
-
CODEC
-
delegate
-
capNBT
-
LOGGER
private static final org.slf4j.Logger LOGGER -
EMPTY
-
ATTRIBUTE_MODIFIER_FORMAT
-
TAG_ENCH
- See Also:
-
TAG_DISPLAY
- See Also:
-
TAG_DISPLAY_NAME
- See Also:
-
TAG_LORE
- See Also:
-
TAG_DAMAGE
- See Also:
-
TAG_COLOR
- See Also:
-
TAG_UNBREAKABLE
- See Also:
-
TAG_REPAIR_COST
- See Also:
-
TAG_CAN_DESTROY_BLOCK_LIST
- See Also:
-
TAG_CAN_PLACE_ON_BLOCK_LIST
- See Also:
-
TAG_HIDE_FLAGS
- See Also:
-
DISABLED_ITEM_TOOLTIP
-
DONT_HIDE_TOOLTIP
private static final int DONT_HIDE_TOOLTIP- See Also:
-
LORE_STYLE
-
count
private int count -
popTime
private int popTime -
item
Deprecated. -
tag
-
emptyCacheFlag
private boolean emptyCacheFlag -
entityRepresentation
-
adventureBreakCheck
-
adventurePlaceCheck
-
-
Constructor Details
-
ItemStack
-
ItemStack
-
ItemStack
-
ItemStack
-
ItemStack
-
ItemStack
-
ItemStack
-
-
Method Details
-
getTooltipImage
-
updateEmptyCacheFlag
private void updateEmptyCacheFlag() -
of
-
isEmpty
public boolean isEmpty() -
isItemEnabled
-
split
-
getItem
-
getItemHolder
-
is
-
is
-
is
-
is
-
getTags
-
useOn
-
onItemUseFirst
- Specified by:
onItemUseFirst
in interfaceIForgeItemStack
-
onItemUse
private InteractionResult onItemUse(UseOnContext p_41662_, Function<UseOnContext, InteractionResult> callback) -
getDestroySpeed
-
use
public InteractionResultHolder<ItemStack> use(Level p_41683_, Player p_41684_, InteractionHand p_41685_) -
finishUsingItem
-
save
-
getMaxStackSize
public int getMaxStackSize() -
isStackable
public boolean isStackable() -
isDamageableItem
public boolean isDamageableItem() -
isDamaged
public boolean isDamaged() -
getDamageValue
public int getDamageValue() -
setDamageValue
public void setDamageValue(int p_41722_) -
getMaxDamage
public int getMaxDamage() -
hurt
-
hurtAndBreak
-
isBarVisible
public boolean isBarVisible() -
getBarWidth
public int getBarWidth() -
getBarColor
public int getBarColor() -
overrideStackedOnOther
-
overrideOtherStackedOnMe
public boolean overrideOtherStackedOnMe(ItemStack p_150933_, Slot p_150934_, ClickAction p_150935_, Player p_150936_, SlotAccess p_150937_) -
hurtEnemy
-
mineBlock
-
isCorrectToolForDrops
-
interactLivingEntity
public InteractionResult interactLivingEntity(Player p_41648_, LivingEntity p_41649_, InteractionHand p_41650_) -
copy
-
copyWithCount
-
tagMatches
-
matches
-
matches
-
isSame
-
sameItem
-
isSameItemSameTags
-
getDescriptionId
-
toString
-
inventoryTick
-
onCraftedBy
-
getUseDuration
public int getUseDuration() -
getUseAnimation
-
releaseUsing
-
useOnRelease
public boolean useOnRelease() -
hasTag
public boolean hasTag() -
getTag
-
getOrCreateTag
-
getOrCreateTagElement
-
getTagElement
-
removeTagKey
-
getEnchantmentTags
-
setTag
-
getHoverName
-
setHoverName
-
resetHoverName
public void resetHoverName() -
hasCustomHoverName
public boolean hasCustomHoverName() -
getTooltipLines
-
shouldShowInTooltip
-
getHideFlags
private int getHideFlags() -
hideTooltipPart
-
appendEnchantmentNames
-
expandBlockState
-
hasFoil
public boolean hasFoil() -
getRarity
-
isEnchantable
public boolean isEnchantable() -
enchant
-
isEnchanted
public boolean isEnchanted() -
addTagElement
-
isFramed
public boolean isFramed() -
setEntityRepresentation
-
getFrame
-
getEntityRepresentation
-
getBaseRepairCost
public int getBaseRepairCost() -
setRepairCost
public void setRepairCost(int p_41743_) -
getAttributeModifiers
public com.google.common.collect.Multimap<Attribute,AttributeModifier> getAttributeModifiers(EquipmentSlot p_41639_) -
addAttributeModifier
public void addAttributeModifier(Attribute p_41644_, AttributeModifier p_41645_, @Nullable EquipmentSlot p_41646_) -
getDisplayName
-
hasAdventureModePlaceTagForBlock
-
hasAdventureModeBreakTagForBlock
-
getPopTime
public int getPopTime() -
setPopTime
public void setPopTime(int p_41755_) -
getCount
public int getCount() -
setCount
public void setCount(int p_41765_) -
grow
public void grow(int p_41770_) -
shrink
public void shrink(int p_41775_) -
onUseTick
-
onDestroyed
Deprecated. -
isEdible
public boolean isEdible() -
deserializeNBT
- Specified by:
deserializeNBT
in interfaceINBTSerializable<CompoundTag>
-
forgeInit
private void forgeInit()Set up forge's ItemStack additions. -
getDrinkingSound
-
getEatingSound
-
Use damage source sensitive version