Aditional logging for the surface rule registry

This commit is contained in:
Frank 2023-04-16 13:16:48 +02:00
parent 35f62b16af
commit 2c3af98e9e
2 changed files with 9 additions and 1 deletions

View file

@ -21,6 +21,7 @@ public class VanillaRegistriesMixin {
@Inject(method = "<clinit>", at = @At(value = "TAIL"))
private static void together_registerSurface(CallbackInfo ci) {
//this code is only needed for the DataGen procedure...
BUILDER.add(
BCLBiomeRegistry.BCL_BIOMES_REGISTRY,
BCLBiomeRegistry::bootstrap

View file

@ -1,5 +1,7 @@
package org.betterx.worlds.together.surfaceRules;
import org.betterx.bclib.BCLib;
import org.betterx.bclib.config.Configs;
import org.betterx.worlds.together.chunkgenerator.InjectableSurfaceRules;
import org.betterx.worlds.together.world.event.WorldBootstrap;
@ -53,16 +55,18 @@ public class SurfaceRuleUtil {
) {
return mergeSurfaceRules(
org,
source,
getRulesForBiomes(source.possibleBiomes().stream().map(h -> h.value()).toList())
);
}
private static SurfaceRules.RuleSource mergeSurfaceRules(
SurfaceRules.RuleSource org,
BiomeSource source,
List<SurfaceRules.RuleSource> additionalRules
) {
if (additionalRules == null || additionalRules.isEmpty()) return org;
final int count = additionalRules.size();
if (org instanceof SurfaceRules.SequenceRuleSource sequenceRule) {
List<SurfaceRules.RuleSource> existingSequence = sequenceRule.sequence();
additionalRules = additionalRules
@ -76,6 +80,9 @@ public class SurfaceRuleUtil {
additionalRules.add(org);
}
if (Configs.MAIN_CONFIG.verboseLogging()) {
BCLib.LOGGER.info("Merged " + count + " additional Surface Rules for " + source + " => " + additionalRules.size());
}
return new SurfaceRules.SequenceRuleSource(additionalRules);
}