Package net.minecraft

Class class_11597

All Implemented Interfaces:
Iterable<ItemStack>, class_11596, Inventory, Clearable

public class class_11597 extends BlockEntity implements class_11596
Mappings:
Namespace Name
named net/minecraft/class_11597
intermediary net/minecraft/class_11597
official edq
  • Field Details

    • field_61441

      public static final int field_61441
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named field_61441 Lnet/minecraft/class_11597;field_61441:I
      intermediary field_61441 Lnet/minecraft/class_11597;field_61441:I
      official b Ledq;b:I
    • field_61442

      private static final Logger field_61442
      Mappings:
      Namespace Name Mixin selector
      named field_61442 Lnet/minecraft/class_11597;field_61442:Lorg/slf4j/Logger;
      intermediary field_61442 Lnet/minecraft/class_11597;field_61442:Lorg/slf4j/Logger;
      official c Ledq;c:Lorg/slf4j/Logger;
    • field_61443

      private final DefaultedList<ItemStack> field_61443
      Mappings:
      Namespace Name Mixin selector
      named field_61443 Lnet/minecraft/class_11597;field_61443:Lnet/minecraft/util/collection/DefaultedList;
      intermediary field_61443 Lnet/minecraft/class_11597;field_61443:Lnet/minecraft/class_2371;
      official d Ledq;d:Lju;
  • Constructor Details

  • Method Details

    • readData

      protected void readData(ReadView view)
      Reads data from nbt. Subclasses should override this if they store a persistent data.

      NBT is a storage format; therefore, a data from NBT is loaded to a block entity instance's fields, which are used for other operations instead of the NBT. The data is written back to NBT when saving the block entity.

      nbt might not have all expected keys, or might have a key whose value does not meet the requirement (such as the type or the range). This method should fall back to a reasonable default value instead of throwing an exception.

      Overrides:
      readData in class BlockEntity
      See Also:
      • invalid reference
        #writeNbt
      Mappings:
      Namespace Name Mixin selector
      named readData Lnet/minecraft/block/entity/BlockEntity;readData(Lnet/minecraft/storage/ReadView;)V
      intermediary method_11014 Lnet/minecraft/class_2586;method_11014(Lnet/minecraft/class_11368;)V
      official a Lecb;a(Lfeg;)V
    • writeData

      protected void writeData(WriteView view)
      Writes data to nbt. Subclasses should override this if they store a persistent data.

      NBT is a storage format; therefore, a data from NBT is loaded to a block entity instance's fields, which are used for other operations instead of the NBT. The data is written back to NBT when saving the block entity.

      Overrides:
      writeData in class BlockEntity
      See Also:
      • invalid reference
        #readNbt
      Mappings:
      Namespace Name Mixin selector
      named writeData Lnet/minecraft/block/entity/BlockEntity;writeData(Lnet/minecraft/storage/WriteView;)V
      intermediary method_11007 Lnet/minecraft/class_2586;method_11007(Lnet/minecraft/class_11372;)V
      official a Lecb;a(Lfei;)V
    • toUpdatePacket

      public BlockEntityUpdateS2CPacket toUpdatePacket()
      Description copied from class: BlockEntity
      Returns the packet to send to nearby players when the block entity's observable state changes, or null to not send the packet.

      If the data returned by initial chunk data is suitable for updates, the following shortcut can be used to create an update packet: BlockEntityUpdateS2CPacket.create(this). The NBT will be passed to

      invalid reference
      #readNbt
      on the client.

      "Observable state" is a state that clients can observe without specific interaction. For example, CampfireBlockEntity's cooked items are observable states, but chests' inventories are not observable states, since the player must first open that chest before they can see the contents.

      To sync block entity data using this method, use serverWorld.getChunkManager().markForUpdate(this.getPos());.

      Overrides:
      toUpdatePacket in class BlockEntity
      Returns:
      the packet to send to nearby players when the block entity's observable state changes, or null to not send the packet
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named toUpdatePacket Lnet/minecraft/class_11597;toUpdatePacket()Lnet/minecraft/network/packet/s2c/play/BlockEntityUpdateS2CPacket;
      intermediary method_72667 Lnet/minecraft/class_11597;method_72667()Lnet/minecraft/class_2622;
      official k Ledq;k()Lacz;
    • toInitialChunkDataNbt

      public NbtCompound toInitialChunkDataNbt(RegistryWrapper.WrapperLookup registries)
      Returns the serialized state of this block entity that is observable by clients.

      This is sent alongside the initial chunk data, as well as when the block entity implements toUpdatePacket() and decides to use the default BlockEntityUpdateS2CPacket.

      "Observable state" is a state that clients can observe without specific interaction. For example,

      invalid reference
      CampfireBlockEntity
      's cooked items are observable states, but chests' inventories are not observable states, since the player must first open that chest before they can see the contents.

      To send all NBT data of this block entity saved to disk, return BlockEntity.createNbt(net.minecraft.registry.RegistryWrapper.WrapperLookup).

      Overrides:
      toInitialChunkDataNbt in class BlockEntity
      Returns:
      the serialized state of this block entity that is observable by clients
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named toInitialChunkDataNbt Lnet/minecraft/block/entity/BlockEntity;toInitialChunkDataNbt(Lnet/minecraft/registry/RegistryWrapper$WrapperLookup;)Lnet/minecraft/nbt/NbtCompound;
      intermediary method_16887 Lnet/minecraft/class_2586;method_16887(Lnet/minecraft/class_7225$class_7874;)Lnet/minecraft/class_2487;
      official a Lecb;a(Ljn$a;)Lul;
    • method_72652

      public DefaultedList<ItemStack> method_72652()
      Specified by:
      method_72652 in interface class_11596
      Mappings:
      Namespace Name Mixin selector
      named method_72652 Lnet/minecraft/class_11596;method_72652()Lnet/minecraft/util/collection/DefaultedList;
      intermediary method_72652 Lnet/minecraft/class_11596;method_72652()Lnet/minecraft/class_2371;
      official h Ledk;h()Lju;
    • canPlayerUse

      public boolean canPlayerUse(PlayerEntity player)
      Specified by:
      canPlayerUse in interface Inventory
      Returns:
      whether player can use this inventory
      See Also:
      API Note:
      Implementations should check the distance between the inventory holder and player. For convenience, this interface offers two methods used by block entities to implement this check.
      Mappings:
      Namespace Name Mixin selector
      named canPlayerUse Lnet/minecraft/inventory/Inventory;canPlayerUse(Lnet/minecraft/entity/player/PlayerEntity;)Z
      intermediary method_5443 Lnet/minecraft/class_1263;method_5443(Lnet/minecraft/class_1657;)Z
      official a Lbxm;a(Lcvm;)Z
    • method_72666

      public ItemStack method_72666(int int2, ItemStack itemStack)
      Mappings:
      Namespace Name Mixin selector
      named method_72666 Lnet/minecraft/class_11597;method_72666(ILnet/minecraft/item/ItemStack;)Lnet/minecraft/item/ItemStack;
      intermediary method_72666 Lnet/minecraft/class_11597;method_72666(ILnet/minecraft/class_1799;)Lnet/minecraft/class_1799;
      official d Ledq;d(ILddo;)Lddo;
    • method_72665

      public void method_72665(RegistryEntry.Reference<GameEvent> reference)
      Mappings:
      Namespace Name Mixin selector
      named method_72665 Lnet/minecraft/class_11597;method_72665(Lnet/minecraft/registry/entry/RegistryEntry$Reference;)V
      intermediary method_72665 Lnet/minecraft/class_11597;method_72665(Lnet/minecraft/class_6880$class_6883;)V
      official a Ledq;a(Ljl$c;)V
    • markDirty

      public void markDirty()
      Marks this block entity as dirty and that it needs to be saved. This also triggers
      invalid reference
      comparator update
      .

      This must be called when something changed in a way that affects the saved NBT; otherwise, the game might not save the block entity.

      Specified by:
      markDirty in interface Inventory
      Overrides:
      markDirty in class BlockEntity
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named markDirty Lnet/minecraft/block/entity/BlockEntity;markDirty()V
      intermediary method_5431 Lnet/minecraft/class_2586;method_5431()V
      official e Lecb;e()V
    • readComponents

      protected void readComponents(ComponentsAccess components)
      Overrides:
      readComponents in class BlockEntity
      Mappings:
      Namespace Name Mixin selector
      named readComponents Lnet/minecraft/block/entity/BlockEntity;readComponents(Lnet/minecraft/component/ComponentsAccess;)V
      intermediary method_57568 Lnet/minecraft/class_2586;method_57568(Lnet/minecraft/class_9473;)V
      official a Lecb;a(Lkl;)V
    • addComponents

      protected void addComponents(ComponentMap.Builder builder)
      Overrides:
      addComponents in class BlockEntity
      Mappings:
      Namespace Name Mixin selector
      named addComponents Lnet/minecraft/block/entity/BlockEntity;addComponents(Lnet/minecraft/component/ComponentMap$Builder;)V
      intermediary method_57567 Lnet/minecraft/class_2586;method_57567(Lnet/minecraft/class_9323$class_9324;)V
      official a Lecb;a(Lkn$a;)V
    • removeFromCopiedStackData

      public void removeFromCopiedStackData(WriteView view)
      Overrides:
      removeFromCopiedStackData in class BlockEntity
      Mappings:
      Namespace Name Mixin selector
      named removeFromCopiedStackData Lnet/minecraft/block/entity/BlockEntity;removeFromCopiedStackData(Lnet/minecraft/storage/WriteView;)V
      intermediary method_57569 Lnet/minecraft/class_2586;method_57569(Lnet/minecraft/class_11372;)V
      official b Lecb;b(Lfei;)V