TreeTemplate.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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(float propability,
  13. int woodBlockTypeId,
  14. int leaveBlockType,
  15. int minHeight,
  16. int maxHeight);
  17. virtual GeneratedStructure* generateAt(
  18. Framework::Vec3<int> location, Noise* zNoise, int dimensionId) override;
  19. const BlockType* getWoodType() const;
  20. const BlockType* getLeavesType() const;
  21. friend class TreeTemplateFactory;
  22. };
  23. class TreeTemplateFactory
  24. : public SubTypeFactory<GeneratorTemplate, TreeTemplate>
  25. {
  26. public:
  27. TreeTemplateFactory();
  28. TreeTemplate* fromJson(Framework::JSON::JSONObject* zConfig) const override;
  29. Framework::JSON::JSONObject* toJson(TreeTemplate* zObject) const override;
  30. Framework::JSON::Validator::JSONValidator* getValidator(
  31. Framework::JSON::Validator::ObjectValidationBuilder<
  32. Framework::JSON::Validator::JSONValidator>* builder) const override;
  33. virtual Framework::Text getTypeToken() const override;
  34. };