#pragma once using namespace std; #include "TileEntity.h" #include "Container.h" class Player; class CompoundTag; class ShulkerBoxTileEntity : public TileEntity, public Container { public: eINSTANCEOF GetType() { return eTYPE_SHULKERBOXTILEENTITY; } static TileEntity *create() { return new ShulkerBoxTileEntity(); } using TileEntity::setChanged; static const int CONTAINER_SIZE = 27; static const int EVENT_SET_OPEN_COUNT = 1; static const int ANIMATION_CLOSED = 0; static const int ANIMATION_OPENING = 1; static const int ANIMATION_OPENED = 2; static const int ANIMATION_CLOSING = 3; static const float LID_HEIGHT_FACTOR; static const float LID_ROTATION_DEGREES; ShulkerBoxTileEntity(int color = -1); virtual ~ShulkerBoxTileEntity(); int getColor(); int getAnimationStatus(); float getProgress(float a); bool isEmpty(); bool isCleared(); void setDestroyedByCreativePlayer(bool value); bool shouldDrop(); void saveContents(CompoundTag *tag); void loadContents(CompoundTag *tag); virtual int getContainerType(); virtual unsigned int getContainerSize(); virtual shared_ptr getItem(unsigned int slot); virtual shared_ptr removeItem(unsigned int slot, int count); virtual shared_ptr removeItemNoUpdate(int slot); virtual void setItem(unsigned int slot, shared_ptr item); virtual wstring getName(); virtual wstring getCustomName(); virtual bool hasCustomName(); virtual void setCustomName(const wstring &name); virtual int getMaxStackSize() const; virtual void setChanged(); virtual bool stillValid(shared_ptr player); virtual void startOpen(); virtual void stopOpen(); virtual bool canPlaceItem(int slot, shared_ptr item); virtual void clearContent(); virtual void load(CompoundTag *base); virtual void save(CompoundTag *base); virtual void tick(); virtual bool triggerEvent(int b0, int b1); virtual shared_ptr clone(); static bool isShulkerBoxItem(shared_ptr item); private: ItemInstanceArray *items; wstring name; int color; int openCount; int animationStatus; float progress; float progressOld; bool cleared; bool destroyedByCreativePlayer; void updateAnimation(); void moveCollidedEntities(); };