public final class ItemStack extends CapabilityProvider<ItemStack> implements IForgeItemStack
修飾子とタイプ | フィールドと説明 |
---|---|
static java.text.DecimalFormat |
DECIMALFORMAT |
static ItemStack |
EMPTY |
コンストラクタと説明 |
---|
ItemStack(IItemProvider itemIn) |
ItemStack(IItemProvider itemIn,
int count) |
ItemStack(IItemProvider itemIn,
int count,
CompoundNBT capNBT) |
修飾子とタイプ | メソッドと説明 |
---|---|
void |
addAttributeModifier(java.lang.String attributeName,
AttributeModifier modifier,
EquipmentSlotType equipmentSlot) |
void |
addEnchantment(Enchantment ench,
int level)
Adds an enchantment with a desired level on the ItemStack.
|
static void |
addEnchantmentTooltips(java.util.List<ITextComponent> p_222120_0_,
ListNBT p_222120_1_) |
static boolean |
areItemsEqual(ItemStack stackA,
ItemStack stackB)
Compares Item and damage value of the two stacks
|
static boolean |
areItemsEqualIgnoreDurability(ItemStack stackA,
ItemStack stackB) |
static boolean |
areItemStacksEqual(ItemStack stackA,
ItemStack stackB)
compares ItemStack argument1 with ItemStack argument2; returns true if both ItemStacks are equal
|
static boolean |
areItemStackTagsEqual(ItemStack stackA,
ItemStack stackB) |
boolean |
attemptDamageItem(int amount,
java.util.Random rand,
ServerPlayerEntity damager)
Attempts to damage the ItemStack with par1 amount of damage, If the ItemStack has the Unbreaking enchantment there
is a chance for each point of damage to be negated.
|
boolean |
canDestroy(NetworkTagManager p_206848_1_,
CachedBlockInfo p_206848_2_) |
boolean |
canHarvestBlock(BlockState blockIn)
Check whether the given Block can be harvested using this ItemStack.
|
boolean |
canPlaceOn(NetworkTagManager p_206847_1_,
CachedBlockInfo p_206847_2_) |
void |
clearCustomName()
Clear any custom name set for this ItemStack
|
ItemStack |
copy()
Returns a new stack with the same properties.
|
<T extends LivingEntity> |
damageItem(int amount,
T entityIn,
java.util.function.Consumer<T> onBroken) |
void |
deserializeNBT(CompoundNBT nbt) |
void |
func_222121_b(World worldIn,
LivingEntity livingEntityIn,
int countIn) |
SoundEvent |
func_226629_F_() |
SoundEvent |
func_226630_G_() |
int |
getAnimationsToGo() |
com.google.common.collect.Multimap<java.lang.String,AttributeModifier> |
getAttributeModifiers(EquipmentSlotType equipmentSlot)
Gets the attribute modifiers for this ItemStack.
|
CompoundNBT |
getChildTag(java.lang.String key)
Get an NBTTagCompound from this stack's NBT data.
|
int |
getCount() |
int |
getDamage() |
float |
getDestroySpeed(BlockState blockIn) |
ITextComponent |
getDisplayName() |
ListNBT |
getEnchantmentTagList() |
Item |
getItem()
Returns the object corresponding to the stack.
|
ItemFrameEntity |
getItemFrame()
Return the item frame this stack is on.
|
int |
getMaxDamage()
Returns the max damage an item in the stack can take.
|
int |
getMaxStackSize()
Returns maximum size of the stack.
|
CompoundNBT |
getOrCreateChildTag(java.lang.String key) |
CompoundNBT |
getOrCreateTag() |
Rarity |
getRarity() |
int |
getRepairCost()
Get this stack's repair cost, or 0 if no repair cost is defined.
|
CompoundNBT |
getTag() |
ITextComponent |
getTextComponent()
Get a ChatComponent for this Item's display name that shows this Item on hover
|
java.util.List<ITextComponent> |
getTooltip(PlayerEntity playerIn,
ITooltipFlag advanced)
Return a list of strings containing information about the item
|
java.lang.String |
getTranslationKey() |
UseAction |
getUseAction() |
int |
getUseDuration() |
void |
grow(int count) |
boolean |
hasDisplayName()
Returns true if the itemstack has a display name
|
boolean |
hasEffect() |
boolean |
hasTag()
Returns true if the ItemStack has an NBTTagCompound.
|
void |
hitEntity(LivingEntity entityIn,
PlayerEntity playerIn)
Calls the delegated method to the Item to damage the incoming Entity, and if necessary, triggers a stats increase.
|
boolean |
interactWithEntity(PlayerEntity playerIn,
LivingEntity entityIn,
Hand hand) |
void |
inventoryTick(World worldIn,
Entity entityIn,
int inventorySlot,
boolean isCurrentItem)
Called each tick as long the ItemStack in on player inventory.
|
boolean |
isCrossbowStack() |
boolean |
isDamageable()
true if this itemStack is damageable
|
boolean |
isDamaged()
returns true when a damageable item is damaged
|
boolean |
isEmpty() |
boolean |
isEnchantable()
True if it is a tool and has no enchantments to begin with
|
boolean |
isEnchanted()
True if the item has enchantment data
|
boolean |
isFood() |
boolean |
isItemEqual(ItemStack other)
compares ItemStack argument to the instance ItemStack; returns true if the Items contained in both ItemStacks are
equal
|
boolean |
isItemEqualIgnoreDurability(ItemStack stack) |
boolean |
isOnItemFrame()
Return whether this stack is on an item frame.
|
boolean |
isStackable()
Returns true if the ItemStack can hold 2 or more units of the item.
|
void |
onBlockDestroyed(World worldIn,
BlockState blockIn,
BlockPos pos,
PlayerEntity playerIn)
Called when a Block is destroyed using this ItemStack
|
void |
onCrafting(World worldIn,
PlayerEntity playerIn,
int amount) |
ActionResultType |
onItemUse(ItemUseContext context) |
ItemStack |
onItemUseFinish(World worldIn,
LivingEntity entityLiving)
Called when the item in use count reach 0, e.g. item food eaten.
|
ActionResultType |
onItemUseFirst(ItemUseContext context) |
void |
onPlayerStoppedUsing(World worldIn,
LivingEntity entityLiving,
int timeLeft)
Called when the player releases the use item button.
|
static ItemStack |
read(CompoundNBT compound) |
void |
removeChildTag(java.lang.String p_196083_1_) |
void |
setAnimationsToGo(int animations) |
void |
setCount(int count) |
void |
setDamage(int damage) |
ItemStack |
setDisplayName(ITextComponent name) |
void |
setItemFrame(ItemFrameEntity frame)
Set the item frame this stack is on.
|
void |
setRepairCost(int cost)
Set this stack's repair cost.
|
void |
setTag(CompoundNBT nbt)
Assigns a NBTTagCompound to the ItemStack, minecraft validates that only non-stackable items can have it.
|
void |
setTagInfo(java.lang.String key,
INBT value) |
void |
shrink(int count) |
ItemStack |
split(int amount)
Splits off a stack of the given amount of this stack and reduces this stack by the amount.
|
java.lang.String |
toString() |
ActionResult<ItemStack> |
useItemRightClick(World worldIn,
PlayerEntity playerIn,
Hand hand)
Called whenr the item stack is equipped and right clicked.
|
CompoundNBT |
write(CompoundNBT nbt)
Write the stack fields to a NBT object.
|
areCapsCompatible, areCapsCompatible, deserializeCaps, gatherCapabilities, gatherCapabilities, getCapabilities, getCapability, invalidateCaps, reviveCaps, serializeCaps
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
areShareTagsEqual, canApplyAtEnchantingTable, canDisableShield, canEquip, doesSneakBypassUse, equals, getBurnTime, getContainerItem, getEntityLifespan, getEquipmentSlot, getHarvestLevel, getHighlightTip, getItemEnchantability, getShareTag, getStack, getToolTypes, getXpRepairRatio, hasContainerItem, isBeaconPayment, isBookEnchantable, isRepairable, isShield, onArmorTick, onBlockStartBreak, onDroppedByPlayer, onEntityItemUpdate, onEntitySwing, onHorseArmorTick, onUsingTick, readShareTag, serializeNBT, shouldCauseBlockBreakReset
getCapability, getCapability
public static final ItemStack EMPTY
public static final java.text.DecimalFormat DECIMALFORMAT
public ItemStack(IItemProvider itemIn)
public ItemStack(IItemProvider itemIn, int count)
public ItemStack(IItemProvider itemIn, int count, @Nullable CompoundNBT capNBT)
public static ItemStack read(CompoundNBT compound)
public boolean isEmpty()
public ItemStack split(int amount)
public Item getItem()
public ActionResultType onItemUse(ItemUseContext context)
public ActionResultType onItemUseFirst(ItemUseContext context)
onItemUseFirst
インタフェース内 IForgeItemStack
public float getDestroySpeed(BlockState blockIn)
public ActionResult<ItemStack> useItemRightClick(World worldIn, PlayerEntity playerIn, Hand hand)
public ItemStack onItemUseFinish(World worldIn, LivingEntity entityLiving)
public CompoundNBT write(CompoundNBT nbt)
public int getMaxStackSize()
public boolean isStackable()
public boolean isDamageable()
public boolean isDamaged()
public int getDamage()
public void setDamage(int damage)
public int getMaxDamage()
public boolean attemptDamageItem(int amount, java.util.Random rand, @Nullable ServerPlayerEntity damager)
public <T extends LivingEntity> void damageItem(int amount, T entityIn, java.util.function.Consumer<T> onBroken)
public void hitEntity(LivingEntity entityIn, PlayerEntity playerIn)
public void onBlockDestroyed(World worldIn, BlockState blockIn, BlockPos pos, PlayerEntity playerIn)
public boolean canHarvestBlock(BlockState blockIn)
public boolean interactWithEntity(PlayerEntity playerIn, LivingEntity entityIn, Hand hand)
public ItemStack copy()
public static boolean areItemStackTagsEqual(ItemStack stackA, ItemStack stackB)
public static boolean areItemStacksEqual(ItemStack stackA, ItemStack stackB)
public static boolean areItemsEqual(ItemStack stackA, ItemStack stackB)
public static boolean areItemsEqualIgnoreDurability(ItemStack stackA, ItemStack stackB)
public boolean isItemEqual(ItemStack other)
public boolean isItemEqualIgnoreDurability(ItemStack stack)
public java.lang.String getTranslationKey()
public java.lang.String toString()
toString
クラス内 java.lang.Object
public void inventoryTick(World worldIn, Entity entityIn, int inventorySlot, boolean isCurrentItem)
public void onCrafting(World worldIn, PlayerEntity playerIn, int amount)
public int getUseDuration()
public UseAction getUseAction()
public void onPlayerStoppedUsing(World worldIn, LivingEntity entityLiving, int timeLeft)
public boolean isCrossbowStack()
public boolean hasTag()
@Nullable public CompoundNBT getTag()
public CompoundNBT getOrCreateTag()
public CompoundNBT getOrCreateChildTag(java.lang.String key)
@Nullable public CompoundNBT getChildTag(java.lang.String key)
public void removeChildTag(java.lang.String p_196083_1_)
public ListNBT getEnchantmentTagList()
public void setTag(@Nullable CompoundNBT nbt)
public ITextComponent getDisplayName()
public ItemStack setDisplayName(@Nullable ITextComponent name)
public void clearCustomName()
public boolean hasDisplayName()
public java.util.List<ITextComponent> getTooltip(@Nullable PlayerEntity playerIn, ITooltipFlag advanced)
public static void addEnchantmentTooltips(java.util.List<ITextComponent> p_222120_0_, ListNBT p_222120_1_)
public boolean hasEffect()
public Rarity getRarity()
public boolean isEnchantable()
public void addEnchantment(Enchantment ench, int level)
public boolean isEnchanted()
public void setTagInfo(java.lang.String key, INBT value)
public boolean isOnItemFrame()
public void setItemFrame(@Nullable ItemFrameEntity frame)
@Nullable public ItemFrameEntity getItemFrame()
public int getRepairCost()
public void setRepairCost(int cost)
public com.google.common.collect.Multimap<java.lang.String,AttributeModifier> getAttributeModifiers(EquipmentSlotType equipmentSlot)
public void addAttributeModifier(java.lang.String attributeName, AttributeModifier modifier, @Nullable EquipmentSlotType equipmentSlot)
public ITextComponent getTextComponent()
public boolean canDestroy(NetworkTagManager p_206848_1_, CachedBlockInfo p_206848_2_)
public boolean canPlaceOn(NetworkTagManager p_206847_1_, CachedBlockInfo p_206847_2_)
public int getAnimationsToGo()
public void setAnimationsToGo(int animations)
public int getCount()
public void setCount(int count)
public void grow(int count)
public void shrink(int count)
public void func_222121_b(World worldIn, LivingEntity livingEntityIn, int countIn)
public boolean isFood()
public void deserializeNBT(CompoundNBT nbt)
deserializeNBT
インタフェース内 INBTSerializable<CompoundNBT>
public SoundEvent func_226629_F_()
public SoundEvent func_226630_G_()