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) 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.
  • Constructor Summary

    Constructors
    Constructor
    Description
    GeyserProperty(org.geysermc.geyser.level.block.property.Property<?> handle, Function<Object,T> converter)
    Creates an instance of a GeyserProperty record class.
    GeyserProperty(org.geysermc.geyser.level.block.property.Property<T> handle)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the converter record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    org.geysermc.geyser.level.block.property.Property<?>
    Returns the value of the handle record component.
    final int
    Returns a hash code value for this object.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • GeyserProperty

      public GeyserProperty(org.geysermc.geyser.level.block.property.Property<T> handle)
    • GeyserProperty

      public GeyserProperty(org.geysermc.geyser.level.block.property.Property<?> handle, Function<Object,T> converter)
      Creates an instance of a GeyserProperty record class.
      Parameters:
      handle - the value for the handle record component
      converter - the value for the converter 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 Objects::equals(Object,Object).
      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.
    • handle

      public org.geysermc.geyser.level.block.property.Property<?> handle()
      Returns the value of the handle record component.
      Returns:
      the value of the handle record component
    • converter

      public Function<Object,T> converter()
      Returns the value of the converter record component.
      Returns:
      the value of the converter record component