Class ChiseledBookShelfBlockEntity

All Implemented Interfaces:
Iterable<ItemStack>, Clearable, Container, IAttachmentHolder, IBlockEntityExtension

public class ChiseledBookShelfBlockEntity extends BlockEntity implements Container
  • Field Details

    • MAX_BOOKS_IN_STORAGE

      public static final int MAX_BOOKS_IN_STORAGE
      See Also:
    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • DEFAULT_LAST_INTERACTED_SLOT

      private static final int DEFAULT_LAST_INTERACTED_SLOT
      See Also:
    • items

      private final NonNullList<ItemStack> items
    • lastInteractedSlot

      private int lastInteractedSlot
  • Constructor Details

    • ChiseledBookShelfBlockEntity

      public ChiseledBookShelfBlockEntity(BlockPos pPos, BlockState pState)
  • Method Details

    • updateState

      private void updateState(int pSlot)
    • loadAdditional

      protected void loadAdditional(CompoundTag p_338883_, HolderLookup.Provider p_338454_)
      Overrides:
      loadAdditional in class BlockEntity
    • saveAdditional

      protected void saveAdditional(CompoundTag p_251872_, HolderLookup.Provider p_323649_)
      Overrides:
      saveAdditional in class BlockEntity
    • count

      public int count()
    • clearContent

      public void clearContent()
      Specified by:
      clearContent in interface Clearable
    • getContainerSize

      public int getContainerSize()
      Specified by:
      getContainerSize in interface Container
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Container
    • getItem

      public ItemStack getItem(int p_256203_)
      Description copied from interface: Container
      Returns the stack in the given slot.
      Specified by:
      getItem in interface Container
    • removeItem

      public ItemStack removeItem(int p_255828_, int p_255673_)
      Description copied from interface: Container
      Removes up to a specified number of items from an inventory slot and returns them in a new stack.
      Specified by:
      removeItem in interface Container
    • removeItemNoUpdate

      public ItemStack removeItemNoUpdate(int p_255874_)
      Description copied from interface: Container
      Removes a stack from the given slot and returns it.
      Specified by:
      removeItemNoUpdate in interface Container
    • setItem

      public void setItem(int p_256610_, ItemStack p_255789_)
      Description copied from interface: Container
      Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).
      Specified by:
      setItem in interface Container
    • canTakeItem

      public boolean canTakeItem(Container p_282172_, int p_281387_, ItemStack p_283257_)
      Description copied from interface: Container
      Returns true if the given stack can be extracted into the target inventory.
      Specified by:
      canTakeItem in interface Container
      Parameters:
      p_282172_ - the container into which the item should be extracted
      p_281387_ - the slot from which to extract the item
      p_283257_ - the item to extract
      Returns:
      true if the given stack can be extracted into the target inventory
    • getMaxStackSize

      public int getMaxStackSize()
      Specified by:
      getMaxStackSize in interface Container
    • stillValid

      public boolean stillValid(Player p_256481_)
      Description copied from interface: Container
      Don't rename this method to canInteractWith due to conflicts with Container
      Specified by:
      stillValid in interface Container
    • canPlaceItem

      public boolean canPlaceItem(int p_256567_, ItemStack p_255922_)
      Description copied from interface: Container
      Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. For guis use Slot.isItemValid
      Specified by:
      canPlaceItem in interface Container
    • getLastInteractedSlot

      public int getLastInteractedSlot()
    • applyImplicitComponents

      protected void applyImplicitComponents(DataComponentGetter p_396989_)
      Overrides:
      applyImplicitComponents in class BlockEntity
    • collectImplicitComponents

      protected void collectImplicitComponents(DataComponentMap.Builder p_338540_)
      Overrides:
      collectImplicitComponents in class BlockEntity
    • removeComponentsFromTag

      public void removeComponentsFromTag(CompoundTag p_332725_)
      Overrides:
      removeComponentsFromTag in class BlockEntity