Biome modification fix
This commit is contained in:
parent
9622fd393c
commit
63946e049d
3 changed files with 6 additions and 67 deletions
|
@ -11,7 +11,7 @@ loader_version= 0.12.12
|
|||
fabric_version = 0.44.0+1.18
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.2.0
|
||||
mod_version = 1.2.1
|
||||
maven_group = ru.bclib
|
||||
archives_base_name = bclib
|
||||
|
||||
|
|
|
@ -154,16 +154,6 @@ public class BiomeAPI {
|
|||
if (biomeRegistry != BiomeAPI.biomeRegistry) {
|
||||
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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -193,33 +183,6 @@ public class BiomeAPI {
|
|||
NOISE_GENERATOR_SETTINGS.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Registered by {@link #initRegistry(Registry)} as a callback for whenever a new Biome was
|
||||
* added to our registry
|
||||
* @param biome The {@link Biome} that got added
|
||||
*/
|
||||
private static void onAddedBiome(Biome biome) {
|
||||
boolean didChange = false;
|
||||
//BCLib.LOGGER.info(" ++++ " + getBiomeID(biome) + ", " + getBiomeKey(biome) + ", " + biome);
|
||||
for (var dim : MODIFICATIONS.keySet()) {
|
||||
List<BiConsumer<ResourceLocation, Biome>> modifications = MODIFICATIONS.get(dim);
|
||||
if (modifications == null) {
|
||||
sortBiomeFeatures(biome);
|
||||
continue;
|
||||
}
|
||||
|
||||
didChange=true;
|
||||
applyModificationsToBiome(modifications, biome);
|
||||
}
|
||||
|
||||
// if (didChange) {
|
||||
// worldSources.stream()
|
||||
// .filter(s -> s.possibleBiomes()
|
||||
// .contains(biome))
|
||||
// .forEach(s -> ((BiomeSourceAccessor) s).bclRebuildFeatures());
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* Register {@link BCLBiome} instance and its {@link Biome} if necessary.
|
||||
* @param biome {@link BCLBiome}
|
||||
|
@ -612,7 +575,8 @@ public class BiomeAPI {
|
|||
}
|
||||
|
||||
private static List<SurfaceRules.RuleSource> getRuleSources(Set<Biome> biomes) {
|
||||
Set<ResourceLocation> biomeIDs = biomes.stream()
|
||||
Set<ResourceLocation> biomeIDs = biomes
|
||||
.stream()
|
||||
.map(biome -> getBiomeID(biome))
|
||||
.collect(Collectors.toSet());
|
||||
return getRuleSourcesFromIDs(biomeIDs);
|
||||
|
@ -634,29 +598,6 @@ public class BiomeAPI {
|
|||
}
|
||||
});
|
||||
|
||||
// Try handle biomes from other dimension, may work not as expected
|
||||
// Will not work
|
||||
/*Optional<Biome> optional = biomes
|
||||
.stream()
|
||||
.filter(biome -> biome.getBiomeCategory() != BiomeCategory.THEEND && biome.getBiomeCategory() != BiomeCategory.NETHER)
|
||||
.findAny();
|
||||
if (optional.isPresent()) {
|
||||
rules.add(SurfaceRuleData.overworld());
|
||||
}
|
||||
|
||||
if (dimensionType == Level.NETHER) {
|
||||
optional = biomes.stream().filter(biome -> biome.getBiomeCategory() != BiomeCategory.THEEND).findAny();
|
||||
if (optional.isPresent()) {
|
||||
rules.add(SurfaceRuleData.end());
|
||||
}
|
||||
}
|
||||
else if (dimensionType == Level.END) {
|
||||
optional = biomes.stream().filter(biome -> biome.getBiomeCategory() != BiomeCategory.NETHER).findAny();
|
||||
if (optional.isPresent()) {
|
||||
rules.add(SurfaceRuleData.end());
|
||||
}
|
||||
}*/
|
||||
|
||||
return rules;
|
||||
}
|
||||
|
||||
|
@ -702,8 +643,7 @@ public class BiomeAPI {
|
|||
/**
|
||||
* For internal use only!
|
||||
*
|
||||
* Adds new features to existing biome. Called from {@link BCLBiome#setFeatures(Map)} when the Biome is
|
||||
* first built, and from {@link #onAddedBiome(Biome)} whenever a Biome is readded through a Datapack
|
||||
* Adds new features to existing biome. Called from {@link BCLBiome#setFeatures(Map)} when the Biome is first built
|
||||
* @param biome {@link Biome} to add features in.
|
||||
* @param featureMap Map of {@link ConfiguredFeature} to add.
|
||||
*/
|
||||
|
|
|
@ -37,7 +37,6 @@ public abstract class ServerLevelMixin extends Level {
|
|||
ServerLevel level = ServerLevel.class.cast(this);
|
||||
LifeCycleAPI._runLevelLoad(level, server, executor, levelStorageAccess, serverLevelData, resourceKey, dimensionType, chunkProgressListener, chunkGenerator, bl, l, list, bl2);
|
||||
|
||||
//BiomeAPI.initRegistry(server);
|
||||
BiomeAPI.applyModifications(ServerLevel.class.cast(this));
|
||||
|
||||
if (level.dimension() == Level.NETHER) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue