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 ClassesModifier and TypeClassDescriptionstatic final recordOne 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 -
Method Summary
Modifier and TypeMethodDescriptioncharanchor()Returns the value of theanchorrecord component.@NotNull Set<net.kyori.adventure.key.Key> blocks()Every block that can be part of the structure itself (not its interior).@NotNull List<MultiblockShape.Pattern.Cell> cells()Every block of the shape (spaces left out).final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.key()Returns the value of thekeyrecord component.layers()Returns the value of thelayersrecord component.booleanrotate()Returns the value of therotaterecord component.final StringtoString()Returns a string representation of this record class.
-
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 aPatternrecord class.- Parameters:
layers- the value for thelayersrecord componentkey- the value for thekeyrecord componentanchor- the value for theanchorrecord componentrotate- the value for therotaterecord component
-
-
Method Details
-
blocks
Description copied from interface:MultiblockShapeEvery block that can be part of the structure itself (not its interior).- Specified by:
blocksin interfaceMultiblockShape
-
cells
Every block of the shape (spaces left out). -
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
layers
-
key
-
anchor
public char anchor()Returns the value of theanchorrecord component.- Returns:
- the value of the
anchorrecord component
-
rotate
public boolean rotate()Returns the value of therotaterecord component.- Returns:
- the value of the
rotaterecord component
-