diff --git a/build.gradle b/build.gradle index ef1aaf8..f47f413 100644 --- a/build.gradle +++ b/build.gradle @@ -15,6 +15,7 @@ group = project.maven_group 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.0:${project.malilib_version}" - modImplementation "com.github.DarkKronicle:AdvancedChatCore:${project.advancedchat_version}" + modImplementation "fi.dy.masa.malilib:malilib-fabric-1.20.2:${project.malilib_version}" + //modImplementation "com.github.DarkKronicle:AdvancedChatCore:${project.advancedchat_version}" + modImplementation "io.github.darkkronicle:AdvancedChatCore:1.20.4-1.5.10" // only used to build the mod locally implementation "org.languagetool:language-en:5.5" // Transitive diff --git a/gradle.properties b/gradle.properties index ebfa475..77a1ea2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,13 +1,12 @@ -minecraft_version=1.19.2 -yarn_mappings=1.19.2+build.1 -loader_version=0.14.9 -fabric_api_version=0.59.0+1.19.2 - +minecraft_version=1.20.4 +yarn_mappings=1.20.4+build.3 +loader_version=0.15.3 +fabric_api_version=0.92.0+1.20.4 mod_version=1.1.6 maven_group=io.github.darkkronicle archives_base_name=AdvancedChatBox -malilib_version = 0.13.0 +malilib_version = 0.17.0 advancedchat_version=1.5.7 mxparser_version=4.4.2 org.gradle.jvmargs=-Xmx3g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 diff --git a/src/main/java/io/github/darkkronicle/advancedchatbox/chat/ChatBoxSection.java b/src/main/java/io/github/darkkronicle/advancedchatbox/chat/ChatBoxSection.java index c1e5a2f..991be48 100644 --- a/src/main/java/io/github/darkkronicle/advancedchatbox/chat/ChatBoxSection.java +++ b/src/main/java/io/github/darkkronicle/advancedchatbox/chat/ChatBoxSection.java @@ -13,6 +13,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) @@ -35,8 +36,8 @@ public boolean keyPressed(int keyCode, int scanCode, int modifiers) { } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { - this.suggestor.render(matrixStack, mouseX, mouseY); + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { + this.suggestor.render(context, mouseX, mouseY); } @Override diff --git a/src/main/java/io/github/darkkronicle/advancedchatbox/chat/ChatSuggestorGui.java b/src/main/java/io/github/darkkronicle/advancedchatbox/chat/ChatSuggestorGui.java index c0c612a..81bb174 100644 --- a/src/main/java/io/github/darkkronicle/advancedchatbox/chat/ChatSuggestorGui.java +++ b/src/main/java/io/github/darkkronicle/advancedchatbox/chat/ChatSuggestorGui.java @@ -28,11 +28,10 @@ import net.fabricmc.api.Environment; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.TextFieldWidget; import net.minecraft.client.resource.language.I18n; -import net.minecraft.client.util.NarratorManager; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.Rect2i; import net.minecraft.command.CommandSource; @@ -245,19 +244,19 @@ private static String getSuggestionSuffix(String original, String suggestion) { return suggestion.startsWith(original) ? suggestion.substring(original.length()) : null; } - public void render(MatrixStack matrices, int mouseX, int mouseY) { + public void render(DrawContext context, int mouseX, int mouseY) { if (this.window != null) { - this.window.render(matrices, mouseX, mouseY); + this.window.render(context, mouseX, mouseY); } else { int i = 0; for (OrderedText message : this.messages) { i++; int j = this.chatScreenSized ? this.owner.height - 14 - 13 - 12 * i : 72 + 12 * i; - DrawableHelper.fill(matrices, this.x - 1, j, this.x + this.width + 1, j + 12, + context.fill(this.x - 1, j, this.x + this.width + 1, j + 12, ChatBoxConfigStorage.General.BACKGROUND_COLOR.config.get().color()); if (message != null) { - this.textRenderer.drawWithShadow(matrices, message, (float) this.x, (float) (j + 2), -1); + context.drawTextWithShadow(textRenderer, message, this.x, j + 2, -1); } } } @@ -293,7 +292,7 @@ private SuggestionWindow(int x, int y, int width, List list, this.select(0); } - public void render(MatrixStack matrices, int mouseX, int mouseY) { + public void render(DrawContext context, int mouseX, int mouseY) { int suggestionSize = Math.min(this.suggestions.size(), ChatSuggestorGui.this.maxSuggestionSize); boolean moreBelow = this.inWindowIndex > 0; boolean moreAbove = this.suggestions.size() > this.inWindowIndex + suggestionSize; @@ -305,10 +304,10 @@ public void render(MatrixStack matrices, int mouseX, int mouseY) { if (more) { // Draw lines to signify that there is more - DrawableHelper.fill(matrices, this.area.getX(), this.area.getY() - 1, + context.fill(this.area.getX(), this.area.getY() - 1, this.area.getX() + this.area.getWidth(), this.area.getY(), ChatBoxConfigStorage.General.BACKGROUND_COLOR.config.get().color()); - DrawableHelper.fill(matrices, this.area.getX(), this.area.getY() + this.area.getHeight(), + context.fill(this.area.getX(), this.area.getY() + this.area.getHeight(), this.area.getX() + this.area.getWidth(), this.area.getY() + this.area.getHeight() + 1, ChatBoxConfigStorage.General.BACKGROUND_COLOR.config.get().color()); int x; @@ -316,7 +315,7 @@ public void render(MatrixStack matrices, int mouseX, int mouseY) { // Dotted for (x = 0; x < this.area.getWidth(); ++x) { if (x % 2 == 0) { - DrawableHelper.fill(matrices, this.area.getX() + x, this.area.getY() - 1, + context.fill(this.area.getX() + x, this.area.getY() - 1, this.area.getX() + x + 1, this.area.getY(), Colors.getInstance().getColorOrWhite("white").color()); } @@ -327,7 +326,7 @@ public void render(MatrixStack matrices, int mouseX, int mouseY) { // Dotted for (x = 0; x < this.area.getWidth(); ++x) { if (x % 2 == 0) { - DrawableHelper.fill(matrices, this.area.getX() + x, + context.fill(this.area.getX() + x, this.area.getY() + this.area.getHeight(), this.area.getX() + x + 1, this.area.getY() + this.area.getHeight() + 1, Colors.getInstance().getColorOrWhite("white").color()); @@ -340,7 +339,7 @@ public void render(MatrixStack matrices, int mouseX, int mouseY) { for (int s = 0; s < suggestionSize; ++s) { AdvancedSuggestion suggestion = this.suggestions.get(s + this.inWindowIndex); - DrawableHelper.fill(matrices, this.area.getX(), this.area.getY() + 12 * s, + context.fill(this.area.getX(), this.area.getY() + 12 * s, this.area.getX() + this.area.getWidth(), this.area.getY() + 12 * s + 12, ChatBoxConfigStorage.General.BACKGROUND_COLOR.config.get().color()); if (mouseX > this.area.getX() && mouseX < this.area.getX() + this.area.getWidth() @@ -351,9 +350,8 @@ public void render(MatrixStack matrices, int mouseX, int mouseY) { hover = true; } - - ChatSuggestorGui.this.textRenderer.drawWithShadow(matrices, suggestion.getRender(), - (float) (this.area.getX() + 1), (float) (this.area.getY() + 2 + 12 * s), + context.drawTextWithShadow(ChatSuggestorGui.this.textRenderer, suggestion.getRender(), + (this.area.getX() + 1), (this.area.getY() + 2 + 12 * s), (s + this.inWindowIndex) == this.selection ? ChatBoxConfigStorage.General.HIGHLIGHT_COLOR.config.get().color() : ChatBoxConfigStorage.General.UNHIGHLIGHT_COLOR.config.get().color()); @@ -362,7 +360,7 @@ public void render(MatrixStack matrices, int mouseX, int mouseY) { if (hover) { Message message = this.suggestions.get(this.selection).getTooltip(); if (message != null) { - ChatSuggestorGui.this.owner.renderTooltip(matrices, Texts.toText(message), mouseX, mouseY); + context.drawTooltip(textRenderer, Texts.toText(message), mouseX, mouseY); } } } diff --git a/src/main/java/io/github/darkkronicle/advancedchatbox/suggester/gui/ShortcutEntryListWidget.java b/src/main/java/io/github/darkkronicle/advancedchatbox/suggester/gui/ShortcutEntryListWidget.java index f17ce34..cbdbd04 100644 --- a/src/main/java/io/github/darkkronicle/advancedchatbox/suggester/gui/ShortcutEntryListWidget.java +++ b/src/main/java/io/github/darkkronicle/advancedchatbox/suggester/gui/ShortcutEntryListWidget.java @@ -21,6 +21,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) @@ -94,5 +95,5 @@ protected int addButton(int x, int y, String translation, IButtonActionListener } @Override - public void renderEntry(int mouseX, int mouseY, boolean selected, MatrixStack matrixStack) {} + public void renderEntry(int mouseX, int mouseY, boolean selected, DrawContext context) {} } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 7b5e081..4c27ef3 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -21,10 +21,10 @@ ] }, "depends": { - "fabricloader": ">=0.8.9+build.204", + "fabricloader": ">=0.14.18", "fabric": "*", - "minecraft": ">=1.19", - "malilib": ">=0.13.0", + "minecraft": ">=1.20", + "malilib": ">=0.16.0", "advancedchatcore": ">=1.5.0-1.19" }, "custom": {