From 4d9f7a87b934fbbf4fa64f02607c26eafe455307 Mon Sep 17 00:00:00 2001 From: medisant Date: Thu, 22 Jun 2023 16:06:27 +0200 Subject: [PATCH] update to 1.20 --- build.gradle | 6 ++++-- gradle.properties | 10 +++++----- .../config/gui/GuiAdvancedFilterDisabled.java | 8 ++++---- .../config/gui/GuiFilterEditor.java | 7 ++++--- .../config/gui/WidgetAdvancedFilterEntry.java | 19 ++++++++++--------- .../config/gui/WidgetFilterEntry.java | 19 ++++++++++--------- .../config/gui/WidgetListAdvancedFilters.java | 6 ++++-- .../config/gui/WidgetListFilters.java | 6 ++++-- src/main/resources/fabric.mod.json | 6 +++--- 9 files changed, 48 insertions(+), 39 deletions(-) diff --git a/build.gradle b/build.gradle index 60598db..5a60d67 100644 --- a/build.gradle +++ b/build.gradle @@ -15,6 +15,7 @@ apply from: 'https://raw.githubusercontent.com/DarkKronicle/GradleScripts/main/g repositories { mavenCentral() + mavenLocal() // only used to build the mod locally maven { url 'https://masa.dy.fi/maven' } maven { url 'https://jitpack.io' } } @@ -24,8 +25,9 @@ dependencies { mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}" - modImplementation "fi.dy.masa.malilib:malilib-fabric-1.19.4:${project.malilib_version}" - modImplementation "com.github.DarkKronicle:AdvancedChatCore:${project.advancedchat_version}" + modImplementation "fi.dy.masa.malilib:malilib-fabric-1.20.1:${project.malilib_version}" + //modImplementation "com.github.DarkKronicle:AdvancedChatCore:${project.advancedchat_version}" + modImplementation "io.github.darkkronicle:AdvancedChatCore:1.20.1-1.5.10" // only used to build the mod locally implementation 'org.openjdk.nashorn:nashorn-core:15.3' implementation 'org.javadelight:delight-nashorn-sandbox:0.2.5' diff --git a/gradle.properties b/gradle.properties index f92a853..7aabd4a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,13 +1,13 @@ -minecraft_version=1.19.4 -yarn_mappings=1.19.4+build.1 -loader_version=0.14.18 -fabric_api_version=0.76.0+1.19.4 +minecraft_version=1.20.1 +yarn_mappings=1.20.1+build.5 +loader_version=0.14.21 +fabric_api_version=0.84.0+1.20.1 mod_version=1.2.8 maven_group=io.github.darkkronicle archives_base_name=AdvancedChatFilters -malilib_version = 0.15.2 +malilib_version = 0.16.0 org.gradle.jvmargs=-Xmx1G advancedchat_version=v1.5.10 owo_version=2.0.0 diff --git a/src/main/java/io/github/darkkronicle/advancedchatfilters/config/gui/GuiAdvancedFilterDisabled.java b/src/main/java/io/github/darkkronicle/advancedchatfilters/config/gui/GuiAdvancedFilterDisabled.java index f9951f9..e523e3a 100644 --- a/src/main/java/io/github/darkkronicle/advancedchatfilters/config/gui/GuiAdvancedFilterDisabled.java +++ b/src/main/java/io/github/darkkronicle/advancedchatfilters/config/gui/GuiAdvancedFilterDisabled.java @@ -17,6 +17,7 @@ import java.util.ArrayList; import java.util.List; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.MutableText; @@ -60,13 +61,12 @@ public void back() { } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { - super.render(matrixStack, mouseX, mouseY, partialTicks); + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { + super.render(context, mouseX, mouseY, partialTicks); int width = client.getWindow().getScaledWidth(); int y = 100; for (OrderedText warn : warning) { - drawCenteredTextWithShadow( - matrixStack, + context.drawCenteredTextWithShadow( client.textRenderer, warn, width / 2, diff --git a/src/main/java/io/github/darkkronicle/advancedchatfilters/config/gui/GuiFilterEditor.java b/src/main/java/io/github/darkkronicle/advancedchatfilters/config/gui/GuiFilterEditor.java index d14f0a2..51bf12d 100644 --- a/src/main/java/io/github/darkkronicle/advancedchatfilters/config/gui/GuiFilterEditor.java +++ b/src/main/java/io/github/darkkronicle/advancedchatfilters/config/gui/GuiFilterEditor.java @@ -29,6 +29,7 @@ import io.github.darkkronicle.advancedchatfilters.filters.ParentFilter; import io.github.darkkronicle.advancedchatfilters.filters.ReplaceFilter; import io.github.darkkronicle.advancedchatfilters.registry.MatchReplaceRegistry; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.MutableText; @@ -78,13 +79,13 @@ protected void closeGui(boolean showParent) { } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { - super.render(matrixStack, mouseX, mouseY, partialTicks); + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { + super.render(context, mouseX, mouseY, partialTicks); int y = test.getY() + 20; int x = 10; for (Text t : outputMessage) { if (t != null) { - textRenderer.drawWithShadow(matrixStack, t, x, y, -1); + context.drawTextWithShadow(textRenderer, t, x, y, -1); } y += textRenderer.fontHeight + 2; } diff --git a/src/main/java/io/github/darkkronicle/advancedchatfilters/config/gui/WidgetAdvancedFilterEntry.java b/src/main/java/io/github/darkkronicle/advancedchatfilters/config/gui/WidgetAdvancedFilterEntry.java index b7a21e2..50bb169 100644 --- a/src/main/java/io/github/darkkronicle/advancedchatfilters/config/gui/WidgetAdvancedFilterEntry.java +++ b/src/main/java/io/github/darkkronicle/advancedchatfilters/config/gui/WidgetAdvancedFilterEntry.java @@ -31,6 +31,7 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.util.math.MatrixStack; @Environment(EnvType.CLIENT) @@ -121,7 +122,7 @@ private ButtonOnOff addOnOffButton( } @Override - public void render(int mouseX, int mouseY, boolean selected, MatrixStack matrixStack) { + public void render(int mouseX, int mouseY, boolean selected, DrawContext context) { RenderUtils.color(1f, 1f, 1f, 1f); // Draw a lighter background for the hovered and the selected entry @@ -153,14 +154,14 @@ public void render(int mouseX, int mouseY, boolean selected, MatrixStack matrixS this.y + 7, Colors.getInstance().getColorOrWhite("white").color(), name, - matrixStack); + context); RenderUtils.color(1f, 1f, 1f, 1f); RenderSystem.disableBlend(); - this.drawTextFields(mouseX, mouseY, matrixStack); + this.drawTextFields(mouseX, mouseY, context); - super.render(mouseX, mouseY, selected, matrixStack); + super.render(mouseX, mouseY, selected, context); RenderUtils.disableDiffuseLighting(); } @@ -257,16 +258,16 @@ protected boolean onMouseClickedImpl(int mouseX, int mouseY, int mouseButton) { return ret; } - protected void drawTextFields(int mouseX, int mouseY, MatrixStack matrixStack) { + protected void drawTextFields(int mouseX, int mouseY, DrawContext context) { if (this.num != null) { - this.num.getTextField().render(matrixStack, mouseX, mouseY, 0f); + this.num.getTextField().render(context, mouseX, mouseY, 0f); } } @Override public void postRenderHovered( - int mouseX, int mouseY, boolean selected, MatrixStack matrixStack) { - super.postRenderHovered(mouseX, mouseY, selected, matrixStack); + int mouseX, int mouseY, boolean selected, DrawContext context) { + super.postRenderHovered(mouseX, mouseY, selected, context); List hoverLines; @@ -285,7 +286,7 @@ public void postRenderHovered( && mouseX < this.buttonStartX && mouseY >= this.y && mouseY <= this.y + this.height) { - RenderUtils.drawHoverText(mouseX, mouseY, hoverLines, matrixStack); + RenderUtils.drawHoverText(mouseX, mouseY, hoverLines, context); } } } diff --git a/src/main/java/io/github/darkkronicle/advancedchatfilters/config/gui/WidgetFilterEntry.java b/src/main/java/io/github/darkkronicle/advancedchatfilters/config/gui/WidgetFilterEntry.java index 950b4cc..9d631e5 100644 --- a/src/main/java/io/github/darkkronicle/advancedchatfilters/config/gui/WidgetFilterEntry.java +++ b/src/main/java/io/github/darkkronicle/advancedchatfilters/config/gui/WidgetFilterEntry.java @@ -31,6 +31,7 @@ import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.util.math.MatrixStack; /* @@ -130,7 +131,7 @@ private int addOnOffButton(int xRight, int y, ButtonListener.Type type, boolean } @Override - public void render(int mouseX, int mouseY, boolean selected, MatrixStack matrixStack) { + public void render(int mouseX, int mouseY, boolean selected, DrawContext context) { RenderUtils.color(1f, 1f, 1f, 1f); // Draw a lighter background for the hovered and the selected entry @@ -162,28 +163,28 @@ public void render(int mouseX, int mouseY, boolean selected, MatrixStack matrixS this.y + 7, Colors.getInstance().getColorOrWhite("white").color(), name, - matrixStack); + context); RenderUtils.color(1f, 1f, 1f, 1f); RenderSystem.disableBlend(); - this.drawTextFields(mouseX, mouseY, matrixStack); + this.drawTextFields(mouseX, mouseY, context); - super.render(mouseX, mouseY, selected, matrixStack); + super.render(mouseX, mouseY, selected, context); RenderUtils.disableDiffuseLighting(); } @Override public void postRenderHovered( - int mouseX, int mouseY, boolean selected, MatrixStack matrixStack) { - super.postRenderHovered(mouseX, mouseY, selected, matrixStack); + int mouseX, int mouseY, boolean selected, DrawContext context) { + super.postRenderHovered(mouseX, mouseY, selected, context); if (mouseX >= this.x && mouseX < this.buttonStartX && mouseY >= this.y && mouseY <= this.y + this.height) { - RenderUtils.drawHoverText(mouseX, mouseY, this.hoverLines, matrixStack); + RenderUtils.drawHoverText(mouseX, mouseY, this.hoverLines, context); } } @@ -291,9 +292,9 @@ protected boolean onMouseClickedImpl(int mouseX, int mouseY, int mouseButton) { return ret; } - protected void drawTextFields(int mouseX, int mouseY, MatrixStack matrixStack) { + protected void drawTextFields(int mouseX, int mouseY, DrawContext context) { if (this.num != null) { - this.num.getTextField().render(matrixStack, mouseX, mouseY, 0f); + this.num.getTextField().render(context, mouseX, mouseY, 0f); } } } diff --git a/src/main/java/io/github/darkkronicle/advancedchatfilters/config/gui/WidgetListAdvancedFilters.java b/src/main/java/io/github/darkkronicle/advancedchatfilters/config/gui/WidgetListAdvancedFilters.java index 4046dac..f25439c 100644 --- a/src/main/java/io/github/darkkronicle/advancedchatfilters/config/gui/WidgetListAdvancedFilters.java +++ b/src/main/java/io/github/darkkronicle/advancedchatfilters/config/gui/WidgetListAdvancedFilters.java @@ -16,6 +16,8 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; + +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.util.math.MatrixStack; @@ -48,8 +50,8 @@ public void addTextField(TextFieldWrapper text) { } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { - super.render(matrixStack, mouseX, mouseY, partialTicks); + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { + super.render(context, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/io/github/darkkronicle/advancedchatfilters/config/gui/WidgetListFilters.java b/src/main/java/io/github/darkkronicle/advancedchatfilters/config/gui/WidgetListFilters.java index 43f280e..7a6697f 100644 --- a/src/main/java/io/github/darkkronicle/advancedchatfilters/config/gui/WidgetListFilters.java +++ b/src/main/java/io/github/darkkronicle/advancedchatfilters/config/gui/WidgetListFilters.java @@ -16,6 +16,8 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; + +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.util.math.MatrixStack; @@ -50,8 +52,8 @@ public void addTextField(TextFieldWrapper text) { } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { - super.render(matrixStack, mouseX, mouseY, partialTicks); + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { + super.render(context, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 2aa458f..a17f1ab 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -22,9 +22,9 @@ "depends": { "fabricloader": ">=0.14.18", "fabric": "*", - "minecraft": ">=1.19.4", - "malilib": ">=0.15.2", - "advancedchatcore": ">=1.5.10-1.18" + "minecraft": ">=1.20", + "malilib": ">=0.16.0", + "advancedchatcore": ">=1.5.10-1.19" }, "custom": { "acmodule": true,