[Question | Get Help] how can i do own datapack with same result like your mod?
JedynyTakiPsiak opened this issue ยท 0 comments
Hi, I would like to ask how your mod interacts with the files with "firstOctave" that influence biome size generation. I'm trying to understand the code, but without much success. I only know that you retrieve a value from the biomesize.json file, and then it's calculated in the RegistryDataLoaderMixin.class file. However, when I try to do some
thing similar in a datapack, I don't get the same results. Is it because you fetch all the files that have "firstOctave" and then subtract the mod's config value from them, or is it really necessary to have only 2 files: erosion and continentalness?
I'm also trying to understand your code:
@Mixin({ class_7655.class })
public class RegistryDataLoaderMixin
{
@Inject(method = { "loadRegistryContents" }, at = { @At(value = "INVOKE", target = "Lcom/mojang/serialization/Decoder;parse(Lcom/mojang/serialization/DynamicOps;Ljava/lang/Object;)Lcom/mojang/serialization/DataResult;", remap = false) }, locals = LocalCapture.CAPTURE_FAILEXCEPTION)
private static <E> void onLoad(final class_6903.class_7863 registryInfoLookup, final class_3300 resourceManager, final class_5321<? extends class_2378<E>> resourceKey, final class_2385<E> writableRegistry, final Decoder<E> decoder, final Map<class_5321<?>, Exception> map, final CallbackInfo ci, final String string, final class_7654 fileToIdConverter, final class_6903 registryOps, final Iterator var9, final Map.Entry entry, final class_2960 resourceLocation, final class_5321 resourceKey2, final class_3298 resource, final Reader reader, final JsonElement jsonElement) {
if (BiomeSizeMod.adapted.containsKey(resourceLocation) && jsonElement instanceof JsonObject) {
((JsonObject)jsonElement).addProperty("firstOctave", (Number)Math.max(-14, Math.min(-2, ((JsonObject)jsonElement).get("firstOctave").getAsInt() - ((CommonConfiguration)BiomeSizeMod.config.getCommonConfig()).biomeSizeModifier)));
}
}
}```