Record Class Block

java.lang.Object
java.lang.Record
me.moros.bending.api.platform.block.Block
All Implemented Interfaces:
DataHolder, me.moros.math.Position

public record Block(World world, int blockX, int blockY, int blockZ) extends Record implements me.moros.math.Position, DataHolder
  • Constructor Summary

    Constructors
    Constructor
    Description
    Block(World world, int blockX, int blockY, int blockZ)
    Creates an instance of a Block record class.
    Block(World world, me.moros.math.Position position)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    me.moros.math.adapter.Adapters<? extends me.moros.math.Position>
     
    <T> void
    add(DataKey<T> key, T value)
    Store data for a specified key.
    int
    Returns the value of the blockX record component.
    int
    Returns the value of the blockY record component.
    int
    Returns the value of the blockZ record component.
     
    final boolean
    Indicates whether some other object is "equal to" this one.
    <T> Optional<T>
    get(DataKey<T> key)
    Attempt to retrieve the data for the specified key.
    final int
    Returns a hash code value for this object.
    offset(int dx, int dy, int dz)
     
    offset(me.moros.math.Position offset)
     
    offset(me.moros.math.Position offset, int m)
     
    <T> void
    remove(DataKey<T> key)
    Attempt to remove the data for the specified key.
    boolean
     
    boolean
     
     
    final String
    Returns a string representation of this record class.
     
    Returns the value of the world record component.
    double
    x()
     
    double
    y()
     
    double
    z()
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface me.moros.bending.api.util.data.DataHolder

    getDouble, getInt, getLong, has

    Methods inherited from interface me.moros.math.Position

    center, distance, distanceSq, maxComponent, minComponent, to, to, toArray, toIntArray, toVector3d, toVector3i
  • Constructor Details

    • Block

      public Block(World world, me.moros.math.Position position)
    • Block

      public Block(World world, int blockX, int blockY, int blockZ)
      Creates an instance of a Block record class.
      Parameters:
      world - the value for the world record component
      blockX - the value for the blockX record component
      blockY - the value for the blockY record component
      blockZ - the value for the blockZ record component
  • Method Details

    • offset

      public Block offset(me.moros.math.Position offset)
    • offset

      public Block offset(me.moros.math.Position offset, int m)
    • offset

      public Block offset(int dx, int dy, int dz)
    • type

      public BlockType type()
    • setType

      public boolean setType(BlockType type)
    • state

      public BlockState state()
    • setState

      public boolean setState(BlockState state)
    • bounds

      public AABB bounds()
    • x

      public double x()
      Specified by:
      x in interface me.moros.math.Position
    • y

      public double y()
      Specified by:
      y in interface me.moros.math.Position
    • z

      public double z()
      Specified by:
      z in interface me.moros.math.Position
    • adapters

      public me.moros.math.adapter.Adapters<? extends me.moros.math.Position> adapters()
      Specified by:
      adapters in interface me.moros.math.Position
    • get

      public <T> Optional<T> get(DataKey<T> key)
      Description copied from interface: DataHolder
      Attempt to retrieve the data for the specified key.
      Specified by:
      get in interface DataHolder
      Type Parameters:
      T - the type of data
      Parameters:
      key - the key associated with data
      Returns:
      the data that was retrieved if available
    • add

      public <T> void add(DataKey<T> key, T value)
      Description copied from interface: DataHolder
      Store data for a specified key.
      Specified by:
      add in interface DataHolder
      Type Parameters:
      T - the type of data
      Parameters:
      key - the key used to store and access the data
      value - the data to store
    • remove

      public <T> void remove(DataKey<T> key)
      Description copied from interface: DataHolder
      Attempt to remove the data for the specified key.
      Specified by:
      remove in interface DataHolder
      Type Parameters:
      T - the type of data
      Parameters:
      key - the key associated with data
    • 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 '=='.
      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.
    • world

      public World world()
      Returns the value of the world record component.
      Returns:
      the value of the world record component
    • blockX

      public int blockX()
      Returns the value of the blockX record component.
      Specified by:
      blockX in interface me.moros.math.Position
      Returns:
      the value of the blockX record component
    • blockY

      public int blockY()
      Returns the value of the blockY record component.
      Specified by:
      blockY in interface me.moros.math.Position
      Returns:
      the value of the blockY record component
    • blockZ

      public int blockZ()
      Returns the value of the blockZ record component.
      Specified by:
      blockZ in interface me.moros.math.Position
      Returns:
      the value of the blockZ record component