use of ivorius.reccomplex.world.gen.feature.structure.generic.generation.NaturalGeneration in project RecurrentComplex by Ivorforce.
the class WorldGenStructures method planStructuresInChunk.
public static void planStructuresInChunk(Random random, ChunkPos chunkPos, WorldServer world, Biome biomeGen, @Nullable Predicate<Structure> structurePredicate) {
MixingStructureSelector<NaturalGeneration, NaturalStructureSelector.Category> structureSelector = StructureRegistry.INSTANCE.naturalStructureSelectors().get(biomeGen, world.provider);
float distanceToSpawn = distance(new ChunkPos(world.getSpawnPoint()), chunkPos);
// TODO Use STRUCTURE_TRIES
List<Pair<Structure<?>, NaturalGeneration>> generated = structureSelector.generatedStructures(random, world.getBiome(chunkPos.getBlock(0, 0, 0)), world.provider, distanceToSpawn);
generated.stream().filter(pair -> structurePredicate == null || structurePredicate.test(pair.getLeft())).forEach(pair -> planStructureInChunk(chunkPos, world, pair.getLeft(), pair.getRight(), random.nextLong()));
}
use of ivorius.reccomplex.world.gen.feature.structure.generic.generation.NaturalGeneration in project RecurrentComplex by Ivorforce.
the class GenericStructure method createDefaultStructure.
public static GenericStructure createDefaultStructure() {
GenericStructure genericStructureInfo = new GenericStructure();
genericStructureInfo.rotatable = true;
genericStructureInfo.mirrorable = true;
genericStructureInfo.blocking = true;
genericStructureInfo.transformer.getData().setPreset("structure");
genericStructureInfo.generationTypes.add(new NaturalGeneration());
return genericStructureInfo;
}
use of ivorius.reccomplex.world.gen.feature.structure.generic.generation.NaturalGeneration in project RecurrentComplex by Ivorforce.
the class WorldGenStructures method generateRandomStructureInChunk.
public static boolean generateRandomStructureInChunk(Random random, ChunkPos chunkPos, WorldServer world, Biome biomeGen) {
MixingStructureSelector<NaturalGeneration, NaturalStructureSelector.Category> structureSelector = StructureRegistry.INSTANCE.naturalStructureSelectors().get(biomeGen, world.provider);
float distanceToSpawn = distance(new ChunkPos(world.getSpawnPoint()), chunkPos);
for (int i = 0; i < STRUCTURE_TRIES; i++) {
Pair<Structure<?>, NaturalGeneration> pair = structureSelector.selectOne(random, world.provider, world.getBiome(chunkPos.getBlock(0, 0, 0)), null, distanceToSpawn);
if (pair != null) {
if (planStructureInChunk(chunkPos, world, pair.getLeft(), pair.getRight(), random.nextLong()))
return true;
}
}
return false;
}
Aggregations