java.lang.Object
com.github.retrooper.packetevents.protocol.item.ItemStack

public class ItemStack extends Object
  • Field Details

    • EMPTY

      public static final ItemStack EMPTY
  • Method Details

    • decode

      public static ItemStack decode(NBT nbt, ClientVersion version)
    • encodeForParticle

      public static NBT encodeForParticle(ItemStack itemStack, ClientVersion version)
    • 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 damage)
    • getMaxDamage

      public int getMaxDamage()
    • getOrCreateTag

      public NBTCompound getOrCreateTag()
    • getType

      public ItemType getType()
    • getAmount

      public int getAmount()
    • shrink

      public void shrink(int amount)
    • grow

      public void grow(int amount)
    • setAmount

      public void setAmount(int amount)
    • split

      public ItemStack split(int toTake)
    • copy

      public ItemStack copy()
    • getNBT

      @Nullable public @Nullable NBTCompound getNBT()
    • setNBT

      public void setNBT(NBTCompound nbt)
    • getComponentOr

      public <T> T getComponentOr(ComponentType<T> type, T otherValue)
    • getComponent

      public <T> Optional<T> getComponent(ComponentType<T> type)
    • setComponent

      public <T> void setComponent(ComponentType<T> type, T value)
    • unsetComponent

      public <T> void unsetComponent(ComponentType<T> type)
    • setComponent

      public <T> void setComponent(ComponentType<T> type, Optional<T> value)
    • hasComponent

      public boolean hasComponent(ComponentType<?> type)
    • hasComponentPatches

      public boolean hasComponentPatches()
    • getComponents

      public PatchableComponentMap getComponents()
    • setComponents

      public void setComponents(@Nullable @Nullable PatchableComponentMap components)
      Parameters:
      components - if set null will reset to components of ItemType
    • getLegacyData

      public int getLegacyData()
    • setLegacyData

      public void setLegacyData(int legacyData)
    • isEnchantable

      public boolean isEnchantable(ClientVersion version)
    • isEnchanted

      public boolean isEnchanted(ClientVersion version)
    • getEnchantments

      public List<Enchantment> getEnchantments(ClientVersion version)
    • getEnchantmentLevel

      public int getEnchantmentLevel(EnchantmentType enchantment, ClientVersion version)
    • setEnchantments

      public void setEnchantments(List<Enchantment> enchantments, ClientVersion version)
    • getEnchantmentsTagName

      @Deprecated public String getEnchantmentsTagName(ClientVersion version)
      Deprecated.
    • canBeDepleted

      public boolean canBeDepleted()
    • is

      public boolean is(ItemType type)
    • isSameItemSameTags

      public static boolean isSameItemSameTags(ItemStack stack, ItemStack otherStack)
    • tagMatches

      public static boolean tagMatches(ItemStack left, ItemStack right)
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isEmpty

      public boolean isEmpty()
    • builder

      public static ItemStack.Builder builder()