Record Class LockAndKeyBehavior.Simple<T extends net.minecraft.world.level.block.entity.BlockEntity>

java.lang.Object
java.lang.Record
com.github.minecraftschurlimods.bibliocraft.api.lockandkey.LockAndKeyBehavior.Simple<T>
All Implemented Interfaces:
LockAndKeyBehavior<T>
Enclosing interface:
LockAndKeyBehavior<T extends net.minecraft.world.level.block.entity.BlockEntity>

public static record LockAndKeyBehavior.Simple<T extends net.minecraft.world.level.block.entity.BlockEntity>(Function<T extends net.minecraft.world.level.block.entity.BlockEntity,net.minecraft.world.LockCode> lockGetter, BiConsumer<T extends net.minecraft.world.level.block.entity.BlockEntity,net.minecraft.world.LockCode> lockSetter, Function<T extends net.minecraft.world.level.block.entity.BlockEntity,net.minecraft.network.chat.Component> nameGetter) extends Record implements LockAndKeyBehavior<T>
  • Nested Class Summary

    Nested classes/interfaces inherited from interface com.github.minecraftschurlimods.bibliocraft.api.lockandkey.LockAndKeyBehavior

    LockAndKeyBehavior.Simple<T extends net.minecraft.world.level.block.entity.BlockEntity>
  • Constructor Summary

    Constructors
    Constructor
    Description
    Simple(Function<T,net.minecraft.world.LockCode> lockGetter, BiConsumer<T,net.minecraft.world.LockCode> lockSetter, Function<T,net.minecraft.network.chat.Component> nameGetter)
    Creates an instance of a Simple record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    net.minecraft.network.chat.Component
    getDisplayName(T blockEntity)
    Returns the BlockEntity's display name.
    net.minecraft.world.LockCode
    getLockKey(T blockEntity)
    Returns the BlockEntity's LockCode.
    final int
    Returns a hash code value for this object.
    Function<T,net.minecraft.world.LockCode>
    Returns the value of the lockGetter record component.
    BiConsumer<T,net.minecraft.world.LockCode>
    Returns the value of the lockSetter record component.
    Function<T,net.minecraft.network.chat.Component>
    Returns the value of the nameGetter record component.
    void
    setLockKey(T blockEntity, net.minecraft.world.LockCode lock)
    Sets the BlockEntity's LockCode.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

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

    • Simple

      public Simple(Function<T,net.minecraft.world.LockCode> lockGetter, BiConsumer<T,net.minecraft.world.LockCode> lockSetter, Function<T,net.minecraft.network.chat.Component> nameGetter)
      Creates an instance of a Simple record class.
      Parameters:
      lockGetter - the value for the lockGetter record component
      lockSetter - the value for the lockSetter record component
      nameGetter - the value for the nameGetter record component
  • Method Details

    • getLockKey

      public net.minecraft.world.LockCode getLockKey(T blockEntity)
      Description copied from interface: LockAndKeyBehavior
      Returns the BlockEntity's LockCode.
      Specified by:
      getLockKey in interface LockAndKeyBehavior<T extends net.minecraft.world.level.block.entity.BlockEntity>
      Parameters:
      blockEntity - the BlockEntity
      Returns:
      the BlockEntity's LockCode.
    • setLockKey

      public void setLockKey(T blockEntity, net.minecraft.world.LockCode lock)
      Description copied from interface: LockAndKeyBehavior
      Sets the BlockEntity's LockCode.
      Specified by:
      setLockKey in interface LockAndKeyBehavior<T extends net.minecraft.world.level.block.entity.BlockEntity>
      Parameters:
      blockEntity - the BlockEntity
      lock - the LockCode to set
    • getDisplayName

      public net.minecraft.network.chat.Component getDisplayName(T blockEntity)
      Description copied from interface: LockAndKeyBehavior
      Returns the BlockEntity's display name.
      Specified by:
      getDisplayName in interface LockAndKeyBehavior<T extends net.minecraft.world.level.block.entity.BlockEntity>
      Parameters:
      blockEntity - the BlockEntity
      Returns:
      the BlockEntity's display name.
    • 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.
    • lockGetter

      public Function<T,net.minecraft.world.LockCode> lockGetter()
      Returns the value of the lockGetter record component.
      Returns:
      the value of the lockGetter record component
    • lockSetter

      public BiConsumer<T,net.minecraft.world.LockCode> lockSetter()
      Returns the value of the lockSetter record component.
      Returns:
      the value of the lockSetter record component
    • nameGetter

      public Function<T,net.minecraft.network.chat.Component> nameGetter()
      Returns the value of the nameGetter record component.
      Returns:
      the value of the nameGetter record component