Removed biome hashmap

This commit is contained in:
paulevsGitch 2022-01-02 07:49:50 +03:00
parent 63946e049d
commit 03968ccda3

View file

@ -109,7 +109,6 @@ public class BiomeAPI {
private static final Map<ResourceKey, List<BiConsumer<ResourceLocation, Biome>>> MODIFICATIONS = Maps.newHashMap(); private static final Map<ResourceKey, List<BiConsumer<ResourceLocation, Biome>>> MODIFICATIONS = Maps.newHashMap();
private static final Map<ResourceLocation, SurfaceRules.RuleSource> SURFACE_RULES = Maps.newHashMap(); private static final Map<ResourceLocation, SurfaceRules.RuleSource> SURFACE_RULES = Maps.newHashMap();
private static final Set<NoiseGeneratorSettings> NOISE_GENERATOR_SETTINGS = new HashSet<>(); private static final Set<NoiseGeneratorSettings> NOISE_GENERATOR_SETTINGS = new HashSet<>();
private static final Set<ResourceLocation> MODIFIED_BIOMES = Sets.newHashSet();
public static final BCLBiome NETHER_WASTES_BIOME = registerNetherBiome(getFromRegistry(Biomes.NETHER_WASTES)); public static final BCLBiome NETHER_WASTES_BIOME = registerNetherBiome(getFromRegistry(Biomes.NETHER_WASTES));
public static final BCLBiome CRIMSON_FOREST_BIOME = registerNetherBiome(getFromRegistry(Biomes.CRIMSON_FOREST)); public static final BCLBiome CRIMSON_FOREST_BIOME = registerNetherBiome(getFromRegistry(Biomes.CRIMSON_FOREST));
@ -374,9 +373,9 @@ public class BiomeAPI {
*/ */
@Nullable @Nullable
public static ResourceKey getBiomeKey(Biome biome) { public static ResourceKey getBiomeKey(Biome biome) {
return BuiltinRegistries.BIOME.getResourceKey(biome) return BuiltinRegistries.BIOME
.orElseGet(() -> biomeRegistry != null ? biomeRegistry.getResourceKey(biome) .getResourceKey(biome)
.orElse(null) : null); .orElseGet(() -> biomeRegistry != null ? biomeRegistry.getResourceKey(biome).orElse(null) : null);
} }
/** /**
@ -539,19 +538,9 @@ public class BiomeAPI {
private static void applyModificationsToBiome(List<BiConsumer<ResourceLocation, Biome>> modifications, Biome biome) { private static void applyModificationsToBiome(List<BiConsumer<ResourceLocation, Biome>> modifications, Biome biome) {
ResourceLocation biomeID = getBiomeID(biome); ResourceLocation biomeID = getBiomeID(biome);
boolean modify = isDatapackBiome(biomeID);
if (biome != BuiltinRegistries.BIOME.get(biomeID)) {
modify = true;
}
else if (!modify && !MODIFIED_BIOMES.contains(biomeID)) {
MODIFIED_BIOMES.add(biomeID);
modify = true;
}
if (modify) {
modifications.forEach(consumer -> { modifications.forEach(consumer -> {
consumer.accept(biomeID, biome); consumer.accept(biomeID, biome);
}); });
}
final BCLBiome bclBiome = BiomeAPI.getBiome(biome); final BCLBiome bclBiome = BiomeAPI.getBiome(biome);
if (bclBiome != null) { if (bclBiome != null) {
@ -597,7 +586,6 @@ public class BiomeAPI {
rules.add(rule); rules.add(rule);
} }
}); });
return rules; return rules;
} }