Skip to content

Commit

Permalink
Remove PlatformUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
dima-dencep committed Jan 13, 2024
1 parent c962bb2 commit 4f5f67d
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 55 deletions.
11 changes: 0 additions & 11 deletions common/src/main/java/io/github/kosmx/bendylib/PlatformUtils.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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");
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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");
}
}
}
Expand Down

This file was deleted.

0 comments on commit 4f5f67d

Please sign in to comment.