[Features] End Source has fallbacks if barrens/voids or center Biomes are missing

This commit is contained in:
Frank 2022-07-03 14:57:19 +02:00
parent e0f8cb24b6
commit c042d00c23
2 changed files with 21 additions and 3 deletions

View file

@ -62,9 +62,9 @@ public class BCLibEndBiomeSource extends BCLBiomeSource implements BiomeSourceWi
private BiomeMap mapBarrens;
private final BiomePicker endLandBiomePicker;
private final BiomePicker endVoidBiomePicker;
private final BiomePicker endCenterBiomePicker;
private final BiomePicker endBarrensBiomePicker;
private BiomePicker endVoidBiomePicker;
private BiomePicker endCenterBiomePicker;
private BiomePicker endBarrensBiomePicker;
private BCLEndBiomeSourceConfig config;
@ -171,6 +171,20 @@ public class BCLibEndBiomeSource extends BCLBiomeSource implements BiomeSourceWi
endBarrensBiomePicker.rebuild();
endCenterBiomePicker.rebuild();
if (endVoidBiomePicker.isEmpty()) {
BCLib.LOGGER.info("No Void Biomes found. Disabling by using barrens");
endVoidBiomePicker = endBarrensBiomePicker;
}
if (endBarrensBiomePicker.isEmpty()) {
BCLib.LOGGER.info("No Barrens Biomes found. Disabling by using land Biomes");
endBarrensBiomePicker = endLandBiomePicker;
endVoidBiomePicker = endLandBiomePicker;
}
if (endCenterBiomePicker.isEmpty()) {
BCLib.LOGGER.warning("No Center Island Biomes found. Forcing use of vanilla center.");
endCenterBiomePicker.addBiome(BiomeAPI.THE_END);
}
this.endLandFunction = GeneratorOptions.getEndLandFunction();
this.pos = new Point();

View file

@ -62,6 +62,10 @@ public class BiomePicker {
return biomes.isEmpty() ? fallbackBiome : tree.get(random);
}
public boolean isEmpty() {
return biomes.isEmpty();
}
public void rebuild() {
WeightedList<ActualBiome> list = new WeightedList<>();