aboutsummaryrefslogtreecommitdiff
path: root/src/testmod/java/dev/isxander
diff options
context:
space:
mode:
Diffstat (limited to 'src/testmod/java/dev/isxander')
-rw-r--r--src/testmod/java/dev/isxander/yacl/test/GuiTest.java (renamed from src/testmod/java/dev/isxander/yacl/test/ModMenuIntegration.java)34
-rw-r--r--src/testmod/java/dev/isxander/yacl/test/mixins/TitleScreenMixin.java26
2 files changed, 33 insertions, 27 deletions
diff --git a/src/testmod/java/dev/isxander/yacl/test/ModMenuIntegration.java b/src/testmod/java/dev/isxander/yacl/test/GuiTest.java
index 596a0bf..449a081 100644
--- a/src/testmod/java/dev/isxander/yacl/test/ModMenuIntegration.java
+++ b/src/testmod/java/dev/isxander/yacl/test/GuiTest.java
@@ -1,7 +1,5 @@
package dev.isxander.yacl.test;
-import com.terraformersmc.modmenu.api.ConfigScreenFactory;
-import com.terraformersmc.modmenu.api.ModMenuApi;
import dev.isxander.yacl.api.*;
import dev.isxander.yacl.gui.RequireRestartScreen;
import dev.isxander.yacl.gui.controllers.*;
@@ -23,10 +21,9 @@ import net.minecraft.text.Text;
import java.awt.*;
-public class ModMenuIntegration implements ModMenuApi {
- @Override
- public ConfigScreenFactory<?> getModConfigScreenFactory() {
- return (parent) -> Entrypoint.getConfig().buildConfig((config, builder) -> builder
+public class GuiTest {
+ public static Screen getModConfigScreenFactory(Screen parent) {
+ return Entrypoint.getConfig().buildConfig((config, builder) -> builder
.title(Text.of("Test Suites"))
.category(ConfigCategory.createBuilder()
.name(Text.of("Suites"))
@@ -55,7 +52,7 @@ public class ModMenuIntegration implements ModMenuApi {
.generateScreen(parent);
}
- private Screen getFullTestSuite(Screen parent) {
+ private static Screen getFullTestSuite(Screen parent) {
return Entrypoint.getConfig().buildConfig((config, builder) -> builder
.title(Text.of("Test GUI"))
.category(ConfigCategory.createBuilder()
@@ -340,7 +337,7 @@ public class ModMenuIntegration implements ModMenuApi {
.generateScreen(parent);
}
- private Screen getDisabledTest(Screen parent) {
+ private static Screen getDisabledTest(Screen parent) {
return Entrypoint.getConfig().buildConfig((config, builder) -> builder
.title(Text.empty())
.category(ConfigCategory.createBuilder()
@@ -373,7 +370,7 @@ public class ModMenuIntegration implements ModMenuApi {
.generateScreen(parent);
}
- private Screen getWikiBasic(Screen parent) {
+ private static Screen getWikiBasic(Screen parent) {
return Entrypoint.getConfig().buildConfig((config, builder) -> builder
.title(Text.of("Mod Name"))
.category(ConfigCategory.createBuilder()
@@ -394,7 +391,7 @@ public class ModMenuIntegration implements ModMenuApi {
.generateScreen(parent);
}
- private Screen getWikiGroups(Screen parent) {
+ private static Screen getWikiGroups(Screen parent) {
return Entrypoint.getConfig().buildConfig((config, builder) -> builder
.title(Text.of("Mod Name"))
.category(ConfigCategory.createBuilder()
@@ -417,21 +414,4 @@ public class ModMenuIntegration implements ModMenuApi {
)
.generateScreen(parent);
}
-
- private ConfigScreenFactory<?> getWikiButton() {
- return (parent) -> Entrypoint.getConfig().buildConfig((config, builder) -> builder
- .title(Text.of("Mod Name"))
- .category(ConfigCategory.createBuilder()
- .name(Text.of("My Category"))
- .tooltip(Text.of("This displays when you hover over a category button")) // optional
- .option(ButtonOption.createBuilder()
- .name(Text.of("Pressable Button"))
- .tooltip(Text.of("This is so easy!")) // optional
- .action(screen -> {})
- .controller(ActionController::new)
- .build())
- .build())
- )
- .generateScreen(parent);
- }
}
diff --git a/src/testmod/java/dev/isxander/yacl/test/mixins/TitleScreenMixin.java b/src/testmod/java/dev/isxander/yacl/test/mixins/TitleScreenMixin.java
new file mode 100644
index 0000000..b32a392
--- /dev/null
+++ b/src/testmod/java/dev/isxander/yacl/test/mixins/TitleScreenMixin.java
@@ -0,0 +1,26 @@
+package dev.isxander.yacl.test.mixins;
+
+import dev.isxander.yacl.test.GuiTest;
+import net.minecraft.client.gui.screen.Screen;
+import net.minecraft.client.gui.screen.TitleScreen;
+import net.minecraft.client.gui.widget.ButtonWidget;
+import net.minecraft.text.Text;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+@Mixin(TitleScreen.class)
+public abstract class TitleScreenMixin extends Screen {
+ protected TitleScreenMixin(Text title) {
+ super(title);
+ }
+
+ @Inject(method = "init", at = @At("RETURN"))
+ private void injectTestButton(CallbackInfo ci) {
+ addDrawableChild(ButtonWidget.createBuilder(Text.of("YACL"), button -> client.setScreen(GuiTest.getModConfigScreenFactory(client.currentScreen)))
+ .setPosition(0, 0)
+ .setWidth(50)
+ .build());
+ }
+}