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
7 changes: 4 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,18 @@ if (file("extra.properties").exists()) {
repositories {
mavenCentral()
maven { url 'https://masa.dy.fi/maven' }
maven { url 'https://maven.terraformersmc.com/releases/' }
maven { url 'https://maven.terraformersmc.com/releases/' }
maven { url 'https://jitpack.io' }
maven { url 'https://maven.wispforest.io' }
}

dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
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}"
modCompileOnly "com.terraformersmc:modmenu:5.0.1"
modImplementation "fi.dy.masa.malilib:malilib-fabric-1.20.2:${project.malilib_version}"
modCompileOnly "com.terraformersmc:modmenu:${project.modmenu_version}"

implementation "com.github.DarkKronicle.Konstruct:addons:${project.konstruct_version}"
implementation "com.github.DarkKronicle.Konstruct:core:${project.konstruct_version}"
Expand Down
11 changes: 6 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
org.gradle.jvmargs=-Xmx1G

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.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.5.10
maven_group=io.github.darkkronicle
archives_base_name=AdvancedChatCore

malilib_version=0.15.2
malilib_version=0.17.0
konstruct_version=2.0.3-build1
mxparser_version=4.4.2
owo_version=2.0.0
modmenu_version=7.1.0

# Uploading data
curseforge_slug=advancedchatcore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import io.github.darkkronicle.advancedchatcore.util.RowList;
import lombok.Getter;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.hud.ChatHud;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil;
Expand Down Expand Up @@ -99,7 +100,11 @@ private Color getColor() {
}

public void resetCurrentMessage() {
this.messageHistorySize = this.client.inGameHud.getChatHud().getMessageHistory().size();
try {
this.messageHistorySize = this.client.inGameHud.getChatHud().getMessageHistory().size(); //dont ask
} catch (Exception e) {
e.printStackTrace();
}
}

@Override
Expand Down Expand Up @@ -282,26 +287,27 @@ public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
return false;
}

public boolean mouseScrolled(double mouseX, double mouseY, double amount) {
if (amount > 1.0D) {
amount = 1.0D;
@Override
public boolean mouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount) {
if (verticalAmount > 1.0D) {
verticalAmount = 1.0D;
}

if (amount < -1.0D) {
amount = -1.0D;
if (verticalAmount < -1.0D) {
verticalAmount = -1.0D;
}

for (AdvancedChatScreenSection section : sections) {
if (section.mouseScrolled(mouseX, mouseY, amount)) {
if (section.mouseScrolled(mouseX, mouseY, verticalAmount)) {
return true;
}
}
if (!hasShiftDown()) {
amount *= 7.0D;
verticalAmount *= 7.0D;
}

// Send to hud to scroll
client.inGameHud.getChatHud().scroll((int) amount);
client.inGameHud.getChatHud().scroll((int) verticalAmount);
return true;
}

Expand Down Expand Up @@ -380,18 +386,19 @@ public void setChatFromHistory(int i) {
}

@Override
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) {
ChatHud hud = client.inGameHud.getChatHud();
this.setFocused(this.chatField);
this.chatField.setFocused(true);
this.chatField.render(matrixStack, mouseX, mouseY, partialTicks);
super.render(matrixStack, mouseX, mouseY, partialTicks);
this.chatField.render(context, mouseX, mouseY, partialTicks);
super.render(context, mouseX, mouseY, partialTicks);
for (AdvancedChatScreenSection section : sections) {
section.render(matrixStack, mouseX, mouseY, partialTicks);
section.render(context, mouseX, mouseY, partialTicks);
}
Style style = hud.getTextStyleAt(mouseX, mouseY);
if (style != null && style.getHoverEvent() != null) {
this.renderTextHoverEffect(matrixStack, style, mouseX, mouseY);
context.drawHoverEvent(textRenderer, style, mouseX, mouseY);
//this.renderTextHoverEffect(context, style, mouseX, mouseY);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import io.github.darkkronicle.advancedchatcore.util.TextBuilder;
import io.github.darkkronicle.advancedchatcore.util.TextUtil;
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.screen.narration.NarrationMessageBuilder;
import net.minecraft.client.gui.widget.TextFieldWidget;
Expand Down Expand Up @@ -75,7 +75,7 @@ public AdvancedTextField(
updateRender();
}

@Override
//@Override
public void tick() {
focusedTicks++;
}
Expand Down Expand Up @@ -152,8 +152,9 @@ public boolean mouseClicked(double mouseX, double mouseY, int button) {
return super.mouseClicked(mouseX, mouseY, button);
}


@Override
public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float delta) {
public void renderWidget(DrawContext context, int mouseX, int mouseY, float delta) {
int color = 0xE0E0E0;
int cursor = getCursor();
int cursorRow = renderLines.size() - 1;
Expand All @@ -176,14 +177,14 @@ public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float del
}
int x = getX();
int y = getY() ;
fill(matrices, getX() - 2, renderY - 2, getX() + width + 4, getY() + height + 4, ConfigStorage.ChatScreen.COLOR.config.get().color());
context.fill(getX() - 2, renderY - 2, getX() + width + 4, getY() + height + 4, ConfigStorage.ChatScreen.COLOR.config.get().color());
for (int line = 0; line < renderLines.size(); line++) {
Text text = renderLines.get(line);
if (cursor >= charCount && cursor < text.getString().length() + charCount) {
cursorX = textRenderer.getWidth(text.getString().substring(0, cursor - charCount));
cursorRow = line;
}
endX = textRenderer.drawWithShadow(matrices, text, x, renderY, color);
endX = context.drawTextWithShadow(textRenderer, text, x, renderY, color);
if (selection) {
if (!started && selStart >= charCount && selStart <= text.getString().length() + charCount) {
started = true;
Expand Down Expand Up @@ -215,14 +216,14 @@ public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float del
}
boolean cursorAtEnd = getCursor() == getText().length();
if (!cursorAtEnd && this.suggestion != null) {
this.textRenderer.drawWithShadow(matrices, this.suggestion, endX - 1, y, -8355712);
context.drawTextWithShadow(textRenderer, this.suggestion, endX - 1, y, -8355712);
}
if (renderCursor) {
int cursorY = y - (renderLines.size() - 1 - cursorRow) * (textRenderer.fontHeight + 2);
if (cursorAtEnd) {
DrawableHelper.fill(matrices, cursorX, cursorY - 1, cursorX + 1, cursorY + 1 + this.textRenderer.fontHeight, -3092272);
context.fill(cursorX, cursorY - 1, cursorX + 1, cursorY + 1 + this.textRenderer.fontHeight, -3092272);
} else {
this.textRenderer.drawWithShadow(matrices, "_", x + cursorX, cursorY, color);
context.drawTextWithShadow(textRenderer, "_", x + cursorX, cursorY, color);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,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.gui.screen.ChatInputSuggestor;
import net.minecraft.client.util.math.MatrixStack;

Expand All @@ -36,8 +37,8 @@ public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
}

@Override
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
this.commandSuggestor.render(matrixStack, mouseX, mouseY);
public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) {
this.commandSuggestor.render(context, mouseX, mouseY);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ public class MessageOwner {
* @return Identifier with texture data
*/
public Identifier getTexture() {
return entry.getSkinTexture();
return entry.getSkinTextures().texture();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import io.github.darkkronicle.advancedchatcore.util.Colors;
import java.util.Optional;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.util.math.MatrixStack;

public class WidgetColor extends GuiTextFieldGeneric {
Expand All @@ -30,8 +31,8 @@ public WidgetColor(
}

@Override
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
super.render(matrixStack, mouseX, mouseY, partialTicks);
public void renderWidget(DrawContext context, int mouseX, int mouseY, float delta) {
super.renderWidget(context, mouseX, mouseY, delta);
int y = this.y;
RenderUtils.drawRect(this.colorX, y, 19, 19, 0xFFFFFFFF);
RenderUtils.drawRect(this.colorX + 1, y + 1, 17, 17, 0xFF000000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import fi.dy.masa.malilib.render.RenderUtils;
import java.util.Arrays;
import java.util.List;

import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.util.math.MatrixStack;

public class WidgetLabelHoverable extends WidgetLabel {
Expand All @@ -33,8 +35,8 @@ public void setHoverLines(String... hoverLines) {

@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 (hoverLines == null) {
return;
Expand All @@ -44,7 +46,7 @@ public void postRenderHovered(
&& mouseX < this.x + this.width
&& mouseY >= this.y
&& mouseY <= this.y + this.height) {
RenderUtils.drawHoverText(mouseX, mouseY, this.hoverLines, matrixStack);
RenderUtils.drawHoverText(mouseX, mouseY, this.hoverLines, context);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.List;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.math.MatrixStack;

Expand Down Expand Up @@ -75,7 +76,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
Expand Down Expand Up @@ -107,20 +108,20 @@ 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();

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 (hoverLines == null) {
return;
Expand All @@ -129,7 +130,7 @@ public void postRenderHovered(
&& 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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,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;

/** A simple button */
Expand Down Expand Up @@ -46,7 +47,7 @@ public CleanButton(int x, int y, int width, int height, Color baseColor, String
}

@Override
public void render(int mouseX, int mouseY, boolean selected, MatrixStack matrixStack) {
public void render(int mouseX, int mouseY, boolean selected, DrawContext context) {
int relMX = mouseX - x;
int relMY = mouseY - y;
hovered = relMX >= 0 && relMX <= width && relMY >= 0 && relMY <= height;
Expand All @@ -60,6 +61,6 @@ public void render(int mouseX, int mouseY, boolean selected, MatrixStack matrixS
(y + (height / 2) - 3),
Colors.getInstance().getColorOrWhite("white").color(),
displayString,
matrixStack);
context);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.text.Text;

import java.util.LinkedHashMap;
Expand Down Expand Up @@ -88,23 +87,23 @@ protected boolean onMouseClickedImpl(int mouseX, int mouseY, int mouseButton) {
}

@Override
public void render(int mouseX, int mouseY, boolean selected, MatrixStack matrixStack) {
drawRect(matrixStack, x, y, width, height, background.color());
public void render(int mouseX, int mouseY, boolean selected, DrawContext context) {
drawRect(context, x, y, width, height, background.color());
int rX = x + 2;
int rY = y + 2;
hoveredEntry = null;
for (Text option : options.keySet()) {
if (mouseX >= x && mouseX <= x + width && mouseY >= rY - 2 && mouseY < rY + fontHeight + 1) {
hoveredEntry = option;
drawRect(matrixStack, rX - 2, rY - 2, width, textRenderer.fontHeight + 2, hover.color());
drawRect(context, rX - 2, rY - 2, width, textRenderer.fontHeight + 2, hover.color());
}
textRenderer.drawWithShadow(matrixStack, option, rX, rY, -1);
context.drawTextWithShadow(textRenderer, option, rX, rY, -1);
rY += textRenderer.fontHeight + 2;
}
}

private static void drawRect(MatrixStack stack, int x, int y, int width, int height, int color) {
DrawableHelper.fill(stack, x, y, x + width, y + height, color);
private static void drawRect(DrawContext context, int x, int y, int width, int height, int color) {
context.fill(x, y, x + width, y + height, color);
}

public interface ContextConsumer {
Expand Down
Loading