Record Class SupplyData

java.lang.Object
java.lang.Record
com.minecolonies.api.items.component.SupplyData

public record SupplyData(boolean sawStory, boolean instantPlacement, long randomKey) extends Record
  • Field Details

    • EMPTY

      public static final SupplyData EMPTY
    • CODEC

      public static final com.mojang.serialization.Codec<SupplyData> CODEC
    • STREAM_CODEC

      public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,SupplyData> STREAM_CODEC
  • Constructor Details

    • SupplyData

      public SupplyData(boolean sawStory, boolean instantPlacement, long randomKey)
      Creates an instance of a SupplyData record class.
      Parameters:
      sawStory - the value for the sawStory record component
      instantPlacement - the value for the instantPlacement record component
      randomKey - the value for the randomKey record component
  • Method Details

    • withSawStory

      public SupplyData withSawStory(boolean sawStory)
    • withRandomKey

      public SupplyData withRandomKey(long randomKey)
    • hasRandomKey

      public boolean hasRandomKey()
    • writeToItemStack

      public void writeToItemStack(net.minecraft.world.item.ItemStack itemStack)
    • readFromItemStack

      public static SupplyData readFromItemStack(net.minecraft.world.item.ItemStack itemStack)
    • updateItemStack

      public static void updateItemStack(net.minecraft.world.item.ItemStack itemStack, UnaryOperator<SupplyData> updater)
    • toString

      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

      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

      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. All components in this record class 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.
    • sawStory

      public boolean sawStory()
      Returns the value of the sawStory record component.
      Returns:
      the value of the sawStory record component
    • instantPlacement

      public boolean instantPlacement()
      Returns the value of the instantPlacement record component.
      Returns:
      the value of the instantPlacement record component
    • randomKey

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