Modmenu not required
This commit is contained in:
@@ -0,0 +1,27 @@
|
|||||||
|
package me.cortex.voxy.client.config;
|
||||||
|
|
||||||
|
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
|
||||||
|
import com.terraformersmc.modmenu.api.ModMenuApi;
|
||||||
|
import me.cortex.voxy.common.Logger;
|
||||||
|
import net.caffeinemc.mods.sodium.client.gui.SodiumOptionsGUI;
|
||||||
|
|
||||||
|
public class ModMenuIntegration implements ModMenuApi {
|
||||||
|
@Override
|
||||||
|
public ConfigScreenFactory<?> getModConfigScreenFactory() {
|
||||||
|
return parent -> {
|
||||||
|
var screen = (SodiumOptionsGUI) SodiumOptionsGUI.createScreen(parent);
|
||||||
|
//Sorry jelly and douira, please dont hurt me
|
||||||
|
try {
|
||||||
|
//We cant use .setPage() as that invokes rebuildGui, however the screen hasnt been initalized yet
|
||||||
|
// causing things to crash
|
||||||
|
var field = SodiumOptionsGUI.class.getDeclaredField("currentPage");
|
||||||
|
field.setAccessible(true);
|
||||||
|
field.set(screen, VoxyConfigScreenPages.voxyOptionPage);
|
||||||
|
field.setAccessible(false);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.error("Failed to set the current page to voxy", e);
|
||||||
|
}
|
||||||
|
return screen;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,27 +21,10 @@ import net.minecraft.text.Text;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class VoxyConfigScreenPages implements ModMenuApi {
|
public abstract class VoxyConfigScreenPages {
|
||||||
public static OptionPage voxyOptionPage = null;
|
private VoxyConfigScreenPages(){}
|
||||||
|
|
||||||
@Override
|
public static OptionPage voxyOptionPage = null;
|
||||||
public ConfigScreenFactory<?> getModConfigScreenFactory() {
|
|
||||||
return parent -> {
|
|
||||||
var screen = (SodiumOptionsGUI)SodiumOptionsGUI.createScreen(parent);
|
|
||||||
//Sorry jelly and douira, please dont hurt me
|
|
||||||
try {
|
|
||||||
//We cant use .setPage() as that invokes rebuildGui, however the screen hasnt been initalized yet
|
|
||||||
// causing things to crash
|
|
||||||
var field = SodiumOptionsGUI.class.getDeclaredField("currentPage");
|
|
||||||
field.setAccessible(true);
|
|
||||||
field.set(screen, voxyOptionPage);
|
|
||||||
field.setAccessible(false);
|
|
||||||
} catch (Exception e) {
|
|
||||||
Logger.error("Failed to set the current page to voxy", e);
|
|
||||||
}
|
|
||||||
return screen;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public static OptionPage page() {
|
public static OptionPage page() {
|
||||||
List<OptionGroup> groups = new ArrayList<>();
|
List<OptionGroup> groups = new ArrayList<>();
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
"me.cortex.voxy.client.VoxyClient"
|
"me.cortex.voxy.client.VoxyClient"
|
||||||
],
|
],
|
||||||
"modmenu": [
|
"modmenu": [
|
||||||
"me.cortex.voxy.client.config.VoxyConfigScreenPages"
|
"me.cortex.voxy.client.config.ModMenuIntegration"
|
||||||
],
|
],
|
||||||
"main": [
|
"main": [
|
||||||
"me.cortex.voxy.commonImpl.VoxyCommon"
|
"me.cortex.voxy.commonImpl.VoxyCommon"
|
||||||
|
|||||||
Reference in New Issue
Block a user