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 -
Method Summary
Modifier and TypeMethodDescriptionme.moros.math.adapter.Adapters<? extends me.moros.math.Position>
adapters()
<T> void
Store data for a specified key.int
blockX()
Returns the value of theblockX
record component.int
blockY()
Returns the value of theblockY
record component.int
blockZ()
Returns the value of theblockZ
record component.bounds()
final boolean
Indicates whether some other object is "equal to" this one.<T> Optional<T>
Attempt to retrieve the data for the specified key.final int
hashCode()
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
Attempt to remove the data for the specified key.boolean
setState
(BlockState state) boolean
state()
final String
toString()
Returns a string representation of this record class.type()
world()
Returns the value of theworld
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
-
Block
Creates an instance of aBlock
record class.- Parameters:
world
- the value for theworld
record componentblockX
- the value for theblockX
record componentblockY
- the value for theblockY
record componentblockZ
- the value for theblockZ
record component
-
-
Method Details
-
offset
-
offset
-
offset
-
type
-
setType
-
state
-
setState
-
bounds
-
x
public double x()- Specified by:
x
in interfaceme.moros.math.Position
-
y
public double y()- Specified by:
y
in interfaceme.moros.math.Position
-
z
public double z()- Specified by:
z
in interfaceme.moros.math.Position
-
adapters
public me.moros.math.adapter.Adapters<? extends me.moros.math.Position> adapters()- Specified by:
adapters
in interfaceme.moros.math.Position
-
get
Description copied from interface:DataHolder
Attempt to retrieve the data for the specified key.- Specified by:
get
in interfaceDataHolder
- Type Parameters:
T
- the type of data- Parameters:
key
- the key associated with data- Returns:
- the data that was retrieved if available
-
add
Description copied from interface:DataHolder
Store data for a specified key.- Specified by:
add
in interfaceDataHolder
- Type Parameters:
T
- the type of data- Parameters:
key
- the key used to store and access the datavalue
- the data to store
-
remove
Description copied from interface:DataHolder
Attempt to remove the data for the specified key.- Specified by:
remove
in interfaceDataHolder
- Type Parameters:
T
- the type of data- Parameters:
key
- the key associated with data
-
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. -
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. -
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 '=='. -
world
Returns the value of theworld
record component.- Returns:
- the value of the
world
record component
-
blockX
public int blockX()Returns the value of theblockX
record component.- Specified by:
blockX
in interfaceme.moros.math.Position
- Returns:
- the value of the
blockX
record component
-
blockY
public int blockY()Returns the value of theblockY
record component.- Specified by:
blockY
in interfaceme.moros.math.Position
- Returns:
- the value of the
blockY
record component
-
blockZ
public int blockZ()Returns the value of theblockZ
record component.- Specified by:
blockZ
in interfaceme.moros.math.Position
- Returns:
- the value of the
blockZ
record component
-