Record Class MapDecoration

java.lang.Object
java.lang.Record
net.minecraft.world.level.saveddata.maps.MapDecoration

public record MapDecoration(MapDecoration.Type type, byte x, byte y, byte rot, @Nullable Component name, it.unimi.dsi.fastutil.ints.Int2BooleanFunction shouldRenderForIndex) extends Record
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final Component
    The field for the name record component.
    private final byte
    The field for the rot record component.
    private final it.unimi.dsi.fastutil.ints.Int2BooleanFunction
    The field for the shouldRenderForIndex record component.
    private final MapDecoration.Type
    The field for the type record component.
    private final byte
    The field for the x record component.
    private final byte
    The field for the y record component.
  • Constructor Summary

    Constructors
    Constructor
    Description
    MapDecoration(MapDecoration.Type type, byte x, byte y, byte rot, Component name)
     
    MapDecoration(MapDecoration.Type type, byte x, byte y, byte rot, Component name, it.unimi.dsi.fastutil.ints.Int2BooleanFunction shouldRenderForIndex)
    Creates an instance of a MapDecoration record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    byte
     
    final int
    Returns a hash code value for this object.
    Returns the value of the name record component.
    boolean
    render(int index)
    Renders this decoration, useful for custom sprite sheets.
    boolean
     
    byte
    rot()
    Returns the value of the rot record component.
    it.unimi.dsi.fastutil.ints.Int2BooleanFunction
    Returns the value of the shouldRenderForIndex record component.
    final String
    Returns a string representation of this record class.
    Returns the value of the type record component.
    byte
    x()
    Returns the value of the x record component.
    byte
    y()
    Returns the value of the y record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • type

      private final MapDecoration.Type type
      The field for the type record component.
    • x

      private final byte x
      The field for the x record component.
    • y

      private final byte y
      The field for the y record component.
    • rot

      private final byte rot
      The field for the rot record component.
    • name

      @Nullable private final Component name
      The field for the name record component.
    • shouldRenderForIndex

      private final it.unimi.dsi.fastutil.ints.Int2BooleanFunction shouldRenderForIndex
      The field for the shouldRenderForIndex record component.
  • Constructor Details

    • MapDecoration

      public MapDecoration(MapDecoration.Type type, byte x, byte y, byte rot, @Nullable Component name)
    • MapDecoration

      public MapDecoration(MapDecoration.Type type, byte x, byte y, byte rot, @Nullable Component name, it.unimi.dsi.fastutil.ints.Int2BooleanFunction shouldRenderForIndex)
      Creates an instance of a MapDecoration record class.
      Parameters:
      type - the value for the type record component
      x - the value for the x record component
      y - the value for the y record component
      rot - the value for the rot record component
      name - the value for the name record component
      shouldRenderForIndex - the value for the shouldRenderForIndex record component
  • Method Details

    • getImage

      public byte getImage()
    • renderOnFrame

      public boolean renderOnFrame()
    • render

      public boolean render(int index)
      Renders this decoration, useful for custom sprite sheets.
      Parameters:
      index - The index of this icon in the MapData's list. Used by vanilla to offset the Z-coordinate to prevent Z-fighting
      Returns:
      false to run vanilla logic for this decoration, true to skip it
    • 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.
    • type

      public MapDecoration.Type type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • x

      public byte x()
      Returns the value of the x record component.
      Returns:
      the value of the x record component
    • y

      public byte y()
      Returns the value of the y record component.
      Returns:
      the value of the y record component
    • rot

      public byte rot()
      Returns the value of the rot record component.
      Returns:
      the value of the rot record component
    • name

      @Nullable public Component name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • shouldRenderForIndex

      public it.unimi.dsi.fastutil.ints.Int2BooleanFunction shouldRenderForIndex()
      Returns the value of the shouldRenderForIndex record component.
      Returns:
      the value of the shouldRenderForIndex record component