Record Class GenericStack

java.lang.Object
java.lang.Record
appeng.api.stacks.GenericStack

public record GenericStack(AEKey what, long amount) extends Record
Represents some amount of some generic resource that AE can store or handle in crafting.
  • Field Details Link icon

    • AMOUNT_FIELD Link icon

      @Internal public static final String AMOUNT_FIELD
      See Also:
    • CODEC Link icon

      public static final com.mojang.serialization.Codec<GenericStack> CODEC
    • STREAM_CODEC Link icon

      public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,GenericStack> STREAM_CODEC
    • FAULT_TOLERANT_NULLABLE_LIST_CODEC Link icon

      public static final com.mojang.serialization.Codec<List<@Nullable GenericStack>> FAULT_TOLERANT_NULLABLE_LIST_CODEC
    • FAULT_TOLERANT_LIST_CODEC Link icon

      public static final com.mojang.serialization.Codec<List<GenericStack>> FAULT_TOLERANT_LIST_CODEC
  • Constructor Details Link icon

    • GenericStack Link icon

      public GenericStack(AEKey what, long amount)
      Creates an instance of a GenericStack record class.
      Parameters:
      what - the value for the what record component
      amount - the value for the amount record component
  • Method Details Link icon

    • readBuffer Link icon

      @Nullable public static @Nullable GenericStack readBuffer(net.minecraft.network.RegistryFriendlyByteBuf buffer)
    • writeBuffer Link icon

      public static void writeBuffer(@Nullable @Nullable GenericStack stack, net.minecraft.network.RegistryFriendlyByteBuf buffer)
    • readTag Link icon

      @Nullable public static @Nullable GenericStack readTag(net.minecraft.core.HolderLookup.Provider registries, net.minecraft.nbt.CompoundTag tag)
    • writeTag Link icon

      public static net.minecraft.nbt.CompoundTag writeTag(net.minecraft.core.HolderLookup.Provider registries, @Nullable @Nullable GenericStack stack)
    • fromItemStack Link icon

      @Nullable public static @Nullable GenericStack fromItemStack(net.minecraft.world.item.ItemStack stack)
      Converts a given item stack into a generic stack, accounting for a GenericStack already wrapped in an ItemStack, unwrapping it automatically. If the item stack is empty, null is returned.
    • fromFluidStack Link icon

      @Nullable public static @Nullable GenericStack fromFluidStack(net.neoforged.neoforge.fluids.FluidStack stack)
      Converts a given fluid stack into a generic stack. If the fluid stack is empty, null is returned.
    • getStackSizeOrZero Link icon

      public static long getStackSizeOrZero(@Nullable @Nullable GenericStack stack)
    • wrapInItemStack Link icon

      public static net.minecraft.world.item.ItemStack wrapInItemStack(@Nullable @Nullable GenericStack stack)
    • wrapInItemStack Link icon

      public static net.minecraft.world.item.ItemStack wrapInItemStack(AEKey what, long amount)
    • isWrapped Link icon

      public static boolean isWrapped(net.minecraft.world.item.ItemStack stack)
    • unwrapItemStack Link icon

      public static GenericStack unwrapItemStack(net.minecraft.world.item.ItemStack stack)
    • sum Link icon

      public static GenericStack sum(GenericStack left, GenericStack right)
    • toString Link icon

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode Link icon

      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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals Link icon

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • what Link icon

      public AEKey what()
      Returns the value of the what record component.
      Returns:
      the value of the what record component
    • amount Link icon

      public long amount()
      Returns the value of the amount record component.
      Returns:
      the value of the amount record component