[Change] Allow to run with FAPI 0.86.1 (and up), which fixes the forced registry Paths

This commit is contained in:
Frank 2023-08-02 10:28:48 +02:00
parent e86ea25b60
commit 81a5d630c4
4 changed files with 14 additions and 16 deletions

View file

@ -1,12 +1,9 @@
package org.betterx.bclib.mixin.common;
import org.betterx.bclib.BCLib;
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeRegistry;
import org.betterx.bclib.api.v2.levelgen.biomes.BiomeData;
import org.betterx.worlds.together.WorldsTogether;
import net.minecraft.resources.RegistryDataLoader;
import net.minecraft.resources.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
@ -14,7 +11,6 @@ import org.spongepowered.asm.mixin.gen.Accessor;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.util.ArrayList;
import java.util.List;
@ -38,12 +34,12 @@ public class RegistryDataLoaderMixin {
wt_set_WORLDGEN_REGISTRIES(enhanced);
}
// Fabric force changes the directory path for all modded registries to be prefixed with the mod id.
// We do not want this for our BCL-Biome/Surface Rule Registry, so we remove the prefix here.
@Inject(method = "registryDirPath", at = @At("RETURN"), cancellable = true)
private static void prependDirectoryWithNamespace(ResourceLocation id, CallbackInfoReturnable<String> info) {
if (id.getNamespace().equals(WorldsTogether.MOD_ID) || id.getNamespace().equals(BCLib.MOD_ID)) {
info.setReturnValue(info.getReturnValue());
}
}
// // Fabric force changes the directory path for all modded registries to be prefixed with the mod id.
// // We do not want this for our BCL-Biome/Surface Rule Registry, so we remove the prefix here.
// @Inject(method = "registryDirPath", at = @At("RETURN"), cancellable = true)
// private static void bcl_prependDirectoryWithNamespace(ResourceLocation id, CallbackInfoReturnable<String> info) {
// if (id.getNamespace().equals(WorldsTogether.MOD_ID) || id.getNamespace().equals(BCLib.MOD_ID)) {
// info.setReturnValue(info.getReturnValue());
// }
// }
}