Package net.minecraft.inventory
Class ContainerLock
java.lang.Object
net.minecraft.inventory.ContainerLock
@Immutable public class ContainerLock extends Object
-
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. -
key
-
-
Constructor Details
-
ContainerLock
-
-
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
-
toTag
Inserts the key string of this lock into theLockkey of the compound tag. -
fromTag
Creates a newContainerLockfrom theLockkey of the compound tag.If the
Lockkey is not present, returns an empty lock.
-