aboutsummaryrefslogtreecommitdiff
path: root/test-common/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'test-common/src/main')
-rw-r--r--test-common/src/main/java/dev/isxander/yacl3/test/mixin/TitleScreenMixin.java25
-rw-r--r--test-common/src/main/resources/yacl-test.mixins.json11
2 files changed, 36 insertions, 0 deletions
diff --git a/test-common/src/main/java/dev/isxander/yacl3/test/mixin/TitleScreenMixin.java b/test-common/src/main/java/dev/isxander/yacl3/test/mixin/TitleScreenMixin.java
new file mode 100644
index 0000000..c3fddbc
--- /dev/null
+++ b/test-common/src/main/java/dev/isxander/yacl3/test/mixin/TitleScreenMixin.java
@@ -0,0 +1,25 @@
+package dev.isxander.yacl3.test.mixin;
+
+import dev.isxander.yacl3.test.GuiTest;
+import net.minecraft.client.gui.components.Button;
+import net.minecraft.client.gui.screens.Screen;
+import net.minecraft.client.gui.screens.TitleScreen;
+import net.minecraft.network.chat.Component;
+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(Component title) {
+ super(title);
+ }
+
+ @Inject(method = "init", at = @At("RETURN"))
+ private void addButton(CallbackInfo ci) {
+ addRenderableWidget(Button.builder(Component.literal("YetAnotherConfigLib Test"), button -> {
+ minecraft.setScreen(GuiTest.getModConfigScreenFactory(minecraft.screen));
+ }).width(150).build());
+ }
+}
diff --git a/test-common/src/main/resources/yacl-test.mixins.json b/test-common/src/main/resources/yacl-test.mixins.json
new file mode 100644
index 0000000..c7f9a71
--- /dev/null
+++ b/test-common/src/main/resources/yacl-test.mixins.json
@@ -0,0 +1,11 @@
+{
+ "required": true,
+ "package": "dev.isxander.yacl3.test.mixin",
+ "compatibilityLevel": "JAVA_17",
+ "injectors": {
+ "defaultRequire": 1
+ },
+ "client": [
+ "TitleScreenMixin"
+ ]
+}