Refactor & update to Gaea 1.10

This commit is contained in:
dfsek
2020-09-24 01:06:12 -07:00
parent 56a467d7c2
commit ae4be37fe8
14 changed files with 129 additions and 138 deletions

View File

@@ -9,26 +9,26 @@ import org.jetbrains.annotations.NotNull;
import org.polydev.gaea.biome.Biome;
import org.polydev.gaea.population.GaeaBlockPopulator;
import org.polydev.gaea.profiler.ProfileFuture;
import org.polydev.gaea.world.Fauna;
import org.polydev.gaea.world.Flora;
import java.util.Random;
public class FaunaPopulator extends GaeaBlockPopulator {
public class FloraPopulator extends GaeaBlockPopulator {
@Override
public void populate(@NotNull World world, @NotNull Random random, @NotNull Chunk chunk) {
ProfileFuture fauna = TerraProfiler.fromWorld(world).measure("FaunaTime");
ProfileFuture flora = TerraProfiler.fromWorld(world).measure("FloraTime");
for(int x = 0; x < 16; x++) {
for(int z = 0; z < 16; z++) {
Biome biome = TerraBiomeGrid.fromWorld(world).getBiome((chunk.getX() << 4) + x, (chunk.getZ() << 4) + z);
if(biome.getDecorator().getFaunaChance() <= 0 || random.nextInt(100) > biome.getDecorator().getFaunaChance())
if(biome.getDecorator().getFloraChance() <= 0 || random.nextInt(100) > biome.getDecorator().getFloraChance())
continue;
try {
Fauna item = biome.getDecorator().getFauna().get(random);
Flora item = biome.getDecorator().getFlora().get(random);
Block highest = item.getHighestValidSpawnAt(chunk, x, z);
if(highest != null) item.plant(highest.getLocation());
} catch(NullPointerException ignored) {}
}
}
if(fauna!=null) fauna.complete();
if(flora!=null) flora.complete();
}
}