Make sure features are applied to the correct biomes
This commit is contained in:
parent
67d835b59b
commit
43f6d72dda
1 changed files with 33 additions and 19 deletions
|
@ -140,8 +140,34 @@ public class BiomeAPI {
|
||||||
* @param biomeRegistry - {@link Registry} for {@link Biome}.
|
* @param biomeRegistry - {@link Registry} for {@link Biome}.
|
||||||
*/
|
*/
|
||||||
public static void initRegistry(Registry<Biome> biomeRegistry) {
|
public static void initRegistry(Registry<Biome> biomeRegistry) {
|
||||||
BiomeAPI.biomeRegistry = biomeRegistry;
|
if (biomeRegistry != BiomeAPI.biomeRegistry) {
|
||||||
CLIENT.clear();
|
BiomeAPI.biomeRegistry = biomeRegistry;
|
||||||
|
CLIENT.clear();
|
||||||
|
|
||||||
|
for (var entry : biomeRegistry.entrySet()){
|
||||||
|
onAddedBiome(entry.getValue());
|
||||||
|
}
|
||||||
|
RegistryEntryAddedCallback
|
||||||
|
.event(biomeRegistry)
|
||||||
|
.register((rawId, id, biome)->{
|
||||||
|
|
||||||
|
BCLib.LOGGER.info(" #### " + rawId + ", " + biome + ", " + id);
|
||||||
|
|
||||||
|
onAddedBiome(biome);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void onAddedBiome(Biome biome) {
|
||||||
|
for (var dim : MODIFICATIONS.keySet()) {
|
||||||
|
List<BiConsumer<ResourceLocation, Biome>> modifications = MODIFICATIONS.get(dim);
|
||||||
|
if (modifications == null) {
|
||||||
|
sortBiomeFeatures(biome);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
applyModifications(modifications, biome);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -821,6 +847,10 @@ public class BiomeAPI {
|
||||||
DynamicRegistrySetupCallback.EVENT.register(registryManager -> {
|
DynamicRegistrySetupCallback.EVENT.register(registryManager -> {
|
||||||
Optional<? extends Registry<NoiseGeneratorSettings>> oGeneratorRegistry = registryManager.registry(Registry.NOISE_GENERATOR_SETTINGS_REGISTRY);
|
Optional<? extends Registry<NoiseGeneratorSettings>> oGeneratorRegistry = registryManager.registry(Registry.NOISE_GENERATOR_SETTINGS_REGISTRY);
|
||||||
Optional<? extends Registry<Biome>> oBiomeRegistry = registryManager.registry(Registry.BIOME_REGISTRY);
|
Optional<? extends Registry<Biome>> oBiomeRegistry = registryManager.registry(Registry.BIOME_REGISTRY);
|
||||||
|
if (oBiomeRegistry.isPresent()){
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (oGeneratorRegistry.isPresent()) {
|
if (oGeneratorRegistry.isPresent()) {
|
||||||
RegistryEntryAddedCallback
|
RegistryEntryAddedCallback
|
||||||
|
@ -841,23 +871,7 @@ public class BiomeAPI {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oBiomeRegistry.isPresent()){
|
|
||||||
RegistryEntryAddedCallback
|
|
||||||
.event(oBiomeRegistry.get())
|
|
||||||
.register((rawId, id, biome)->{
|
|
||||||
//BCLib.LOGGER.info(" #### " + rawId + ", " + biome + ", " + id);
|
|
||||||
|
|
||||||
for (var dim : MODIFICATIONS.keySet()) {
|
|
||||||
List<BiConsumer<ResourceLocation, Biome>> modifications = MODIFICATIONS.get(dim);
|
|
||||||
if (modifications == null) {
|
|
||||||
sortBiomeFeatures(biome);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
applyModifications(modifications, biome);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue