Record Class BlockStateSnapshot
java.lang.Object
java.lang.Record
nl.pim16aap2.lightkeeper.framework.BlockStateSnapshot
- Record Components:
materialKey- Canonical namespaced material key.blockData- The full block-data string the server reported (every state property included).properties- All state properties, in the server's rendering order.
public record BlockStateSnapshot(String materialKey, String blockData, Map<String,String> properties)
extends Record
Frozen snapshot of a block's full state at the moment it was read.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theblockDatarecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanChecks whether this state matches a spec: the material must be equal and every property the spec names must have the spec's value.Returns the value of thematerialKeyrecord component.Returns the value of thepropertiesrecord component.@Nullable StringGets a single state property.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
BlockStateSnapshot
Validates the fields.
-
-
Method Details
-
property
Gets a single state property.- Parameters:
name- The property name, e.g.powered.- Returns:
- The property value, or
nullwhen the block has no such property.
-
matches
Checks whether this state matches a spec: the material must be equal and every property the spec names must have the spec's value. Properties the spec does not name are ignored — partial matching by design.- Parameters:
spec- The expected spec.- Returns:
truewhen this state matches.
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
materialKey
Returns the value of thematerialKeyrecord component.- Returns:
- the value of the
materialKeyrecord component
-
blockData
Returns the value of theblockDatarecord component.- Returns:
- the value of the
blockDatarecord component
-
properties
Returns the value of thepropertiesrecord component.- Returns:
- the value of the
propertiesrecord component
-