File Container.hpp

Typedefs

using ContainerRuntimeId = unsigned int

Enums

enum class ContainerType : signed char

Values:

enumerator NONE
enumerator INVENTORY
enumerator CONTAINER
enumerator WORKBENCH
enumerator FURNACE
enumerator ENCHANTMENT
enumerator BREWING_STAND
enumerator ANVIL
enumerator DISPENSER
enumerator DROPPER
enumerator HOPPER
enumerator CAULDRON
enumerator MINECART_CHEST
enumerator MINECART_HOPPER
enumerator HORSE
enumerator BEACON
enumerator STRUCTURE_EDITOR
enumerator TRADE
enumerator COMMAND_BLOCK
enumerator JUKEBOX
enumerator ARMOR
enumerator HAND
enumerator COMPOUND_CREATOR
enumerator ELEMENT_CONSTRUCTOR
enumerator MATERIAL_REDUCER
enumerator LAB_TABLE
enumerator LOOM
enumerator LECTERN
enumerator GRINDSTONE
enumerator BLAST_FURNACE
enumerator SMOKER
enumerator STONECUTTER
enumerator CARTOGRAPHY
enumerator HUD
enumerator JIGSAW_EDITOR
enumerator SMITHING_TABLE
enumerator CHEST_BOAT
class Container

Subclassed by FillingContainer, SimpleContainer

Public Functions

Container(ContainerType type)
Container(ContainerType type, const std::string &containerName, bool hasCustomName)
virtual ~Container()
virtual void init()
virtual void serverInitItemStackIds(int, int, std::function<void(int, const ItemStack&)>) = 0
virtual void addContentChangeListener(ContainerContentChangeListener*)
virtual void removeContentChangeListener(ContainerContentChangeListener*)
virtual void addRemovedListener(ContainerRemovedListener*)
virtual void removeRemovedListener(ContainerRemovedListener*)
virtual const ItemStack &getItem(int) const = 0
virtual bool hasRoomForItem(const ItemStack&)
virtual void addItem(ItemStack&)
virtual void addItemWithForceBalance(ItemStack&)
virtual bool addItemToFirstEmptySlot(const ItemStack&)
virtual void setItem(int, const ItemStack&) = 0
virtual void setItemWithForceBalance(int, const ItemStack&, bool)
virtual void removeItem(int, int)
virtual void removeAllItems()
virtual void removeAllItemsWithForceBalance()
virtual void containerRemoved()
virtual void dropSlotContent(BlockSource&, const Vec3&, bool, int)
virtual void dropContents(BlockSource&, const Vec3&, bool)
virtual int getContainerSize() const = 0
virtual int getMaxStackSize() const = 0
virtual void startOpen(Player&) = 0
virtual void stopOpen(Player&)
virtual std::vector<ItemStack, std::allocator<ItemStack>> getSlotCopies() const
virtual const std::vector<ItemStack const*, std::allocator<ItemStack const*>> getSlots() const
virtual int getEmptySlotsCount() const
virtual int getItemCount(const ItemStack&)
virtual int findFirstSlotForItem(const ItemStack&) const
virtual bool canPushInItem(int, int, const ItemStack&) const
virtual bool canPullOutItem(int, int, const ItemStack&) const
virtual void setContainerChanged(int)
virtual void setContainerMoved()
virtual void setCustomName(const std::string &name)
virtual bool hasCustomName() const
virtual void readAdditionalSaveData(const CompoundTag&)
virtual void addAdditionalSaveData(CompoundTag&)
virtual void createTransactionContext(std::function<void(Container&, int, ItemStack const&, ItemStack const&)>, std::function<void()>)
virtual void initializeContainerContents(BlockSource&)
virtual bool isEmpty() const
virtual bool isSlotDisabled(int slot)
virtual bool hasGetStrictParsingVersion()

Public Members

ContainerType mContainerType
ContainerType mGameplayContainerType
std::unordered_set<ContainerContentChangeListener*> mContentChangeListeners
std::unordered_set<ContainerSizeChangeListener*> mSizeChangeListeners
std::unordered_set<ContainerCloseListener*> mCloseListeners
std::unordered_set<ContainerRemovedListener*> mRemovedListeners
std::deque<std::function<void(Container&, int, const ItemStack&, const ItemStack&)>> mTransactionContextStack
std::string mName
bool mCustomName
ContainerRuntimeId mContainerRuntimeId