Class ContainerLock

java.lang.Object
net.minecraft.inventory.ContainerLock

@Unmodifiable public class ContainerLock extends Object
Mappings:
Namespace Name
official bea
intermediary net/minecraft/class_1273
named net/minecraft/inventory/ContainerLock
  • Field Details

    • EMPTY

      public static final ContainerLock EMPTY
      An empty container lock that can always be opened.
      Mappings:
      Namespace Name Mixin selector
      official a Lbea;a:Lbea;
      intermediary field_5817 Lnet/minecraft/class_1273;field_5817:Lnet/minecraft/class_1273;
      named EMPTY Lnet/minecraft/inventory/ContainerLock;EMPTY:Lnet/minecraft/inventory/ContainerLock;
    • LOCK_KEY

      public static final String LOCK_KEY
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official b Lbea;b:Ljava/lang/String;
      intermediary field_29956 Lnet/minecraft/class_1273;field_29956:Ljava/lang/String;
      named LOCK_KEY Lnet/minecraft/inventory/ContainerLock;LOCK_KEY:Ljava/lang/String;
    • key

      private final String key
      Mappings:
      Namespace Name Mixin selector
      official c Lbea;c:Ljava/lang/String;
      intermediary field_5818 Lnet/minecraft/class_1273;field_5818:Ljava/lang/String;
      named key Lnet/minecraft/inventory/ContainerLock;key:Ljava/lang/String;
  • Constructor Details

    • ContainerLock

      public ContainerLock(String key)
      Mappings:
      Namespace Name Mixin selector
      official <init> Lbea;<init>(Ljava/lang/String;)V
      intermediary <init> Lnet/minecraft/class_1273;<init>(Ljava/lang/String;)V
      named <init> Lnet/minecraft/inventory/ContainerLock;<init>(Ljava/lang/String;)V
  • Method Details

    • canOpen

      public boolean canOpen(ItemStack stack)
      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 a Lbea;a(Lcfv;)Z
      intermediary method_5472 Lnet/minecraft/class_1273;method_5472(Lnet/minecraft/class_1799;)Z
      named canOpen Lnet/minecraft/inventory/ContainerLock;canOpen(Lnet/minecraft/item/ItemStack;)Z
    • writeNbt

      public void writeNbt(NbtCompound nbt)
      Inserts the key string of this lock into the Lock key of the NBT compound.
      Mappings:
      Namespace Name Mixin selector
      official a Lbea;a(Lre;)V
      intermediary method_5474 Lnet/minecraft/class_1273;method_5474(Lnet/minecraft/class_2487;)V
      named writeNbt Lnet/minecraft/inventory/ContainerLock;writeNbt(Lnet/minecraft/nbt/NbtCompound;)V
    • fromNbt

      public static ContainerLock fromNbt(NbtCompound nbt)
      Creates a new ContainerLock from the Lock key of the NBT compound.

      If the Lock key is not present, returns an empty lock.

      Mappings:
      Namespace Name Mixin selector
      official b Lbea;b(Lre;)Lbea;
      intermediary method_5473 Lnet/minecraft/class_1273;method_5473(Lnet/minecraft/class_2487;)Lnet/minecraft/class_1273;
      named fromNbt Lnet/minecraft/inventory/ContainerLock;fromNbt(Lnet/minecraft/nbt/NbtCompound;)Lnet/minecraft/inventory/ContainerLock;