Chest.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #pragma once
  2. #include "BasicBlocks.h"
  3. class Chest : public BasicBlock
  4. {
  5. private:
  6. bool open;
  7. int userEntityId;
  8. virtual void onDestroy() override;
  9. virtual void onDialogClosed(Framework::Text dialogId) override;
  10. Framework::Text getDialogId() const;
  11. protected:
  12. virtual bool onTick(
  13. TickQueue* zQueue, int numTicks, bool& blocked) override;
  14. public:
  15. Chest(int typeId, Framework::Vec3<int> pos, int dimensionId);
  16. virtual bool interact(Item* zItem, Entity* zActor) override;
  17. virtual void sendModelInfo(NetworkMessage* zMessage) override;
  18. };
  19. class ChestBlockType : public BasicBlockType
  20. {
  21. public:
  22. ChestBlockType();
  23. virtual Block* createBlock(
  24. Framework::Vec3<int> position, int dimensionId) const override;
  25. };
  26. class ChestBlockTypeFactory : public BasicBlockTypeFactory
  27. {
  28. public:
  29. ChestBlockTypeFactory();
  30. BasicBlockType* createValue(
  31. Framework::JSON::JSONObject* zJson) const override;
  32. BasicBlockType* fromJson(Framework::JSON::JSONObject* zJson) const override;
  33. Framework::JSON::JSONObject* toJsonObject(
  34. BasicBlockType* zObject) const override;
  35. JSONObjectValidationBuilder* addToValidator(
  36. JSONObjectValidationBuilder* builder) const override;
  37. const char* getTypeToken() const override;
  38. const char* getTypeName() const;
  39. };