Package appeng.api.stacks
Record Class GenericStack
java.lang.Object
java.lang.Record
appeng.api.stacks.GenericStack
Represents some amount of some generic resource that AE can store or handle in crafting.
-
Constructor Summary
ConstructorsConstructorDescriptionGenericStack(AEKey what, long amount) Creates an instance of aGenericStackrecord class. -
Method Summary
Modifier and TypeMethodDescriptionlongamount()Returns the value of theamountrecord component.final booleanIndicates whether some other object is "equal to" this one.static GenericStackfromItemStack(net.minecraft.world.item.ItemStack stack) Converts a given item stack into a generic stack, accounting for aGenericStackalready wrapped in anItemStack, unwrapping it automatically.static longgetStackSizeOrZero(GenericStack stack) final inthashCode()Returns a hash code value for this object.static booleanisWrapped(net.minecraft.world.item.ItemStack stack) static GenericStackreadBuffer(net.minecraft.network.FriendlyByteBuf buffer) static GenericStackreadTag(net.minecraft.nbt.CompoundTag tag) static GenericStacksum(GenericStack left, GenericStack right) final StringtoString()Returns a string representation of this record class.static GenericStackunwrapItemStack(net.minecraft.world.item.ItemStack stack) what()Returns the value of thewhatrecord component.static net.minecraft.world.item.ItemStackwrapInItemStack(AEKey what, long amount) static net.minecraft.world.item.ItemStackwrapInItemStack(GenericStack stack) static voidwriteBuffer(GenericStack stack, net.minecraft.network.FriendlyByteBuf buffer) static net.minecraft.nbt.CompoundTagwriteTag(GenericStack stack)
-
Constructor Details
-
GenericStack
Creates an instance of aGenericStackrecord class.- Parameters:
what- the value for thewhatrecord componentamount- the value for theamountrecord component
-
-
Method Details
-
readBuffer
-
writeBuffer
public static void writeBuffer(@Nullable GenericStack stack, net.minecraft.network.FriendlyByteBuf buffer) -
readTag
-
writeTag
-
fromItemStack
Converts a given item stack into a generic stack, accounting for aGenericStackalready wrapped in anItemStack, unwrapping it automatically. If the item stack is empty, null is returned. -
getStackSizeOrZero
-
wrapInItemStack
-
wrapInItemStack
-
isWrapped
public static boolean isWrapped(net.minecraft.world.item.ItemStack stack) -
unwrapItemStack
-
sum
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
what
Returns the value of thewhatrecord component.- Returns:
- the value of the
whatrecord component
-
amount
public long amount()Returns the value of theamountrecord component.- Returns:
- the value of the
amountrecord component
-