BYG crash fix, BYG end sub-biome support, Old Bulbis Gardens

improvements
This commit is contained in:
paulevsGitch 2021-02-09 15:06:08 +03:00
parent 7ef23332fc
commit 38a09c7221
10 changed files with 183 additions and 53 deletions

View file

@ -9,6 +9,7 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.biome.Biome;
import ru.betterend.config.Configs;
import ru.betterend.util.JsonFactory;
@ -161,10 +162,6 @@ public class EndBiome {
return structuresFeature;
}
public void setActualBiome(Biome biome) {
this.actualBiome = biome;
}
public Biome getActualBiome() {
return this.actualBiome;
}
@ -180,4 +177,34 @@ public class EndBiome {
public boolean hasCaves() {
return hasCaves;
}
public void updateActualBiomes(Registry<Biome> biomeRegistry) {
subbiomes.forEach((sub) -> {
sub.updateActualBiomes(biomeRegistry);
});
if (edge != null) {
edge.updateActualBiomes(biomeRegistry);
}
Biome biome = biomeRegistry.get(mcID);
this.actualBiome = biome;
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
EndBiome biome = (EndBiome) obj;
return biome == null ? false : biome.mcID.equals(mcID);
}
@Override
public int hashCode() {
return mcID.hashCode();
}
public List<EndBiome> subbiomes() {
// TODO Auto-generated method stub
return this.subbiomes;
}
}

View file

@ -28,7 +28,6 @@ public class BiomePicker {
public void addBiomeMutable(EndBiome biome) {
biomes.add(biome);
maxChance = biome.mutateGenChance(maxChance);
}
public void clearMutables() {
@ -49,7 +48,21 @@ public class BiomePicker {
return immutableIDs.contains(id);
}
public void removeMutableBiome(Identifier id) {
for (int i = biomeCount; i < biomes.size(); i++) {
EndBiome biome = biomes.get(i);
if (biome.getID().equals(id)) {
biomes.remove(i);
break;
}
}
}
public void rebuild() {
maxChance = maxChanceUnmutable;
for (int i = biomeCount; i < biomes.size(); i++) {
maxChance = biomes.get(i).mutateGenChance(maxChance);
}
tree = new WeighTree(biomes);
}
}