Skip to content
This repository was archived by the owner on Sep 19, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ group = project.maven_group

repositories {
mavenCentral()
mavenLocal() // only used to build the mod locally
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove when not building locally

maven { url 'https://masa.dy.fi/maven' }
maven { url 'https://jitpack.io' }
}
Expand All @@ -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
Expand Down
11 changes: 5 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -293,7 +292,7 @@ private SuggestionWindow(int x, int y, int width, List<AdvancedSuggestion> 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;
Expand All @@ -305,18 +304,18 @@ 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;
if (moreBelow) {
// 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());
}
Expand All @@ -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());
Expand All @@ -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()
Expand All @@ -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());
Expand All @@ -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);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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) {}
}
6 changes: 3 additions & 3 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down