Class ItemStorage

java.lang.Object
com.ldtteam.structurize.api.ItemStorage

public class ItemStorage extends Object
Used to store an stack with various informations to compare items later on.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ItemStorage(net.minecraft.network.RegistryFriendlyByteBuf buf)
    Reads an itemstorage from a buffer
    ItemStorage(net.minecraft.world.item.ItemStack stack)
    Creates an instance of the storage.
    ItemStorage(net.minecraft.world.item.ItemStack stack, boolean ignoreDamageValue)
    Creates an instance of the storage.
    ItemStorage(net.minecraft.world.item.ItemStack stack, boolean ignoreDamageValue, boolean shouldIgnoreNBTValue)
    Creates an instance of the storage.
    ItemStorage(net.minecraft.world.item.ItemStack stack, int amount, boolean ignoreDamageValue, boolean shouldIgnoreNBTValue)
    Creates an instance of the storage.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addAmount(int amount)
    Adder for the quantity.
    boolean
     
    int
    Getter for the quantity.
    int
    Getter for the damage value.
    net.minecraft.world.item.Item
    Getter for the stack.
    net.minecraft.world.item.ItemStack
    Get the itemStack from this itemStorage.
    getItemStackOfListMatchingPredicate(List<ItemStorage> list, Predicate<net.minecraft.world.item.ItemStack> predicate)
    Check a list for an ItemStack matching a predicate.
    int
     
    boolean
    Getter for the ignoreDamageValue.
    boolean
    Getter for the should ignore nbt.
    void
    serialize(net.minecraft.network.RegistryFriendlyByteBuf buf)
    Serialize itemstorage to buffer
    void
    setAmount(int amount)
    Setter for the quantity.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ItemStorage

      public ItemStorage(net.minecraft.world.item.ItemStack stack, int amount, boolean ignoreDamageValue, boolean shouldIgnoreNBTValue)
      Creates an instance of the storage.
      Parameters:
      stack - the stack.
      amount - the amount.
      ignoreDamageValue - should the damage value be ignored?
    • ItemStorage

      public ItemStorage(net.minecraft.world.item.ItemStack stack, boolean ignoreDamageValue, boolean shouldIgnoreNBTValue)
      Creates an instance of the storage.
      Parameters:
      stack - the stack.
      ignoreDamageValue - should the damage value be ignored?
      shouldIgnoreNBTValue - should the nbt value be ignored?
    • ItemStorage

      public ItemStorage(net.minecraft.world.item.ItemStack stack, boolean ignoreDamageValue)
      Creates an instance of the storage.
      Parameters:
      stack - the stack.
      ignoreDamageValue - should the damage value be ignored?
    • ItemStorage

      public ItemStorage(net.minecraft.world.item.ItemStack stack)
      Creates an instance of the storage.
      Parameters:
      stack - the stack.
    • ItemStorage

      public ItemStorage(net.minecraft.network.RegistryFriendlyByteBuf buf)
      Reads an itemstorage from a buffer
      Parameters:
      buf -
  • Method Details

    • getItemStackOfListMatchingPredicate

      public static ItemStorage getItemStackOfListMatchingPredicate(List<ItemStorage> list, Predicate<net.minecraft.world.item.ItemStack> predicate)
      Check a list for an ItemStack matching a predicate.
      Parameters:
      list - the list to check.
      predicate - the predicate to test.
      Returns:
      the matching stack or null if not found.
    • getItemStack

      public net.minecraft.world.item.ItemStack getItemStack()
      Get the itemStack from this itemStorage.
      Returns:
      the stack.
    • getAmount

      public int getAmount()
      Getter for the quantity.
      Returns:
      the amount.
    • setAmount

      public void setAmount(int amount)
      Setter for the quantity.
      Parameters:
      amount - the amount.
    • ignoreDamageValue

      public boolean ignoreDamageValue()
      Getter for the ignoreDamageValue.
      Returns:
      true if should ignore.
    • ignoreNBTValue

      public boolean ignoreNBTValue()
      Getter for the should ignore nbt.
      Returns:
      true if should ignore.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • getItem

      public net.minecraft.world.item.Item getItem()
      Getter for the stack.
      Returns:
      the stack.
    • getDamageValue

      public int getDamageValue()
      Getter for the damage value.
      Returns:
      the damage value.
    • serialize

      public void serialize(net.minecraft.network.RegistryFriendlyByteBuf buf)
      Serialize itemstorage to buffer
      Parameters:
      buf -
    • addAmount

      public void addAmount(int amount)
      Adder for the quantity.
      Parameters:
      amount - the amount to be added.