Package net.minecraft.inventory
Record Class ContainerLock
java.lang.Object
java.lang.Record
net.minecraft.inventory.ContainerLock
- Record Components:
key-
- Mappings:
Namespace Name official boiintermediary net/minecraft/class_1273named net/minecraft/inventory/ContainerLockofficial dintermediary comp_2371named key
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<ContainerLock> static final ContainerLockAn empty container lock that can always be opened.private final StringThe field for thekeyrecord component.static final String -
Constructor Summary
ConstructorsConstructorDescriptionContainerLock(String key) Creates an instance of aContainerLockrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns true if this lock can be opened with the key item stack.final booleanIndicates whether some other object is "equal to" this one.static ContainerLockfromNbt(NbtCompound nbt) Creates a newContainerLockfrom theLockkey of the NBT compound.final inthashCode()Returns a hash code value for this object.key()Returns the value of thekeyrecord component.final StringtoString()Returns a string representation of this record class.voidwriteNbt(NbtCompound nbt) Inserts the key string of this lock into theLockkey of the NBT compound.
-
Field Details
-
key
The field for thekeyrecord component. -
EMPTY
An empty container lock that can always be opened.- Mappings:
Namespace Name Mixin selector official aLboi;a:Lboi;intermediary field_5817Lnet/minecraft/class_1273;field_5817:Lnet/minecraft/class_1273;named EMPTYLnet/minecraft/inventory/ContainerLock;EMPTY:Lnet/minecraft/inventory/ContainerLock;
-
CODEC
- Mappings:
Namespace Name Mixin selector official bLboi;b:Lcom/mojang/serialization/Codec;intermediary field_49206Lnet/minecraft/class_1273;field_49206:Lcom/mojang/serialization/Codec;named CODECLnet/minecraft/inventory/ContainerLock;CODEC:Lcom/mojang/serialization/Codec;
-
LOCK_KEY
- See Also:
- Mappings:
Namespace Name Mixin selector official cLboi;c:Ljava/lang/String;intermediary field_29956Lnet/minecraft/class_1273;field_29956:Ljava/lang/String;named LOCK_KEYLnet/minecraft/inventory/ContainerLock;LOCK_KEY:Ljava/lang/String;
-
-
Constructor Details
-
ContainerLock
Creates an instance of aContainerLockrecord class.- Parameters:
key- the value for thekeyrecord component
-
-
Method Details
-
canOpen
Returns true if this lock can be opened with the key item stack.An item stack is a valid key if the stack name matches the key string of this lock, or if the key string is empty.
- Mappings:
Namespace Name Mixin selector official aLboi;a(Lcrs;)Zintermediary method_5472Lnet/minecraft/class_1273;method_5472(Lnet/minecraft/class_1799;)Znamed canOpenLnet/minecraft/inventory/ContainerLock;canOpen(Lnet/minecraft/item/ItemStack;)Z
-
writeNbt
Inserts the key string of this lock into theLockkey of the NBT compound.- Mappings:
Namespace Name Mixin selector official aLboi;a(Lto;)Vintermediary method_5474Lnet/minecraft/class_1273;method_5474(Lnet/minecraft/class_2487;)Vnamed writeNbtLnet/minecraft/inventory/ContainerLock;writeNbt(Lnet/minecraft/nbt/NbtCompound;)V
-
fromNbt
Creates a newContainerLockfrom theLockkey of the NBT compound.If the
Lockkey is not present, returns an empty lock.- Mappings:
Namespace Name Mixin selector official bLboi;b(Lto;)Lboi;intermediary method_5473Lnet/minecraft/class_1273;method_5473(Lnet/minecraft/class_2487;)Lnet/minecraft/class_1273;named fromNbtLnet/minecraft/inventory/ContainerLock;fromNbt(Lnet/minecraft/nbt/NbtCompound;)Lnet/minecraft/inventory/ContainerLock;
-
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). -
key
Returns the value of thekeyrecord component.- Returns:
- the value of the
keyrecord component
-