Mutable registry
This commit is contained in:
parent
de7c7e1cdb
commit
b89afced36
4 changed files with 42 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue