Record Class MultiblockShape.Pattern

java.lang.Object
java.lang.Record
fr.robie.machineengine.api.multiblock.MultiblockShape.Pattern
All Implemented Interfaces:
MultiblockShape
Enclosing interface:
MultiblockShape

public static record MultiblockShape.Pattern(@NotNull List<List<String>> layers, @NotNull Map<Character, Set<net.kyori.adventure.key.Key>> key, char anchor, boolean rotate) extends Record implements MultiblockShape
A fixed shape, like a crafting recipe in 3D: layers from the bottom up, each a list of rows from north to south, each row a string of characters from west to east. key says which blocks each character stands for; a space is any block (not part of the structure). The character anchor must appear exactly once: that block holds the structure's storages and must be a machine. With rotate, the shape is also matched turned by 90, 180 and 270 degrees.
layers:                  # a 3x3 ring with a controller, a glass column above it
  - ["CCC", "C#C", "CCC"]
  - ["   ", " G ", "   "]
key: {C: mymod:casing, "#": mymod:controller, G: minecraft:glass}
anchor: "#"
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final record 
    One block of the shape: its offset (x east, y up, z south) and character, unturned.

    Nested classes/interfaces inherited from interface MultiblockShape

    MultiblockShape.Box, MultiblockShape.Pattern
  • Constructor Summary

    Constructors
    Constructor
    Description
    Pattern(@NotNull List<List<String>> layers, @NotNull Map<Character, Set<net.kyori.adventure.key.Key>> key, char anchor, boolean rotate)
    Creates an instance of a Pattern record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    char
    Returns the value of the anchor record component.
    @NotNull Set<net.kyori.adventure.key.Key>
    Every block that can be part of the structure itself (not its interior).
    Every block of the shape (spaces left out).
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    @NotNull Map<Character, Set<net.kyori.adventure.key.Key>>
    key()
    Returns the value of the key record component.
    @NotNull List<List<String>>
    Returns the value of the layers record component.
    boolean
    Returns the value of the rotate record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

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

    • Pattern

      public Pattern(@NotNull @NotNull List<List<String>> layers, @NotNull @NotNull Map<Character, Set<net.kyori.adventure.key.Key>> key, char anchor, boolean rotate)
      Creates an instance of a Pattern record class.
      Parameters:
      layers - the value for the layers record component
      key - the value for the key record component
      anchor - the value for the anchor record component
      rotate - the value for the rotate record component
  • Method Details

    • blocks

      @NotNull public @NotNull Set<net.kyori.adventure.key.Key> blocks()
      Description copied from interface: MultiblockShape
      Every block that can be part of the structure itself (not its interior).
      Specified by:
      blocks in interface MultiblockShape
    • cells

      @NotNull public @NotNull List<MultiblockShape.Pattern.Cell> cells()
      Every block of the shape (spaces left out).
    • 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 the compare method from their corresponding wrapper classes.
      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.
    • layers

      @NotNull public @NotNull List<List<String>> layers()
      Returns the value of the layers record component.
      Returns:
      the value of the layers record component
    • key

      @NotNull public @NotNull Map<Character, Set<net.kyori.adventure.key.Key>> key()
      Returns the value of the key record component.
      Returns:
      the value of the key record component
    • anchor

      public char anchor()
      Returns the value of the anchor record component.
      Returns:
      the value of the anchor record component
    • rotate

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