Record Class MultiblockStructure

java.lang.Object
java.lang.Record
fr.robie.machineengine.api.multiblock.MultiblockStructure
Record Components:
min - the lowest corner of its bounding box (walls included)
max - the highest corner of its bounding box
members - the blocks that make it, for a MultiblockShape.Pattern; null for a box, which is made of its whole bounding box
rotation - quarter turns clockwise (seen from above) a pattern was matched with; 0 for a box
counts - for a box, what its interior holds, by block id; for a pattern, its blocks, by block id
anchor - the block holding its storages: a box's lowest corner, a pattern's anchor character

public record MultiblockStructure(@NotNull MultiblockType type, @NotNull net.kyori.adventure.key.Key world, @NotNull BlockPosition min, @NotNull BlockPosition max, @NotNull BlockPosition anchorPosition, @Nullable Set<BlockPosition> members, int rotation, @NotNull Map<net.kyori.adventure.key.Key, Integer> counts) extends Record
A formed multiblock (D33).
  • Constructor Details

    • MultiblockStructure

      public MultiblockStructure(@NotNull @NotNull MultiblockType type, @NotNull @NotNull net.kyori.adventure.key.Key world, @NotNull @NotNull BlockPosition min, @NotNull @NotNull BlockPosition max, @NotNull @NotNull BlockPosition anchorPosition, @Nullable @Nullable Set<BlockPosition> members, int rotation, @NotNull @NotNull Map<net.kyori.adventure.key.Key, Integer> counts)
      Creates an instance of a MultiblockStructure record class.
      Parameters:
      type - the value for the type record component
      world - the value for the world record component
      min - the value for the min record component
      max - the value for the max record component
      anchorPosition - the value for the anchorPosition record component
      members - the value for the members record component
      rotation - the value for the rotation record component
      counts - the value for the counts record component
  • Method Details

    • anchor

      @NotNull public @NotNull WorldPosition anchor()
    • contains

      public boolean contains(@NotNull @NotNull WorldPosition position)
      Whether position is part of the structure (for a box: anywhere in it, interior included).
    • overlaps

      public boolean overlaps(@NotNull @NotNull MultiblockStructure other)
      Whether it shares a block with other.
    • volume

      public int volume()
      A box's interior volume in blocks; for a pattern, its number of blocks.
    • height

      public int height()
      Outer height in blocks.
    • count

      public int count(@NotNull @NotNull net.kyori.adventure.key.Key block)
      How many block it counts (counts).
    • 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.
    • type

      @NotNull public @NotNull MultiblockType type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • world

      @NotNull public @NotNull net.kyori.adventure.key.Key world()
      Returns the value of the world record component.
      Returns:
      the value of the world record component
    • min

      @NotNull public @NotNull BlockPosition min()
      Returns the value of the min record component.
      Returns:
      the value of the min record component
    • max

      @NotNull public @NotNull BlockPosition max()
      Returns the value of the max record component.
      Returns:
      the value of the max record component
    • anchorPosition

      @NotNull public @NotNull BlockPosition anchorPosition()
      Returns the value of the anchorPosition record component.
      Returns:
      the value of the anchorPosition record component
    • members

      @Nullable public @Nullable Set<BlockPosition> members()
      Returns the value of the members record component.
      Returns:
      the value of the members record component
    • rotation

      public int rotation()
      Returns the value of the rotation record component.
      Returns:
      the value of the rotation record component
    • counts

      @NotNull public @NotNull Map<net.kyori.adventure.key.Key, Integer> counts()
      Returns the value of the counts record component.
      Returns:
      the value of the counts record component