Record Class LockAndKeyBehavior<T extends net.minecraft.world.level.block.entity.BlockEntity>
java.lang.Object
java.lang.Record
com.github.minecraftschurlimods.bibliocraft.api.lockandkey.LockAndKeyBehavior<T>
- Type Parameters:
T- The type of theBlockEntity.- Record Components:
lockGetter- The getter for theBlockEntity'sLockCode.lockSetter- The setter for theBlockEntity'sLockCode.nameGetter- The getter for theBlockEntity's display name.
public record LockAndKeyBehavior<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
Holds all information Bibliocraft needs to make the Lock and Key item work on a block entity.
-
Constructor Summary
ConstructorsConstructorDescriptionLockAndKeyBehavior(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 aLockAndKeyBehaviorrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of thelockGetterrecord component.BiConsumer<T, net.minecraft.world.LockCode> Returns the value of thelockSetterrecord component.Returns the value of thenameGetterrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
LockAndKeyBehavior
public LockAndKeyBehavior(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 aLockAndKeyBehaviorrecord class.- Parameters:
lockGetter- the value for thelockGetterrecord componentlockSetter- the value for thelockSetterrecord componentnameGetter- the value for thenameGetterrecord 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). -
lockGetter
Returns the value of thelockGetterrecord component.- Returns:
- the value of the
lockGetterrecord component
-
lockSetter
Returns the value of thelockSetterrecord component.- Returns:
- the value of the
lockSetterrecord component
-
nameGetter
Returns the value of thenameGetterrecord component.- Returns:
- the value of the
nameGetterrecord component
-