Chest.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 SubTypeFactory<BlockType, ChestBlockType>
  27. {
  28. BasicBlockTypeFactory super;
  29. public:
  30. ChestBlockTypeFactory();
  31. ChestBlockType* createValue(
  32. Framework::JSON::JSONObject* zJson) const override;
  33. void fromJson(ChestBlockType* zResult,
  34. Framework::JSON::JSONObject* zJson) const override;
  35. void toJson(ChestBlockType* zObject,
  36. Framework::JSON::JSONObject* zResult) const override;
  37. JSONObjectValidationBuilder* addToValidator(
  38. JSONObjectValidationBuilder* builder) const override;
  39. Framework::Text getTypeToken() const override;
  40. };