Restore some ModMenu API

This commit is contained in:
Frank 2022-10-28 18:31:31 +02:00
parent a071ad5052
commit ac42631843
2 changed files with 18 additions and 12 deletions

View file

@ -1,10 +1,12 @@
package org.betterx.bclib.client.gui.modmenu; package org.betterx.bclib.client.gui.modmenu;
import org.betterx.bclib.integration.modmenu.ModMenuIntegration;
@Deprecated() @Deprecated()
public class EntryPoint /*extends ModMenuIntegration*/ { public class EntryPoint extends ModMenuIntegration {
//public static final Object entrypointObject = createEntrypoint(new EntryPoint()); //public static final Object entrypointObject = createEntrypoint(new EntryPoint());
public EntryPoint() { public EntryPoint() {
//super(MainScreen::new); super(MainScreen::new);
} }
} }

View file

@ -2,6 +2,8 @@ package org.betterx.bclib.integration.modmenu;
import org.betterx.bclib.integration.modmenu.ModMenuIntegration.ModMenuScreenFactory; import org.betterx.bclib.integration.modmenu.ModMenuIntegration.ModMenuScreenFactory;
import net.minecraft.client.gui.screens.Screen;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationHandler;
@ -159,21 +161,23 @@ public abstract class ModMenuIntegration {
* <p> * <p>
* The Interface matches {@code com.terraformersmc.modmenu.api.ConfigScreenFactory} * The Interface matches {@code com.terraformersmc.modmenu.api.ConfigScreenFactory}
*/ */
//@FunctionalInterface @FunctionalInterface
public interface ModMenuScreenFactory /*extends ConfigScreenFactory*/ { public interface ModMenuScreenFactory<S extends Screen>/*extends ConfigScreenFactory*/ {
S create(Screen parent);
} }
record BCLibModMenuInvocationHandler(ModMenuIntegration target) implements InvocationHandler { record BCLibModMenuInvocationHandler(ModMenuIntegration target) implements InvocationHandler {
@Override @Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
return null; /*switch (method.getName()) { // return switch (method.getName()) {
case "getModConfigScreenFactory" -> target.getModConfigScreenFactory(); // case "getModConfigScreenFactory" -> target.getModConfigScreenFactory();
case "getProvidedConfigScreenFactories" -> target.getProvidedConfigScreenFactories(); // case "getProvidedConfigScreenFactories" -> target.getProvidedConfigScreenFactories();
case "toString" -> target.toString(); // case "toString" -> target.toString();
case "equals" -> target.equals(args[0]); // case "equals" -> target.equals(args[0]);
case "hashCode" -> target.hashCode(); // case "hashCode" -> target.hashCode();
default -> null; // default -> null;
};*/ // };
return null;
} }
} }