Package com.ldtteam.structurize.api.util
Class ItemStorage
java.lang.Object
com.ldtteam.structurize.api.util.ItemStorage
Used to store an stack with various informations to compare items later on.
-
Constructor Summary
ConstructorsConstructorDescriptionItemStorage(net.minecraft.network.FriendlyByteBuf buf) Reads an itemstorage from a bufferItemStorage(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 TypeMethodDescriptionbooleanintGetter for the quantity.intGetter for the damage value.net.minecraft.world.item.ItemgetItem()Getter for the stack.net.minecraft.world.item.ItemStackGet the itemStack from this itemStorage.static ItemStoragegetItemStackOfListMatchingPredicate(List<ItemStorage> list, Predicate<net.minecraft.world.item.ItemStack> predicate) Check a list for an ItemStack matching a predicate.inthashCode()booleanGetter for the ignoreDamageValue.booleanGetter for the should ignore nbt.voidserialize(net.minecraft.network.FriendlyByteBuf buf) Serialize itemstorage to buffervoidsetAmount(int amount) Setter for the quantity.
-
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.FriendlyByteBuf 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() -
equals
-
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.FriendlyByteBuf buf) Serialize itemstorage to buffer- Parameters:
buf-
-