Record Class ReactorLayer

java.lang.Object
java.lang.Record
net.darkhax.retroreactors.common.data.reactor.ReactorLayer
Record Components:
palette - The palette to pull from when generating the layer.
radius - The radius of the layer. Must be between 0 and 32. Layers with 0 radius are skipped. Defaults to 1.
height - The height of the layer. Must be between 0 and 64. Layers with 0 height are skipped. Defaults to 1.
fill - Should the layer be filled, if false only the outline will be generated.

public record ReactorLayer(String palette, int radius, int height, boolean fill) extends Record
Represents a layer in the reactor tower structure that is generated. Each layer is generated on top of the previously generated layer.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.Codec<ReactorLayer>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ReactorLayer(String palette, int radius, int height, boolean fill)
    Creates an instance of a ReactorLayer record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    boolean
    Returns the value of the fill record component.
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the height record component.
    boolean
    isObstructed(net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos centerPos, int towerStartY)
    Checks if the layer would be obstructed and prevents the layer from generating.
    Returns the value of the palette record component.
    void
    place(net.minecraft.server.level.ServerLevel level, net.minecraft.util.random.WeightedList<net.minecraft.world.level.block.state.BlockState> palette, net.minecraft.core.BlockPos centerPos)
    Places the layer into the world.
    int
    Returns the value of the radius 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
  • Field Details

    • CODEC

      public static final com.mojang.serialization.Codec<ReactorLayer> CODEC
  • Constructor Details

    • ReactorLayer

      public ReactorLayer(String palette, int radius, int height, boolean fill)
      Creates an instance of a ReactorLayer record class.
      Parameters:
      palette - the value for the palette record component
      radius - the value for the radius record component
      height - the value for the height record component
      fill - the value for the fill record component
  • Method Details

    • place

      public void place(net.minecraft.server.level.ServerLevel level, net.minecraft.util.random.WeightedList<net.minecraft.world.level.block.state.BlockState> palette, net.minecraft.core.BlockPos centerPos)
      Places the layer into the world.
      Parameters:
      level - The server level to place the blocks in.
      palette - A weighted pool of blocks that can be selected from when generating these layers.
      centerPos - The center of the layer, adjusted to the expected height.
    • isObstructed

      public boolean isObstructed(net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos centerPos, int towerStartY)
      Checks if the layer would be obstructed and prevents the layer from generating.
      Parameters:
      level - The level the tower is generating in.
      centerPos - The center of the layer.
      towerStartY - The y level offset of the layer.
      Returns:
      If the layer is obstructed.
    • 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.
    • palette

      public String palette()
      Returns the value of the palette record component.
      Returns:
      the value of the palette record component
    • radius

      public int radius()
      Returns the value of the radius record component.
      Returns:
      the value of the radius record component
    • height

      public int height()
      Returns the value of the height record component.
      Returns:
      the value of the height record component
    • fill

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