Registry fixes and debug

This commit is contained in:
paulevsGitch 2020-11-13 20:23:43 +03:00
parent b7afcf1ca5
commit 8bdfbb65fa
3 changed files with 24 additions and 2 deletions

View file

@ -81,7 +81,7 @@ public class EndBiomes {
biomeRegistry.forEach((biome) -> { biomeRegistry.forEach((biome) -> {
if (biome.getCategory() == Category.THEEND) { if (biome.getCategory() == Category.THEEND) {
Identifier id = biomeRegistry.getId(biome); Identifier id = biomeRegistry.getId(biome);
if (!ID_MAP.containsKey(id)) { if (!ID_MAP.containsKey(id) && !LAND_BIOMES.containsImmutable(id) && !VOID_BIOMES.containsImmutable(id)) {
JsonObject config = configs.get(id.getNamespace()); JsonObject config = configs.get(id.getNamespace());
if (config == null) { if (config == null) {
config = loadJsonConfig(id.getNamespace()); config = loadJsonConfig(id.getNamespace());
@ -109,6 +109,9 @@ public class EndBiomes {
} }
}); });
System.out.println("Land");
LAND_BIOMES.debug();
CLIENT.clear(); CLIENT.clear();
} }

View file

@ -112,6 +112,10 @@ public class EndBiome {
return genChance; return genChance;
} }
public String debug() {
return this.mcID + " " + this.genChanceUnmutable + " " + this.genChance;
}
public Biome getBiome() { public Biome getBiome() {
return biome; return biome;
} }

View file

@ -2,22 +2,27 @@ package ru.betterend.world.generator;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.Set;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import net.minecraft.util.Identifier;
import ru.betterend.registry.EndBiomes; import ru.betterend.registry.EndBiomes;
import ru.betterend.world.biome.EndBiome; import ru.betterend.world.biome.EndBiome;
public class BiomePicker { public class BiomePicker {
private final Set<Identifier> immutableIDs = Sets.newHashSet();
private final List<EndBiome> biomes = Lists.newArrayList(); private final List<EndBiome> biomes = Lists.newArrayList();
private float maxChanceUnmutable = 0; private float maxChanceUnmutable = 0;
private float maxChance = 0; private float maxChance = 0;
private int biomeCount = 0; private int biomeCount = 0;
public void addBiome(EndBiome biome) { public void addBiome(EndBiome biome) {
biomes.add(biome);
maxChance = biome.mutateGenChance(maxChance); maxChance = biome.mutateGenChance(maxChance);
immutableIDs.add(biome.getID());
maxChanceUnmutable = maxChance; maxChanceUnmutable = maxChance;
biomes.add(biome);
biomeCount ++; biomeCount ++;
} }
@ -43,4 +48,14 @@ public class BiomePicker {
public List<EndBiome> getBiomes() { public List<EndBiome> getBiomes() {
return biomes; return biomes;
} }
public void debug() {
for (EndBiome b: biomes) {
System.out.println(b.debug());
}
}
public boolean containsImmutable(Identifier id) {
return immutableIDs.contains(id);
}
} }