TreeTemplate.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #pragma once
  2. #include "GeneratorTemplate.h"
  3. #include "TypeRegistry.h"
  4. class TreeTemplate : public GeneratorTemplate
  5. {
  6. private:
  7. int woodBlockTypeId;
  8. int leaveBlockType;
  9. int minHeight;
  10. int maxHeight;
  11. public:
  12. TreeTemplate();
  13. virtual GeneratedStructure* generateAt(
  14. Framework::Vec3<int> location, Noise* zNoise, int dimensionId) override;
  15. void setWoodTypeId(int id);
  16. void setLeavesTypeId(int id);
  17. const BlockType* zWoodType() const;
  18. const BlockType* zLeavesType() const;
  19. void setMinHeight(int height);
  20. void setMaxHeight(int height);
  21. int getMinHeight() const;
  22. int getMaxHeight() const;
  23. };
  24. class TreeTemplateFactory : public GeneratorTemplateFactory<TreeTemplate>
  25. {
  26. public:
  27. TreeTemplateFactory();
  28. TreeTemplate* createValue(
  29. Framework::JSON::JSONObject* zJson) const override;
  30. TreeTemplate* fromJson(Framework::JSON::JSONObject* zConfig) const override;
  31. Framework::JSON::JSONObject* toJsonObject(
  32. TreeTemplate* zObject) const override;
  33. JSONObjectValidationBuilder* addToValidator(
  34. JSONObjectValidationBuilder* builder) const override;
  35. const char* getTypeToken() const override;
  36. };