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

View file

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