better error message when injecting tags

This commit is contained in:
dfsek 2022-05-25 12:02:15 -07:00
parent 7a59aeb80c
commit b82e84d447

View File

@ -116,17 +116,26 @@ public final class FabricUtil {
map.put(pair.getFirst(), new ArrayList<>(pair.getSecond().stream().toList())), map.put(pair.getFirst(), new ArrayList<>(pair.getSecond().stream().toList())),
HashMap::putAll); HashMap::putAll);
TERRA_BIOME_MAP.forEach((vb, terraBiomes) -> { TERRA_BIOME_MAP.forEach((vb, terraBiomes) -> getEntry(registry, vb)
RegistryEntry<net.minecraft.world.biome.Biome> vanilla = getEntry(registry, vb).orElseThrow(); .ifPresentOrElse(vanilla -> terraBiomes.forEach(tb -> getEntry(registry, tb)
terraBiomes.forEach(tb -> { .ifPresentOrElse(
RegistryEntry<net.minecraft.world.biome.Biome> terra = getEntry(registry, tb).orElseThrow(); terra -> {
logger.debug(vanilla.getKey().orElseThrow().getValue() + " (vanilla for " + terra.getKey().orElseThrow().getValue() + ": " + logger.debug(vanilla.getKey().orElseThrow().getValue() + " (vanilla for " +
terra.getKey().orElseThrow().getValue() + ": " +
vanilla.streamTags().toList()); vanilla.streamTags().toList());
vanilla.streamTags() vanilla.streamTags()
.forEach(tag -> collect.computeIfAbsent(tag, t -> new ArrayList<>()) .forEach(
.add(getEntry(registry, terra.getKey().orElseThrow().getValue()).orElseThrow())); tag -> collect
}); .computeIfAbsent(tag, t -> new ArrayList<>())
}); .add(getEntry(registry,
terra.getKey()
.orElseThrow()
.getValue()).orElseThrow()));
},
() -> logger.error("No such biome: {}", tb))),
() -> logger.error("No vanilla biome: {}", vb)));
registry.clearTags(); registry.clearTags();
registry.populateTags(ImmutableMap.copyOf(collect)); registry.populateTags(ImmutableMap.copyOf(collect));
@ -153,7 +162,8 @@ public final class FabricUtil {
.waterFogColor(Objects.requireNonNullElse(vanillaBiomeProperties.getWaterFogColor(), vanilla.getWaterFogColor())) .waterFogColor(Objects.requireNonNullElse(vanillaBiomeProperties.getWaterFogColor(), vanilla.getWaterFogColor()))
.fogColor(Objects.requireNonNullElse(vanillaBiomeProperties.getFogColor(), vanilla.getFogColor())) .fogColor(Objects.requireNonNullElse(vanillaBiomeProperties.getFogColor(), vanilla.getFogColor()))
.skyColor(Objects.requireNonNullElse(vanillaBiomeProperties.getSkyColor(), vanilla.getSkyColor())) .skyColor(Objects.requireNonNullElse(vanillaBiomeProperties.getSkyColor(), vanilla.getSkyColor()))
.grassColorModifier(Objects.requireNonNullElse(vanillaBiomeProperties.getModifier(), vanilla.getEffects().getGrassColorModifier())); .grassColorModifier(
Objects.requireNonNullElse(vanillaBiomeProperties.getModifier(), vanilla.getEffects().getGrassColorModifier()));
if(vanillaBiomeProperties.getGrassColor() == null) { if(vanillaBiomeProperties.getGrassColor() == null) {