Class AbstractInventoryBlockEntity

java.lang.Object
net.neoforged.neoforge.attachment.AttachmentHolder
net.minecraft.world.level.block.entity.BlockEntity
tech.anonymoushacker1279.immersiveweapons.blockentity.AbstractInventoryBlockEntity
All Implemented Interfaces:
net.minecraft.world.Clearable, net.minecraft.world.level.block.EntityBlock, net.neoforged.neoforge.attachment.IAttachmentHolder, net.neoforged.neoforge.common.extensions.IBlockEntityExtension, net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
Direct Known Subclasses:
AstralCrystalBlockEntity, CommanderPedestalBlockEntity, ShelfBlockEntity

public abstract class AbstractInventoryBlockEntity extends net.minecraft.world.level.block.entity.BlockEntity implements net.minecraft.world.level.block.EntityBlock, net.minecraft.world.Clearable
  • Nested Class Summary

    Nested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder

    net.neoforged.neoforge.attachment.AttachmentHolder.AsField
  • Field Summary

    Fields inherited from class net.minecraft.world.level.block.entity.BlockEntity

    level, remove, worldPosition

    Fields inherited from class net.neoforged.neoforge.attachment.AttachmentHolder

    ATTACHMENTS_NBT_KEY
  • Constructor Summary

    Constructors
    Constructor
    Description
    AbstractInventoryBlockEntity(net.minecraft.world.level.block.entity.BlockEntityType<?> type, net.minecraft.core.BlockPos blockPos, net.minecraft.world.level.block.state.BlockState blockState)
    Constructor for AbstractInventoryBlockEntity.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    addItem(net.minecraft.world.item.ItemStack itemStack)
    Add an item to the inventory.
    void
    Clear the inventory.
    net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack>
    Get the inventory.
    int
     
    net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket
    Get the entity update packet.
    net.minecraft.nbt.CompoundTag
    Get the update tag.
    void
    Set the change state.
    void
    load(net.minecraft.nbt.CompoundTag nbt)
    Load NBT data.
    void
    Remove an item from the inventory.
    protected void
    saveAdditional(net.minecraft.nbt.CompoundTag tag)
    Save NBT data.

    Methods inherited from class net.minecraft.world.level.block.entity.BlockEntity

    addEntityType, clearRemoved, fillCrashReportCategory, getBlockPos, getBlockState, getLevel, getPersistentData, getPosFromTag, getType, hasLevel, isRemoved, loadStatic, onlyOpCanSetNbt, removeData, saveToItem, saveWithFullMetadata, saveWithId, saveWithoutMetadata, setBlockState, setChanged, setChanged, setData, setLevel, setRemoved, triggerEvent

    Methods inherited from class net.neoforged.neoforge.attachment.AttachmentHolder

    areAttachmentsCompatible, deserializeAttachments, getData, getExistingData, hasAttachments, hasData, serializeAttachments

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.minecraft.world.level.block.EntityBlock

    getListener, getTicker, newBlockEntity

    Methods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder

    getData, getExistingData, hasData, removeData, setData

    Methods inherited from interface net.neoforged.neoforge.common.extensions.IBlockEntityExtension

    deserializeNBT, getModelData, handleUpdateTag, hasCustomOutlineRendering, invalidateCapabilities, onChunkUnloaded, onDataPacket, onLoad, requestModelDataUpdate, serializeNBT
  • Constructor Details

    • AbstractInventoryBlockEntity

      public AbstractInventoryBlockEntity(net.minecraft.world.level.block.entity.BlockEntityType<?> type, net.minecraft.core.BlockPos blockPos, net.minecraft.world.level.block.state.BlockState blockState)
      Constructor for AbstractInventoryBlockEntity.
  • Method Details

    • getInventorySize

      public int getInventorySize()
    • addItem

      public boolean addItem(net.minecraft.world.item.ItemStack itemStack)
      Add an item to the inventory.
      Parameters:
      itemStack - the ItemStack to add
      Returns:
      boolean
    • removeItem

      public void removeItem()
      Remove an item from the inventory.
    • inventoryChanged

      public void inventoryChanged()
      Set the change state.
    • getInventory

      public net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> getInventory()
      Get the inventory.
      Returns:
      NonNullList extending ItemStack
    • load

      public void load(net.minecraft.nbt.CompoundTag nbt)
      Load NBT data.
      Overrides:
      load in class net.minecraft.world.level.block.entity.BlockEntity
      Parameters:
      nbt - the CompoundNBT to load
    • saveAdditional

      protected void saveAdditional(net.minecraft.nbt.CompoundTag tag)
      Save NBT data.
      Overrides:
      saveAdditional in class net.minecraft.world.level.block.entity.BlockEntity
      Parameters:
      tag - the CompoundNBT to save
    • getUpdatePacket

      public net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket getUpdatePacket()
      Get the entity update packet.
      Overrides:
      getUpdatePacket in class net.minecraft.world.level.block.entity.BlockEntity
      Returns:
      ClientboundBlockEntityDataPacket
    • getUpdateTag

      public net.minecraft.nbt.CompoundTag getUpdateTag()
      Get the update tag.
      Overrides:
      getUpdateTag in class net.minecraft.world.level.block.entity.BlockEntity
      Returns:
      CompoundTag
    • clearContent

      public void clearContent()
      Clear the inventory.
      Specified by:
      clearContent in interface net.minecraft.world.Clearable