Record Class DoughData

java.lang.Object
java.lang.Record
com.petrolpark.compat.create.core.dough.DoughData

public record DoughData(IDough dough, float thickness, byte width, byte length, Neither<DoughData.Cuts,DoughData.Toppings> decoration, boolean madeByPlayer) extends Record
  • Field Details

    • MAX_WIDTH

      public static final byte MAX_WIDTH
      See Also:
    • CODEC

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

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

    • DoughData

      public DoughData(IDough dough, float thickness, byte width, byte length, Neither<DoughData.Cuts,DoughData.Toppings> decoration, boolean madeByPlayer)
      Creates an instance of a DoughData record class.
      Parameters:
      dough - the value for the dough record component
      thickness - the value for the thickness record component
      width - the value for the width record component
      length - the value for the length record component
      decoration - the value for the decoration record component
      madeByPlayer - the value for the madeByPlayer record component
  • Method Details

    • isRollable

      public boolean isRollable(boolean lengthwise)
    • rolled

      public DoughData rolled(boolean lengthwise, boolean byPlayer)
    • rolled

      public DoughData rolled(byte width, byte length, boolean byPlayer)
    • forItem

      public DoughData forItem()
      If there are Toppings, preserves them. Otherwise, turns back into a single ball to be rolled again.
    • remainingArea

      public float remainingArea()
    • withDough

      public DoughData withDough(IDough dough)
    • withThickness

      public DoughData withThickness(float thickness)
    • withNewTopping

      public DoughData withNewTopping(net.minecraft.core.Holder<IDoughTopping> topping)
    • withNewTopping

      public DoughData withNewTopping(DoughData.Toppings.Entry topping)
    • withoutTopping

      public DoughData withoutTopping(net.minecraft.core.Holder<IDoughTopping> topping)
    • madeByPlayer

      public DoughData madeByPlayer(boolean madeByPlayer)
    • get

      @Nullable public static final DoughData get(net.minecraft.world.item.ItemStack stack)
    • 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. 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.
    • dough

      public IDough dough()
      Returns the value of the dough record component.
      Returns:
      the value of the dough record component
    • thickness

      public float thickness()
      Returns the value of the thickness record component.
      Returns:
      the value of the thickness record component
    • width

      public byte width()
      Returns the value of the width record component.
      Returns:
      the value of the width record component
    • length

      public byte length()
      Returns the value of the length record component.
      Returns:
      the value of the length record component
    • decoration

      Returns the value of the decoration record component.
      Returns:
      the value of the decoration record component
    • madeByPlayer

      public boolean madeByPlayer()
      Returns the value of the madeByPlayer record component.
      Returns:
      the value of the madeByPlayer record component