aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.gradle.kts7
-rw-r--r--changelogs/2.0.0.md1
-rw-r--r--gradle.properties2
-rw-r--r--src/main/java/dev/isxander/yacl/gui/AbstractWidget.java2
-rw-r--r--src/main/java/dev/isxander/yacl/gui/CategoryListWidget.java4
-rw-r--r--src/main/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java10
-rw-r--r--src/main/java/dev/isxander/yacl/gui/OptionListWidget.java6
-rw-r--r--src/main/java/dev/isxander/yacl/gui/SearchFieldWidget.java2
-rw-r--r--src/main/java/dev/isxander/yacl/gui/TextScaledButtonWidget.java11
-rw-r--r--src/main/java/dev/isxander/yacl/gui/TooltipButtonWidget.java4
-rw-r--r--src/main/java/dev/isxander/yacl/gui/YACLScreen.java9
-rw-r--r--src/main/java/dev/isxander/yacl/gui/controllers/BooleanController.java2
-rw-r--r--src/main/java/dev/isxander/yacl/gui/controllers/TickBoxController.java2
-rw-r--r--src/main/resources/fabric.mod.json5
-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/config/Entrypoint.java3
-rw-r--r--src/testmod/java/dev/isxander/yacl/test/mixins/TitleScreenMixin.java26
-rw-r--r--src/testmod/resources/fabric.mod.json13
-rw-r--r--src/testmod/resources/yet-another-config-lib.test.mixins.json11
19 files changed, 84 insertions, 70 deletions
diff --git a/build.gradle.kts b/build.gradle.kts
index 6655cbb..491f972 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -16,7 +16,7 @@ plugins {
val ciRun = System.getenv().containsKey("GITHUB_ACTIONS")
group = "dev.isxander"
-version = "1.7.1"
+version = "2.0.0"
if (ciRun)
version = "$version+${grgit.branch.current().name}-SNAPSHOT"
@@ -54,12 +54,9 @@ dependencies {
mappings("net.fabricmc:yarn:$minecraftVersion+build.+:v2")
modImplementation("net.fabricmc:fabric-loader:$fabricLoaderVersion")
- modImplementation(fabricApi.module("fabric-resource-loader-v0", "0.66.0+1.19.2"))
+ modImplementation(fabricApi.module("fabric-resource-loader-v0", "0.67.1+1.19.3"))
"testmodImplementation"(sourceSets.main.get().output)
- "modTestmodImplementation"("com.terraformersmc:modmenu:4.0.6") {
- exclude(module = "fabric-loader")
- }
}
java {
diff --git a/changelogs/2.0.0.md b/changelogs/2.0.0.md
new file mode 100644
index 0000000..832c84c
--- /dev/null
+++ b/changelogs/2.0.0.md
@@ -0,0 +1 @@
+- Update to 1.19.3
diff --git a/gradle.properties b/gradle.properties
index 0f0b15f..841f08b 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,6 +1,6 @@
org.gradle.jvmargs=-Xmx3G
-minecraftVersion=1.19.2
+minecraftVersion=1.19.3-pre1
fabricLoaderVersion=0.14.10
modId=yet-another-config-lib
diff --git a/src/main/java/dev/isxander/yacl/gui/AbstractWidget.java b/src/main/java/dev/isxander/yacl/gui/AbstractWidget.java
index 03dc9b9..bede0ae 100644
--- a/src/main/java/dev/isxander/yacl/gui/AbstractWidget.java
+++ b/src/main/java/dev/isxander/yacl/gui/AbstractWidget.java
@@ -82,7 +82,7 @@ public abstract class AbstractWidget implements Element, Drawable, Selectable {
int width = x2 - x1;
int height = y2 - y1;
- RenderSystem.setShader(GameRenderer::getPositionTexShader);
+ RenderSystem.setShader(GameRenderer::getPositionTexProgram);
RenderSystem.setShaderTexture(0, ClickableWidget.WIDGETS_TEXTURE);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
int i = !enabled ? 0 : hovered ? 2 : 1;
diff --git a/src/main/java/dev/isxander/yacl/gui/CategoryListWidget.java b/src/main/java/dev/isxander/yacl/gui/CategoryListWidget.java
index 2cb6bb6..46a9fdf 100644
--- a/src/main/java/dev/isxander/yacl/gui/CategoryListWidget.java
+++ b/src/main/java/dev/isxander/yacl/gui/CategoryListWidget.java
@@ -15,7 +15,7 @@ public class CategoryListWidget extends ElementListWidget<CategoryListWidget.Cat
private final YACLScreen yaclScreen;
public CategoryListWidget(MinecraftClient client, YACLScreen yaclScreen, int screenWidth, int screenHeight) {
- super(client, screenWidth / 3, yaclScreen.searchFieldWidget.y - 5, 0, yaclScreen.searchFieldWidget.y - 5, 21);
+ super(client, screenWidth / 3, yaclScreen.searchFieldWidget.getY() - 5, 0, yaclScreen.searchFieldWidget.getY() - 5, 21);
this.yaclScreen = yaclScreen;
setRenderBackground(false);
setRenderHorizontalShadows(false);
@@ -75,7 +75,7 @@ public class CategoryListWidget extends ElementListWidget<CategoryListWidget.Cat
mouseY = -20;
}
- categoryButton.y = y;
+ categoryButton.setY(y);
categoryButton.render(matrices, mouseX, mouseY, tickDelta);
}
diff --git a/src/main/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java b/src/main/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java
index 240cfb2..a4d6304 100644
--- a/src/main/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java
+++ b/src/main/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java
@@ -1,6 +1,7 @@
package dev.isxander.yacl.gui;
import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.gui.screen.Tooltip;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
@@ -8,18 +9,19 @@ import net.minecraft.util.math.MathHelper;
public class LowProfileButtonWidget extends ButtonWidget {
public LowProfileButtonWidget(int x, int y, int width, int height, Text message, PressAction onPress) {
- super(x, y, width, height, message, onPress);
+ super(x, y, width, height, message, onPress, ButtonWidget.DEFAULT_NARRATION_SUPPLIER);
}
- public LowProfileButtonWidget(int x, int y, int width, int height, Text message, PressAction onPress, TooltipSupplier tooltipSupplier) {
- super(x, y, width, height, message, onPress, tooltipSupplier);
+ public LowProfileButtonWidget(int x, int y, int width, int height, Text message, PressAction onPress, Tooltip tooltip) {
+ this(x, y, width, height, message, onPress);
+ setTooltip(tooltip);
}
@Override
public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float delta) {
if (!isHovered()) {
int j = this.active ? 0xFFFFFF : 0xA0A0A0;
- drawCenteredText(matrices, MinecraftClient.getInstance().textRenderer, this.getMessage(), this.x + this.width / 2, this.y + (this.height - 8) / 2, j | MathHelper.ceil(this.alpha * 255.0F) << 24);
+ drawCenteredText(matrices, MinecraftClient.getInstance().textRenderer, this.getMessage(), this.getX() + this.width / 2, this.getY() + (this.height - 8) / 2, j | MathHelper.ceil(this.alpha * 255.0F) << 24);
} else {
super.renderButton(matrices, mouseX, mouseY, delta);
}
diff --git a/src/main/java/dev/isxander/yacl/gui/OptionListWidget.java b/src/main/java/dev/isxander/yacl/gui/OptionListWidget.java
index cf50a58..eed3aff 100644
--- a/src/main/java/dev/isxander/yacl/gui/OptionListWidget.java
+++ b/src/main/java/dev/isxander/yacl/gui/OptionListWidget.java
@@ -312,7 +312,7 @@ public class OptionListWidget extends ElementListWidget<OptionListWidget.Entry>
widget.render(matrices, mouseX, mouseY, tickDelta);
if (resetButton != null) {
- resetButton.y = y;
+ resetButton.setY(y);
resetButton.render(matrices, mouseX, mouseY, tickDelta);
}
}
@@ -402,8 +402,8 @@ public class OptionListWidget extends ElementListWidget<OptionListWidget.Entry>
public void render(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
this.y = y;
- expandMinimizeButton.x = x;
- expandMinimizeButton.y = y + entryHeight / 2 - expandMinimizeButton.getHeight() / 2;
+ expandMinimizeButton.setX(x);
+ expandMinimizeButton.setY(y + entryHeight / 2 - expandMinimizeButton.getHeight() / 2);
expandMinimizeButton.render(matrices, mouseX, mouseY, tickDelta);
wrappedName.drawCenterWithShadow(matrices, x + entryWidth / 2, y + getYPadding());
diff --git a/src/main/java/dev/isxander/yacl/gui/SearchFieldWidget.java b/src/main/java/dev/isxander/yacl/gui/SearchFieldWidget.java
index 6184405..5b7c9dc 100644
--- a/src/main/java/dev/isxander/yacl/gui/SearchFieldWidget.java
+++ b/src/main/java/dev/isxander/yacl/gui/SearchFieldWidget.java
@@ -25,7 +25,7 @@ public class SearchFieldWidget extends TextFieldWidget {
public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float delta) {
super.renderButton(matrices, mouseX, mouseY, delta);
if (isVisible() && isEmpty()) {
- textRenderer.drawWithShadow(matrices, emptyText, x + 4, this.y + (this.height - 8) / 2f, 0x707070);
+ textRenderer.drawWithShadow(matrices, emptyText, getX() + 4, this.getY() + (this.height - 8) / 2f, 0x707070);
}
}
diff --git a/src/main/java/dev/isxander/yacl/gui/TextScaledButtonWidget.java b/src/main/java/dev/isxander/yacl/gui/TextScaledButtonWidget.java
index d588d52..197a162 100644
--- a/src/main/java/dev/isxander/yacl/gui/TextScaledButtonWidget.java
+++ b/src/main/java/dev/isxander/yacl/gui/TextScaledButtonWidget.java
@@ -2,6 +2,7 @@ package dev.isxander.yacl.gui;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
+import net.minecraft.client.gui.screen.Tooltip;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.OrderedText;
@@ -12,13 +13,13 @@ public class TextScaledButtonWidget extends ButtonWidget {
public float textScale;
public TextScaledButtonWidget(int x, int y, int width, int height, float textScale, Text message, PressAction onPress) {
- super(x, y, width, height, message, onPress);
+ super(x, y, width, height, message, onPress, ButtonWidget.DEFAULT_NARRATION_SUPPLIER);
this.textScale = textScale;
}
- public TextScaledButtonWidget(int x, int y, int width, int height, float textScale, Text message, PressAction onPress, TooltipSupplier tooltipSupplier) {
- super(x, y, width, height, message, onPress, tooltipSupplier);
- this.textScale = textScale;
+ public TextScaledButtonWidget(int x, int y, int width, int height, float textScale, Text message, PressAction onPress, Tooltip tooltip) {
+ this(x, y, width, height, textScale, message, onPress);
+ setTooltip(tooltip);
}
@Override
@@ -35,7 +36,7 @@ public class TextScaledButtonWidget extends ButtonWidget {
TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
matrices.push();
- matrices.translate(((this.x + this.width / 2f) - textRenderer.getWidth(orderedText) * textScale / 2), (float)this.y + (this.height - 8 * textScale) / 2f / textScale, 0);
+ matrices.translate(((this.getX() + this.width / 2f) - textRenderer.getWidth(orderedText) * textScale / 2), (float)this.getY() + (this.height - 8 * textScale) / 2f / textScale, 0);
matrices.scale(textScale, textScale, 1);
textRenderer.drawWithShadow(matrices, orderedText, 0, 0, j | MathHelper.ceil(this.alpha * 255.0F) << 24);
matrices.pop();
diff --git a/src/main/java/dev/isxander/yacl/gui/TooltipButtonWidget.java b/src/main/java/dev/isxander/yacl/gui/TooltipButtonWidget.java
index d105f7b..706765a 100644
--- a/src/main/java/dev/isxander/yacl/gui/TooltipButtonWidget.java
+++ b/src/main/java/dev/isxander/yacl/gui/TooltipButtonWidget.java
@@ -13,14 +13,14 @@ public class TooltipButtonWidget extends ButtonWidget {
protected MultilineText wrappedDescription;
public TooltipButtonWidget(Screen screen, int x, int y, int width, int height, Text message, Text tooltip, PressAction onPress) {
- super(x, y, width, height, message, onPress);
+ super(x, y, width, height, message, onPress, ButtonWidget.DEFAULT_NARRATION_SUPPLIER);
this.screen = screen;
setTooltip(tooltip);
}
public void renderHoveredTooltip(MatrixStack matrices) {
if (isHovered()) {
- YACLScreen.renderMultilineTooltip(matrices, MinecraftClient.getInstance().textRenderer, wrappedDescription, x + width / 2, y - 4, y + height + 4, screen.width, screen.height);
+ YACLScreen.renderMultilineTooltip(matrices, MinecraftClient.getInstance().textRenderer, wrappedDescription, getX() + width / 2, getY() - 4, getY() + height + 4, screen.width, screen.height);
}
}
diff --git a/src/main/java/dev/isxander/yacl/gui/YACLScreen.java b/src/main/java/dev/isxander/yacl/gui/YACLScreen.java
index 629fd4c..e36c8e8 100644
--- a/src/main/java/dev/isxander/yacl/gui/YACLScreen.java
+++ b/src/main/java/dev/isxander/yacl/gui/YACLScreen.java
@@ -13,8 +13,7 @@ import net.minecraft.client.render.*;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
-import net.minecraft.util.math.MathHelper;
-import net.minecraft.util.math.Matrix4f;
+import org.joml.Matrix4f;
import java.util.HashSet;
import java.util.Set;
@@ -85,7 +84,7 @@ public class YACLScreen extends Screen {
OptionUtils.forEachOptions(config, Option::forgetPendingValue);
});
- searchFieldWidget = new SearchFieldWidget(this, textRenderer, width / 3 / 2 - paddedWidth / 2 + 1, undoButton.y - 22, paddedWidth - 2, 18, Text.translatable("gui.recipebook.search_hint"), Text.translatable("gui.recipebook.search_hint"));
+ searchFieldWidget = new SearchFieldWidget(this, textRenderer, width / 3 / 2 - paddedWidth / 2 + 1, undoButton.getY() - 22, paddedWidth - 2, 18, Text.translatable("gui.recipebook.search_hint"), Text.translatable("gui.recipebook.search_hint"));
categoryList = new CategoryListWidget(client, this, width, height);
addSelectableChild(categoryList);
@@ -241,7 +240,7 @@ public class YACLScreen extends Screen {
matrices.push();
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferBuilder = tessellator.getBuffer();
- RenderSystem.setShader(GameRenderer::getPositionColorShader);
+ RenderSystem.setShader(GameRenderer::getPositionColorProgram);
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
Matrix4f matrix4f = matrices.peek().getPositionMatrix();
fillGradient(matrix4f, bufferBuilder, drawX - 3, drawY - 4, drawX + maxWidth + 3, drawY - 3, 400, -267386864, -267386864);
@@ -257,7 +256,7 @@ public class YACLScreen extends Screen {
RenderSystem.disableTexture();
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
- BufferRenderer.drawWithShader(bufferBuilder.end());
+ BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
RenderSystem.disableBlend();
RenderSystem.enableTexture();
matrices.translate(0.0, 0.0, 400.0);
diff --git a/src/main/java/dev/isxander/yacl/gui/controllers/BooleanController.java b/src/main/java/dev/isxander/yacl/gui/controllers/BooleanController.java
index b7a77dd..7037ff5 100644
--- a/src/main/java/dev/isxander/yacl/gui/controllers/BooleanController.java
+++ b/src/main/java/dev/isxander/yacl/gui/controllers/BooleanController.java
@@ -102,7 +102,7 @@ public class BooleanController implements Controller<Boolean> {
}
public static class BooleanControllerElement extends ControllerWidget<BooleanController> {
- private BooleanControllerElement(BooleanController control, YACLScreen screen, Dimension<Integer> dim) {
+ public BooleanControllerElement(BooleanController control, YACLScreen screen, Dimension<Integer> dim) {
super(control, screen, dim);
}
diff --git a/src/main/java/dev/isxander/yacl/gui/controllers/TickBoxController.java b/src/main/java/dev/isxander/yacl/gui/controllers/TickBoxController.java
index ff693a9..193f5a6 100644
--- a/src/main/java/dev/isxander/yacl/gui/controllers/TickBoxController.java
+++ b/src/main/java/dev/isxander/yacl/gui/controllers/TickBoxController.java
@@ -50,7 +50,7 @@ public class TickBoxController implements Controller<Boolean> {
}
public static class TickBoxControllerElement extends ControllerWidget<TickBoxController> {
- private TickBoxControllerElement(TickBoxController control, YACLScreen screen, Dimension<Integer> dim) {
+ public TickBoxControllerElement(TickBoxController control, YACLScreen screen, Dimension<Integer> dim) {
super(control, screen, dim);
}
diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json
index fc5a14f..234a281 100644
--- a/src/main/resources/fabric.mod.json
+++ b/src/main/resources/fabric.mod.json
@@ -20,8 +20,9 @@
},
"depends": {
"fabricloader": ">=0.14.0",
- "minecraft": "1.19.x",
- "java": ">=17"
+ "minecraft": "~1.19.3-beta.1",
+ "java": ">=17",
+ "fabric-resource-loader-v0": "*"
},
"mixins": [
"yet-another-config-lib.mixins.json"
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/config/Entrypoint.java b/src/testmod/java/dev/isxander/yacl/test/config/Entrypoint.java
index 39baffa..c71f592 100644
--- a/src/testmod/java/dev/isxander/yacl/test/config/Entrypoint.java
+++ b/src/testmod/java/dev/isxander/yacl/test/config/Entrypoint.java
@@ -1,13 +1,12 @@
package dev.isxander.yacl.test.config;
-import com.google.gson.Gson;
import dev.isxander.yacl.config.ConfigInstance;
import dev.isxander.yacl.config.GsonConfigInstance;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.loader.api.FabricLoader;
public class Entrypoint implements ClientModInitializer {
- private static GsonConfigInstance<ConfigData> config;
+ private static ConfigInstance<ConfigData> config;
@Override
public void onInitializeClient() {
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..2635eaf
--- /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.builder(Text.of("YACL"), button -> client.setScreen(GuiTest.getModConfigScreenFactory(client.currentScreen)))
+ .position(0, 0)
+ .width(50)
+ .build());
+ }
+}
diff --git a/src/testmod/resources/fabric.mod.json b/src/testmod/resources/fabric.mod.json
index 1360a5e..5fe0919 100644
--- a/src/testmod/resources/fabric.mod.json
+++ b/src/testmod/resources/fabric.mod.json
@@ -11,15 +11,12 @@
"entrypoints": {
"client": [
"dev.isxander.yacl.test.config.Entrypoint"
- ],
- "modmenu": [
- "dev.isxander.yacl.test.ModMenuIntegration"
]
},
"depends": {
- "fabricloader": ">=0.14.0",
- "minecraft": "1.19.x",
- "java": ">=17",
- "fabric-resource-loader-v0": "*"
- }
+ "yet-another-config-lib": "*"
+ },
+ "mixins": [
+ "yet-another-config-lib.test.mixins.json"
+ ]
}
diff --git a/src/testmod/resources/yet-another-config-lib.test.mixins.json b/src/testmod/resources/yet-another-config-lib.test.mixins.json
new file mode 100644
index 0000000..9287cdd
--- /dev/null
+++ b/src/testmod/resources/yet-another-config-lib.test.mixins.json
@@ -0,0 +1,11 @@
+{
+ "required": true,
+ "package": "dev.isxander.yacl.test.mixins",
+ "compatibilityLevel": "JAVA_17",
+ "injectors": {
+ "defaultRequire": 1
+ },
+ "client": [
+ "TitleScreenMixin"
+ ]
+}