Package net.minecraft.inventory
Class ContainerLock
java.lang.Object
net.minecraft.inventory.ContainerLock
@Immutable public class ContainerLock extends Object
- Mappings:
Namespace Name official apsintermediary net/minecraft/class_1273named net/minecraft/inventory/ContainerLock
-
Field Summary
Fields Modifier and Type Field Description static ContainerLockEMPTYAn empty container lock that can always be opened.private Stringkey -
Constructor Summary
Constructors Constructor Description ContainerLock(String key) -
Method Summary
Modifier and Type Method Description booleancanOpen(ItemStack stack)Returns true if this lock can be opened with the key item stack.static ContainerLockfromTag(CompoundTag tag)Creates a newContainerLockfrom theLockkey of the compound tag.voidtoTag(CompoundTag tag)Inserts the key string of this lock into theLockkey of the compound tag.
-
Field Details
-
EMPTY
An empty container lock that can always be opened.- Mappings:
Namespace Name Mixin selector official aLaps;a:Laps;intermediary field_5817Lnet/minecraft/class_1273;field_5817:Lnet/minecraft/class_1273;named EMPTYLnet/minecraft/inventory/ContainerLock;EMPTY:Lnet/minecraft/inventory/ContainerLock;
-
key
- Mappings:
Namespace Name Mixin selector official bLaps;b:Ljava/lang/String;intermediary field_5818Lnet/minecraft/class_1273;field_5818:Ljava/lang/String;named keyLnet/minecraft/inventory/ContainerLock;key:Ljava/lang/String;
-
-
Constructor Details
-
ContainerLock
- Mappings:
Namespace Name Mixin selector official <init>Laps;<init>(Ljava/lang/String;)Vintermediary <init>Lnet/minecraft/class_1273;<init>(Ljava/lang/String;)Vnamed <init>Lnet/minecraft/inventory/ContainerLock;<init>(Ljava/lang/String;)V
-
-
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.
- Parameters:
stack- the key item stack- Mappings:
Namespace Name Mixin selector official aLaps;a(Lbnv;)Zintermediary method_5472Lnet/minecraft/class_1273;method_5472(Lnet/minecraft/class_1799;)Znamed canOpenLnet/minecraft/inventory/ContainerLock;canOpen(Lnet/minecraft/item/ItemStack;)Z
-
toTag
Inserts the key string of this lock into theLockkey of the compound tag.- Mappings:
Namespace Name Mixin selector official aLaps;a(Lmq;)Vintermediary method_5474Lnet/minecraft/class_1273;method_5474(Lnet/minecraft/class_2487;)Vnamed toTagLnet/minecraft/inventory/ContainerLock;toTag(Lnet/minecraft/nbt/CompoundTag;)V
-
fromTag
Creates a newContainerLockfrom theLockkey of the compound tag.If the
Lockkey is not present, returns an empty lock.- Mappings:
Namespace Name Mixin selector official bLaps;b(Lmq;)Laps;intermediary method_5473Lnet/minecraft/class_1273;method_5473(Lnet/minecraft/class_2487;)Lnet/minecraft/class_1273;named fromTagLnet/minecraft/inventory/ContainerLock;fromTag(Lnet/minecraft/nbt/CompoundTag;)Lnet/minecraft/inventory/ContainerLock;
-