[Fix] Game hangs if BiomePicker has no Biomes
This commit is contained in:
parent
f1afb99b38
commit
2f4f71b83a
1 changed files with 10 additions and 6 deletions
|
@ -1,6 +1,7 @@
|
||||||
package org.betterx.bclib.api.v2.generator;
|
package org.betterx.bclib.api.v2.generator;
|
||||||
|
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiome;
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiome;
|
||||||
|
import org.betterx.bclib.api.v2.levelgen.biomes.BiomeAPI;
|
||||||
import org.betterx.bclib.util.WeighTree;
|
import org.betterx.bclib.util.WeighTree;
|
||||||
import org.betterx.bclib.util.WeightedList;
|
import org.betterx.bclib.util.WeightedList;
|
||||||
|
|
||||||
|
@ -57,13 +58,16 @@ public class BiomePicker {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rebuild() {
|
public void rebuild() {
|
||||||
if (biomes.isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
WeightedList<ActualBiome> list = new WeightedList<>();
|
WeightedList<ActualBiome> list = new WeightedList<>();
|
||||||
biomes.forEach(biome -> {
|
if (biomes.isEmpty()) {
|
||||||
list.add(biome, biome.bclBiome.getGenChance());
|
list.add(create(BiomeAPI.EMPTY_BIOME), 1);
|
||||||
});
|
} else {
|
||||||
|
biomes.forEach(biome -> {
|
||||||
|
list.add(biome, biome.bclBiome.getGenChance());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
tree = new WeighTree<>(list);
|
tree = new WeighTree<>(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue