Package ac.boar.geyser.mappings.block
Record Class GeyserProperty<T extends Comparable<T>>
java.lang.Object
java.lang.Record
ac.boar.geyser.mappings.block.GeyserProperty<T>
- All Implemented Interfaces:
ac.boar.mappings.block.Property<T>
public record GeyserProperty<T extends Comparable<T>>(org.geysermc.geyser.level.block.property.Property<?> handle, Function<Object,T extends Comparable<T>> converter, Function<T extends Comparable<T>,Object> reverter)
extends Record
implements ac.boar.mappings.block.Property<T>
Wraps a real Geyser
Property singleton. The handle MUST be the
registry singleton, because Geyser's BlockState#get matches properties by instance identity (==);
wrapping it in a fresh anonymous Property makes every lookup return null. When Boar's value type differs from
Geyser's (Direction, ChestType), converter translates the raw Geyser value on read, and reverter
translates a Boar value back to the Geyser value on write (with).-
Constructor Summary
ConstructorsConstructorDescriptionGeyserProperty(org.geysermc.geyser.level.block.property.Property<?> handle, Function<Object, T> converter, Function<T, Object> reverter) Creates an instance of aGeyserPropertyrecord class.GeyserProperty(org.geysermc.geyser.level.block.property.Property<T> handle) -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theconverterrecord component.final booleanIndicates whether some other object is "equal to" this one.org.geysermc.geyser.level.block.property.Property<?> handle()Returns the value of thehandlerecord component.final inthashCode()Returns a hash code value for this object.reverter()Returns the value of thereverterrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
GeyserProperty
-
GeyserProperty
public GeyserProperty(org.geysermc.geyser.level.block.property.Property<?> handle, Function<Object, T> converter, Function<T, Object> reverter) Creates an instance of aGeyserPropertyrecord class.- Parameters:
handle- the value for thehandlerecord componentconverter- the value for theconverterrecord componentreverter- the value for thereverterrecord component
-
-
Method Details
-
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). -
handle
public org.geysermc.geyser.level.block.property.Property<?> handle()Returns the value of thehandlerecord component.- Returns:
- the value of the
handlerecord component
-
converter
Returns the value of theconverterrecord component.- Returns:
- the value of the
converterrecord component
-
reverter
Returns the value of thereverterrecord component.- Returns:
- the value of the
reverterrecord component
-