diff --git a/common/src/main/java/io/github/kosmx/bendylib/PlatformUtils.java b/common/src/main/java/io/github/kosmx/bendylib/PlatformUtils.java deleted file mode 100644 index 8eff58e..0000000 --- a/common/src/main/java/io/github/kosmx/bendylib/PlatformUtils.java +++ /dev/null @@ -1,11 +0,0 @@ -package io.github.kosmx.bendylib; - -import dev.architectury.injectables.annotations.ExpectPlatform; - -public class PlatformUtils { - - @ExpectPlatform - public static boolean isSkinLayersPresent() { - throw new AssertionError(); - } -} diff --git a/common/src/main/java/io/github/kosmx/bendylib/compat/tr7zw/TDSkinCompat.java b/common/src/main/java/io/github/kosmx/bendylib/compat/tr7zw/TDSkinCompat.java index 42f4fda..e71b7df 100644 --- a/common/src/main/java/io/github/kosmx/bendylib/compat/tr7zw/TDSkinCompat.java +++ b/common/src/main/java/io/github/kosmx/bendylib/compat/tr7zw/TDSkinCompat.java @@ -17,9 +17,7 @@ import java.util.function.Consumer; public class TDSkinCompat { - public static void init(Logger logger) throws ClassNotFoundException, NoClassDefFoundError { - logger.info("Initializing 3D Skin Layers compatibility"); - + public static void init() throws ClassNotFoundException, NoClassDefFoundError { SkinLayersAPI.setupMeshTransformerProvider(modelPart -> { var sourceCuboidOptional = ModelPartAccessor.optionalGetCuboid(modelPart, 0); if (sourceCuboidOptional.isPresent() diff --git a/fabric/src/main/java/io/github/kosmx/bendylib/fabric/Init.java b/fabric/src/main/java/io/github/kosmx/bendylib/fabric/Init.java index c7b41de..f8fbe7a 100644 --- a/fabric/src/main/java/io/github/kosmx/bendylib/fabric/Init.java +++ b/fabric/src/main/java/io/github/kosmx/bendylib/fabric/Init.java @@ -1,8 +1,8 @@ package io.github.kosmx.bendylib.fabric; -import io.github.kosmx.bendylib.PlatformUtils; import io.github.kosmx.bendylib.compat.tr7zw.TDSkinCompat; import net.fabricmc.api.ClientModInitializer; +import net.fabricmc.loader.api.FabricLoader; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -11,9 +11,11 @@ public class Init implements ClientModInitializer { @Override public void onInitializeClient() { - if (PlatformUtils.isSkinLayersPresent()) { + if (FabricLoader.getInstance().isModLoaded("skinlayers")) { + LOGGER.info("Initializing 3D Skin Layers compatibility"); + try { - TDSkinCompat.init(LOGGER); + TDSkinCompat.init(); } catch(NoClassDefFoundError|ClassNotFoundException e) { LOGGER.error("Failed to initialize 3D Skin Layers compatibility"); } diff --git a/fabric/src/main/java/io/github/kosmx/bendylib/fabric/PlatformUtilsImpl.java b/fabric/src/main/java/io/github/kosmx/bendylib/fabric/PlatformUtilsImpl.java deleted file mode 100644 index 7b1c26f..0000000 --- a/fabric/src/main/java/io/github/kosmx/bendylib/fabric/PlatformUtilsImpl.java +++ /dev/null @@ -1,10 +0,0 @@ -package io.github.kosmx.bendylib.fabric; - -import net.fabricmc.loader.api.FabricLoader; - -public class PlatformUtilsImpl { - - public static boolean isSkinLayersPresent() { - return FabricLoader.getInstance().isModLoaded("skinlayers"); - } -} diff --git a/forge/src/main/java/io/github/kosmx/bendylib/neoforge/ForgeModInterface.java b/forge/src/main/java/io/github/kosmx/bendylib/neoforge/ForgeModInterface.java index c08fc6b..282efdf 100644 --- a/forge/src/main/java/io/github/kosmx/bendylib/neoforge/ForgeModInterface.java +++ b/forge/src/main/java/io/github/kosmx/bendylib/neoforge/ForgeModInterface.java @@ -1,37 +1,29 @@ package io.github.kosmx.bendylib.neoforge; -import io.github.kosmx.bendylib.PlatformUtils; import io.github.kosmx.bendylib.compat.tr7zw.TDSkinCompat; -import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.ModList; import net.neoforged.fml.common.Mod; -import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent; import net.neoforged.fml.loading.FMLLoader; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @Mod("bendylib") public class ForgeModInterface { - public static Logger LOGGER = LoggerFactory.getLogger("bendy-lib"); + public ForgeModInterface() { if (!FMLLoader.getDist().isClient()) { - System.out.println("[bendy-lib] You're loading a client-only mod on server-side"); - System.out.println("[bendy-lib] Most likely it won't be a problem"); + LOGGER.warn("You're loading a client-only mod on server-side"); + LOGGER.warn("Most likely it won't be a problem"); } - } - @Mod.EventBusSubscriber(modid = "bendylib", bus = Mod.EventBusSubscriber.Bus.MOD) - public static class ClientModEvents - { - @SubscribeEvent - public static void onClientSetup(FMLClientSetupEvent event) - { - if (PlatformUtils.isSkinLayersPresent()) { - try { - TDSkinCompat.init(LOGGER); - } catch(NoClassDefFoundError|ClassNotFoundException e) { - LOGGER.error("Failed to initialize 3D Skin Layers compatibility"); - } + if (ModList.get().isLoaded("skinlayers3d")) { + LOGGER.info("Initializing 3D Skin Layers compatibility"); + + try { + TDSkinCompat.init(); + } catch(NoClassDefFoundError|ClassNotFoundException e) { + LOGGER.error("Failed to initialize 3D Skin Layers compatibility"); } } } diff --git a/forge/src/main/java/io/github/kosmx/bendylib/neoforge/PlatformUtilsImpl.java b/forge/src/main/java/io/github/kosmx/bendylib/neoforge/PlatformUtilsImpl.java deleted file mode 100644 index 13b2b07..0000000 --- a/forge/src/main/java/io/github/kosmx/bendylib/neoforge/PlatformUtilsImpl.java +++ /dev/null @@ -1,9 +0,0 @@ -package io.github.kosmx.bendylib.neoforge; - -import net.neoforged.fml.ModList; - -public class PlatformUtilsImpl { - public static boolean isSkinLayersPresent() { - return ModList.get().isLoaded("skinlayers3d"); - } -}