123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- #pragma once
- #include <Either.h>
- #include <JSON.h>
- #include <ReferenceCounter.h>
- #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<StructureTemplateCollection> templates;
- Framework::RCArray<GeneratorRule> rules;
- JBoolExpression* condition;
- Framework::Vec3<int> minStructureOffset;
- Framework::Vec3<int> maxStructureOffset;
- Framework::RCArray<EntityGenerator> entityGenerators;
- protected:
- int seed;
- public:
- BiomGenerator();
- ~BiomGenerator();
- void initialize(JExpressionMemory* zMemory);
- Framework::Either<Block*, int> 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<int> minPos,
- Framework::Vec3<int> maxPos,
- Framework::RCArray<GeneratedStructure>* zResult);
- void generateEntities(
- int x, int y, int z, int dimensionId, JExpressionMemory* zMemory);
- const Framework::RCArray<StructureTemplateCollection>& getTemplates() const;
- Framework::Vec3<int> getMinStructureOffset() const;
- Framework::Vec3<int> 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<StructureTemplateCollection>& getTemplates();
- void addGeneratorRule(GeneratorRule* rule);
- const Framework::RCArray<GeneratorRule>& getGeneratorRules() const;
- void addEntityGenerator(EntityGenerator* generator);
- const Framework::RCArray<EntityGenerator>& getEntityGenerators() const;
- };
- class BiomGeneratorFactory : public TypeFactory<BiomGenerator>
- {
- 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;
- };
|