Class ChiseledBookshelfBlockEntity

java.lang.Object
net.minecraft.block.entity.BlockEntity
net.minecraft.block.entity.ChiseledBookshelfBlockEntity
All Implemented Interfaces:
Inventory, Clearable

public class ChiseledBookshelfBlockEntity extends BlockEntity implements Inventory
Mappings:
Namespace Name
official cvz
intermediary net/minecraft/class_7716
named net/minecraft/block/entity/ChiseledBookshelfBlockEntity
  • Field Details

    • field_40898

      private static final Logger field_40898
      Mappings:
      Namespace Name Mixin selector
      official c Lcvz;c:Lorg/slf4j/Logger;
      intermediary field_40898 Lnet/minecraft/class_7716;field_40898:Lorg/slf4j/Logger;
      named field_40898 Lnet/minecraft/block/entity/ChiseledBookshelfBlockEntity;field_40898:Lorg/slf4j/Logger;
    • MAX_BOOKS

      public static final int MAX_BOOKS
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official b Lcvz;b:I
      intermediary field_40331 Lnet/minecraft/class_7716;field_40331:I
      named MAX_BOOKS Lnet/minecraft/block/entity/ChiseledBookshelfBlockEntity;MAX_BOOKS:I
    • books

      private final class_7865 books
      Mappings:
      Namespace Name Mixin selector
      official d Lcvz;d:Lcei;
      intermediary field_40332 Lnet/minecraft/class_7716;field_40332:Lnet/minecraft/class_7865;
      named books Lnet/minecraft/block/entity/ChiseledBookshelfBlockEntity;books:Lnet/minecraft/class_7865;
  • Constructor Details

    • ChiseledBookshelfBlockEntity

      public ChiseledBookshelfBlockEntity(BlockPos pos, BlockState state)
      Mappings:
      Namespace Name Mixin selector
      official <init> Lcvz;<init>(Lgo;Lcya;)V
      intermediary <init> Lnet/minecraft/class_7716;<init>(Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;)V
      named <init> Lnet/minecraft/block/entity/ChiseledBookshelfBlockEntity;<init>(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)V
  • Method Details

    • method_46693

      private void method_46693()
      Mappings:
      Namespace Name Mixin selector
      official w Lcvz;w()V
      intermediary method_46693 Lnet/minecraft/class_7716;method_46693()V
      named method_46693 Lnet/minecraft/block/entity/ChiseledBookshelfBlockEntity;method_46693()V
    • getLastBook

      public ItemStack getLastBook()
      Mappings:
      Namespace Name Mixin selector
      official f Lcvz;f()Lcdb;
      intermediary method_45464 Lnet/minecraft/class_7716;method_45464()Lnet/minecraft/class_1799;
      named getLastBook Lnet/minecraft/block/entity/ChiseledBookshelfBlockEntity;getLastBook()Lnet/minecraft/item/ItemStack;
    • method_46692

      public List<ItemStack> method_46692()
      Mappings:
      Namespace Name Mixin selector
      official g Lcvz;g()Ljava/util/List;
      intermediary method_46692 Lnet/minecraft/class_7716;method_46692()Ljava/util/List;
      named method_46692 Lnet/minecraft/block/entity/ChiseledBookshelfBlockEntity;method_46692()Ljava/util/List;
    • addBook

      public boolean addBook(ItemStack itemStack)
      Mappings:
      Namespace Name Mixin selector
      official a Lcvz;a(Lcdb;)Z
      intermediary method_45462 Lnet/minecraft/class_7716;method_45462(Lnet/minecraft/class_1799;)Z
      named addBook Lnet/minecraft/block/entity/ChiseledBookshelfBlockEntity;addBook(Lnet/minecraft/item/ItemStack;)Z
    • readNbt

      public void readNbt(NbtCompound nbt)
      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:
      readNbt in class BlockEntity
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Lcvs;a(Lqi;)V
      intermediary method_11014 Lnet/minecraft/class_2586;method_11014(Lnet/minecraft/class_2487;)V
      named readNbt Lnet/minecraft/block/entity/BlockEntity;readNbt(Lnet/minecraft/nbt/NbtCompound;)V
    • writeNbt

      protected void writeNbt(NbtCompound nbt)
      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:
      writeNbt in class BlockEntity
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official b Lcvs;b(Lqi;)V
      intermediary method_11007 Lnet/minecraft/class_2586;method_11007(Lnet/minecraft/class_2487;)V
      named writeNbt Lnet/minecraft/block/entity/BlockEntity;writeNbt(Lnet/minecraft/nbt/NbtCompound;)V
    • getBooksAsList

      private static DefaultedList<ItemStack> getBooksAsList(class_7865 class_7865)
      Mappings:
      Namespace Name Mixin selector
      official a Lcvz;a(Lcei;)Lhg;
      intermediary method_45463 Lnet/minecraft/class_7716;method_45463(Lnet/minecraft/class_7865;)Lnet/minecraft/class_2371;
      named getBooksAsList Lnet/minecraft/block/entity/ChiseledBookshelfBlockEntity;getBooksAsList(Lnet/minecraft/class_7865;)Lnet/minecraft/util/collection/DefaultedList;
    • 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 BlockEntity.readNbt(net.minecraft.nbt.NbtCompound) 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
      official i Lcvz;i()Lul;
      intermediary method_45465 Lnet/minecraft/class_7716;method_45465()Lnet/minecraft/class_2622;
      named toUpdatePacket Lnet/minecraft/block/entity/ChiseledBookshelfBlockEntity;toUpdatePacket()Lnet/minecraft/network/packet/s2c/play/BlockEntityUpdateS2CPacket;
    • toInitialChunkDataNbt

      public NbtCompound toInitialChunkDataNbt()
      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 BlockEntity.toUpdatePacket() and decides to use the default BlockEntityUpdateS2CPacket.

      "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 send all NBT data of this block entity saved to disk, return BlockEntity.createNbt().

      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
      official ac_ Lcvs;ac_()Lqi;
      intermediary method_16887 Lnet/minecraft/class_2586;method_16887()Lnet/minecraft/class_2487;
      named toInitialChunkDataNbt Lnet/minecraft/block/entity/BlockEntity;toInitialChunkDataNbt()Lnet/minecraft/nbt/NbtCompound;
    • clear

      public void clear()
      Specified by:
      clear in interface Clearable
      Mappings:
      Namespace Name Mixin selector
      official a Lbbp;a()V
      intermediary method_5448 Lnet/minecraft/class_3829;method_5448()V
      named clear Lnet/minecraft/util/Clearable;clear()V
    • getBookCount

      public int getBookCount()
      Mappings:
      Namespace Name Mixin selector
      official j Lcvz;j()I
      intermediary method_45466 Lnet/minecraft/class_7716;method_45466()I
      named getBookCount Lnet/minecraft/block/entity/ChiseledBookshelfBlockEntity;getBookCount()I
    • method_45468

      public boolean method_45468()
      Mappings:
      Namespace Name Mixin selector
      official t Lcvz;t()Z
      intermediary method_45468 Lnet/minecraft/class_7716;method_45468()Z
      named method_45468 Lnet/minecraft/block/entity/ChiseledBookshelfBlockEntity;method_45468()Z
    • size

      public int size()
      Specified by:
      size in interface Inventory
      Mappings:
      Namespace Name Mixin selector
      official b Lbbr;b()I
      intermediary method_5439 Lnet/minecraft/class_1263;method_5439()I
      named size Lnet/minecraft/inventory/Inventory;size()I
    • markDirty

      public void markDirty()
      Marks this block entity as dirty and that it needs to be saved. This also triggers 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
      Mappings:
      Namespace Name Mixin selector
      official e Lcvs;e()V
      intermediary method_5431 Lnet/minecraft/class_2586;method_5431()V
      named markDirty Lnet/minecraft/block/entity/BlockEntity;markDirty()V
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Inventory
      Mappings:
      Namespace Name Mixin selector
      official c Lbbr;c()Z
      intermediary method_5442 Lnet/minecraft/class_1263;method_5442()Z
      named isEmpty Lnet/minecraft/inventory/Inventory;isEmpty()Z
    • getStack

      public ItemStack getStack(int slot)
      Fetches the stack currently stored at the given slot. If the slot is empty, or is outside the bounds of this inventory, returns see ItemStack.EMPTY.
      Specified by:
      getStack in interface Inventory
      Mappings:
      Namespace Name Mixin selector
      official a Lbbr;a(I)Lcdb;
      intermediary method_5438 Lnet/minecraft/class_1263;method_5438(I)Lnet/minecraft/class_1799;
      named getStack Lnet/minecraft/inventory/Inventory;getStack(I)Lnet/minecraft/item/ItemStack;
    • removeStack

      public ItemStack removeStack(int slot, int amount)
      Removes a specific number of items from the given slot.
      Specified by:
      removeStack in interface Inventory
      Returns:
      the removed items as a stack
      Mappings:
      Namespace Name Mixin selector
      official a Lbbr;a(II)Lcdb;
      intermediary method_5434 Lnet/minecraft/class_1263;method_5434(II)Lnet/minecraft/class_1799;
      named removeStack Lnet/minecraft/inventory/Inventory;removeStack(II)Lnet/minecraft/item/ItemStack;
    • removeStack

      public ItemStack removeStack(int slot)
      Removes the stack currently stored at the indicated slot.
      Specified by:
      removeStack in interface Inventory
      Returns:
      the stack previously stored at the indicated slot.
      Mappings:
      Namespace Name Mixin selector
      official b Lbbr;b(I)Lcdb;
      intermediary method_5441 Lnet/minecraft/class_1263;method_5441(I)Lnet/minecraft/class_1799;
      named removeStack Lnet/minecraft/inventory/Inventory;removeStack(I)Lnet/minecraft/item/ItemStack;
    • setStack

      public void setStack(int slot, ItemStack stack)
      Specified by:
      setStack in interface Inventory
      Mappings:
      Namespace Name Mixin selector
      official a Lbbr;a(ILcdb;)V
      intermediary method_5447 Lnet/minecraft/class_1263;method_5447(ILnet/minecraft/class_1799;)V
      named setStack Lnet/minecraft/inventory/Inventory;setStack(ILnet/minecraft/item/ItemStack;)V
    • getMaxCountPerStack

      public int getMaxCountPerStack()
      Returns the maximum number of items a stack can contain when placed inside this inventory. No slots may have more than this number of items. It is effectively the stacking limit for this inventory's slots.
      Specified by:
      getMaxCountPerStack in interface Inventory
      Returns:
      the max count of item stacks in this inventory
      Mappings:
      Namespace Name Mixin selector
      official Q_ Lbbr;Q_()I
      intermediary method_5444 Lnet/minecraft/class_1263;method_5444()I
      named getMaxCountPerStack Lnet/minecraft/inventory/Inventory;getMaxCountPerStack()I
    • canPlayerUse

      public boolean canPlayerUse(PlayerEntity player)
      Specified by:
      canPlayerUse in interface Inventory
      Mappings:
      Namespace Name Mixin selector
      official a Lbbr;a(Lbvx;)Z
      intermediary method_5443 Lnet/minecraft/class_1263;method_5443(Lnet/minecraft/class_1657;)Z
      named canPlayerUse Lnet/minecraft/inventory/Inventory;canPlayerUse(Lnet/minecraft/entity/player/PlayerEntity;)Z
    • isValid

      public boolean isValid(int slot, ItemStack stack)
      Returns whether the given stack is a valid for the indicated slot position.
      Specified by:
      isValid in interface Inventory
      Mappings:
      Namespace Name Mixin selector
      official b Lbbr;b(ILcdb;)Z
      intermediary method_5437 Lnet/minecraft/class_1263;method_5437(ILnet/minecraft/class_1799;)Z
      named isValid Lnet/minecraft/inventory/Inventory;isValid(ILnet/minecraft/item/ItemStack;)Z
    • count

      public int count(Item item)
      Returns the number of times the specified item occurs in this inventory across all stored stacks.
      Specified by:
      count in interface Inventory
      Mappings:
      Namespace Name Mixin selector
      official a_ Lbbr;a_(Lccx;)I
      intermediary method_18861 Lnet/minecraft/class_1263;method_18861(Lnet/minecraft/class_1792;)I
      named count Lnet/minecraft/inventory/Inventory;count(Lnet/minecraft/item/Item;)I
    • containsAny

      public boolean containsAny(Set<Item> items)
      Determines whether this inventory contains any of the given candidate items.
      Specified by:
      containsAny in interface Inventory
      Mappings:
      Namespace Name Mixin selector
      official a Lbbr;a(Ljava/util/Set;)Z
      intermediary method_18862 Lnet/minecraft/class_1263;method_18862(Ljava/util/Set;)Z
      named containsAny Lnet/minecraft/inventory/Inventory;containsAny(Ljava/util/Set;)Z
    • containsAny

      public boolean containsAny(Predicate<ItemStack> predicate)
      Specified by:
      containsAny in interface Inventory
      Mappings:
      Namespace Name Mixin selector
      official a_ Lbbr;a_(Ljava/util/function/Predicate;)Z
      intermediary method_43256 Lnet/minecraft/class_1263;method_43256(Ljava/util/function/Predicate;)Z
      named containsAny Lnet/minecraft/inventory/Inventory;containsAny(Ljava/util/function/Predicate;)Z