Class CompatModule<T>
java.lang.Object
com.hammy275.immersivemc.common.compat.util.CompatModule<T>
- Type Parameters:
T
- Object type for compatibility module.
- All Implemented Interfaces:
InvocationHandler
Compatibility module to allow us to easily add mod integration that fails gracefully.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends I,
I>
Icreate
(T module, Class<I> interfaceClass, String friendlyName, BiConsumer<ActiveConfig, Boolean> configSetter) Creates a compatibility module.static net.minecraft.network.chat.Component
getErrorMessage
(String friendlyName) static void
handleDisableServer
(String friendlyName, BiConsumer<ActiveConfig, Boolean> configSetter, net.minecraft.server.MinecraftServer server)
-
Method Details
-
create
public static <T extends I,I> I create(T module, Class<I> interfaceClass, String friendlyName, BiConsumer<ActiveConfig, Boolean> configSetter) Creates a compatibility module.- Type Parameters:
T
- Object type for compatibility module.- Parameters:
module
- The module to wrap.interfaceClass
- The interface that module implements.friendlyName
- A name to use for errors.configSetter
- A function that handles config setting to disable the compatibility on an error.- Returns:
- The module wrapped in compatibility.
-
invoke
- Specified by:
invoke
in interfaceInvocationHandler
- Throws:
Throwable
-
handleDisableServer
public static void handleDisableServer(String friendlyName, BiConsumer<ActiveConfig, Boolean> configSetter, net.minecraft.server.MinecraftServer server) -
getErrorMessage
-