Mutable registry

This commit is contained in:
paulevsGitch 2020-09-25 12:17:32 +03:00
parent de7c7e1cdb
commit b89afced36
4 changed files with 42 additions and 0 deletions

View file

@ -10,11 +10,26 @@ import ru.betterend.world.biome.EndBiome;
public class BiomePicker {
private final List<EndBiome> biomes = Lists.newArrayList();
private float maxChanceUnmutable = 0;
private float maxChance = 0;
private int biomeCount = 0;
public void addBiome(EndBiome biome) {
biomes.add(biome);
maxChance = biome.setGenChance(maxChance);
biomeCount ++;
maxChanceUnmutable = maxChance;
}
public void addBiomeMutable(EndBiome biome) {
biomes.add(biome);
maxChance = biome.setGenChance(maxChance);
}
public void clearMutables() {
maxChance = maxChanceUnmutable;
for (int i = biomes.size() - 1; i >= biomeCount; i--)
biomes.remove(i);
}
public EndBiome getBiome(Random random) {