#pragma once #include #include #include #include "EntityGenerator.h" #include "GeneratorRule.h" #include "JNoise.h" #include "JsonExpression.h" #include "StructureCollection.h" class Block; class Noise; class BiomGenerator : public virtual Framework::ReferenceCounter { private: Framework::Text name; Framework::RCArray templates; Framework::RCArray rules; JBoolExpression* condition; Framework::Vec3 minStructureOffset; Framework::Vec3 maxStructureOffset; Framework::RCArray entityGenerators; protected: int seed; public: BiomGenerator(); ~BiomGenerator(); void initialize(JExpressionMemory* zMemory); Framework::Either generateBlock(int x, int y, int z, int dimensionId, JExpressionMemory* zMemory, Chunk* partialGeneratedChunk); bool isApplicable(JExpressionMemory* zMemory); void generateStructures(int x, int y, int z, int dimensionId, JExpressionMemory* zMemory, Framework::Vec3 minPos, Framework::Vec3 maxPos, Framework::RCArray* zResult); void generateEntities( int x, int y, int z, int dimensionId, JExpressionMemory* zMemory); const Framework::RCArray& getTemplates() const; Framework::Vec3 getMinStructureOffset() const; Framework::Vec3 getMaxStructureOffset() const; void setName(Framework::Text name); Framework::Text getName() const; void setCondition(JBoolExpression* condition); JBoolExpression* getCondition() const; void addTemplate(StructureTemplateCollection* collection); const Framework::RCArray& getTemplates(); void addGeneratorRule(GeneratorRule* rule); const Framework::RCArray& getGeneratorRules() const; void addEntityGenerator(EntityGenerator* generator); const Framework::RCArray& getEntityGenerators() const; }; class BiomGeneratorFactory : public TypeFactory { public: BiomGeneratorFactory(); BiomGenerator* createValue( Framework::JSON::JSONObject* zJson) const override; void fromJson(BiomGenerator* zResult, Framework::JSON::JSONObject* zJson) const override; void toJson(BiomGenerator* zObject, Framework::JSON::JSONObject* zResult) const override; JSONObjectValidationBuilder* addToValidator( JSONObjectValidationBuilder* builder) const override; };