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

public class CompatModule<T> extends Object implements InvocationHandler
Compatibility module to allow us to easily add mod integration that fails gracefully.
  • 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

      public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
      Specified by:
      invoke in interface InvocationHandler
      Throws:
      Throwable
    • handleDisableServer

      public static void handleDisableServer(String friendlyName, BiConsumer<ActiveConfig,Boolean> configSetter, net.minecraft.server.MinecraftServer server)
    • getErrorMessage

      public static net.minecraft.network.chat.Component getErrorMessage(String friendlyName)