Record Class MachineEnvironment

java.lang.Object
java.lang.Record
fr.robie.machineengine.api.machine.MachineEnvironment
Record Components:
skyVisible - whether the block above has a clear view of the sky
daytime - whether it is day in the machine's world
raining - whether it rains or snows at the machine
skyLight - sky light level at the block above (0 to 15)

public record MachineEnvironment(boolean skyVisible, boolean daytime, boolean raining, int skyLight) extends Record
What a machine's block sees of the world (E3), read on the owner thread: e.g. for solar panels.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final MachineEnvironment
    No world (headless, unloaded): no sky, night, dry.
  • Constructor Summary

    Constructors
    Constructor
    Description
    MachineEnvironment(boolean skyVisible, boolean daytime, boolean raining, int skyLight)
    Creates an instance of a MachineEnvironment record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns the value of the daytime record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
    Returns the value of the raining record component.
    int
    Returns the value of the skyLight record component.
    boolean
    Returns the value of the skyVisible 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

    • NONE

      public static final MachineEnvironment NONE
      No world (headless, unloaded): no sky, night, dry.
  • Constructor Details

    • MachineEnvironment

      public MachineEnvironment(boolean skyVisible, boolean daytime, boolean raining, int skyLight)
      Creates an instance of a MachineEnvironment record class.
      Parameters:
      skyVisible - the value for the skyVisible record component
      daytime - the value for the daytime record component
      raining - the value for the raining record component
      skyLight - the value for the skyLight record component
  • Method Details

    • 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. All components in this record class 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.
    • skyVisible

      public boolean skyVisible()
      Returns the value of the skyVisible record component.
      Returns:
      the value of the skyVisible record component
    • daytime

      public boolean daytime()
      Returns the value of the daytime record component.
      Returns:
      the value of the daytime record component
    • raining

      public boolean raining()
      Returns the value of the raining record component.
      Returns:
      the value of the raining record component
    • skyLight

      public int skyLight()
      Returns the value of the skyLight record component.
      Returns:
      the value of the skyLight record component