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: 5 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,20 @@ if (file("extra.properties").exists()) {

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' }
}

dependencies {
implementation 'org.projectlombok:lombok:1.18.28'
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.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
}


Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
minecraft_version=1.19
yarn_mappings=1.19+build.4
loader_version=0.14.8
fabric_api_version=0.57.0+1.19
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 Properties
mod_version=1.2.3
maven_group=io.github.darkkronicle
archives_base_name=AdvancedChatLog
malilib_version=0.13.0
malilib_version=0.17.0
org.gradle.jvmargs=-Xmx1G
advancedchat_version=1.5.2-build1
Original file line number Diff line number Diff line change
Expand Up @@ -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;
import net.minecraft.text.Style;
import net.minecraft.text.Text;
Expand Down Expand Up @@ -120,7 +121,9 @@ public void initGui() {
12,
textRenderer,
(textFieldRunnable -> {
client.player.sendChatMessage(textFieldRunnable.getText());
if (client.player != null) {
client.player.sendMessage(Text.of(textFieldRunnable.getText()));
}
textFieldRunnable.setText("");
})
);
Expand Down Expand Up @@ -244,20 +247,21 @@ private void updateScroll() {
}

@Override
public boolean onMouseScrolled(int mouseX, int mouseY, double mouseWheelDelta) {
if (super.onMouseScrolled(mouseX, mouseY, mouseWheelDelta)) {
public boolean onMouseScrolled(int mouseX, int mouseY, double horizontalAmount, double verticalAmount) {
if (super.onMouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount)) {
return true;
}
// Update the scroll variables
scrollEnd = currentScroll + mouseWheelDelta * 10 * ChatLogConfigStorage.General.SCROLL_MULTIPLIER.config.getDoubleValue();
scrollEnd = currentScroll + verticalAmount * 10 * ChatLogConfigStorage.General.SCROLL_MULTIPLIER.config.getDoubleValue();
scrollStart = currentScroll;
lastScrollTime = Util.getMeasuringTimeMs();
return true;

}

@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);
updateScroll();
int height = client.getWindow().getScaledHeight();
int width = client.getWindow().getScaledWidth();
Expand All @@ -281,26 +285,25 @@ public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partia
break;
}
ChatMessage.AdvancedChatLine line = renderLines.get(i);
textRenderer.drawWithShadow(
matrixStack,
context.drawTextWithShadow(
textRenderer,
line.getText(),
10,
height - y - 40 - fontHeight,
Colors.getInstance().getColorOrWhite("white").color());
y += lineHeight;
}
ScissorUtil.resetScissor();
drawCenteredText(
matrixStack,
context.drawCenteredTextWithShadow(
textRenderer,
(scrollLine + 1) + "/" + renderLines.size(),
width / 2,
height - 28,
Colors.getInstance().getColorOrWhite("white").color()
);
renderTextHoverEffect(matrixStack, getHoverStyle(mouseX, mouseY), mouseX, mouseY);
context.drawHoverEvent(textRenderer, getHoverStyle(mouseX, mouseY), mouseX, mouseY);
if (menu != null) {
menu.render(mouseX, mouseY, true, matrixStack);
menu.render(mouseX, mouseY, true, context);
}
}

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

@Environment(EnvType.CLIENT)
Expand All @@ -39,4 +40,9 @@ public void initGui() {
)
);
}

@Override
public void render(DrawContext context, int mouseX, int mouseY, float delta) {

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ public LogChatMessage load(JsonObject obj) {
LocalDateTime dateTime = LocalDateTime.from(formatter.parse(obj.get("time").getAsString()));
LocalDate date = dateTime.toLocalDate();
LocalTime time = dateTime.toLocalTime();
Text display = Text.Serializer.fromJson(obj.get("display"));
Text original = Text.Serializer.fromJson(obj.get("original"));

Text display = Text.Serialization.fromJson(obj.get("display").getAsString());
Text original = Text.Serialization.fromJson(obj.get("original").getAsString());
int stacks = obj.get("stacks").getAsByte();
ChatMessage message =
ChatMessage.builder()
Expand All @@ -72,8 +73,8 @@ public JsonObject save(LogChatMessage message) {
LocalDateTime dateTime = LocalDateTime.of(message.getDate(), chat.getTime());
json.addProperty("time", formatter.format(dateTime));
json.addProperty("stacks", chat.getStacks());
json.add("display", Text.Serializer.toJsonTree(transfer(chat.getDisplayText())));
json.add("original", Text.Serializer.toJsonTree(transfer(chat.getOriginalText())));
json.add("display", Text.Serialization.toJsonTree(transfer(chat.getDisplayText())));
json.add("original", Text.Serialization.toJsonTree(transfer(chat.getOriginalText())));
return json;
}
}
8 changes: 4 additions & 4 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
"advancedchatlog.mixins.json"
],
"depends": {
"fabricloader": ">=0.8.9+build.204",
"fabricloader": ">=0.14.18",
"fabric": "*",
"minecraft": ">=1.17.0",
"malilib": ">=0.13.0",
"advancedchatcore": ">=1.4.0-1.18"
"minecraft": ">=1.20.0",
"malilib": ">=0.16.0",
"advancedchatcore": ">=1.5.10-1.19"
},
"custom": {
"acmodule": true,
Expand Down