Skip to content

Commit

Permalink
update to 1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
medisant committed Jun 22, 2023
1 parent fe42cd0 commit 4d9f7a8
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 39 deletions.
6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
}
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.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'
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
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;

@Environment(EnvType.CLIENT)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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<String> hoverLines;

Expand All @@ -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);
}
}
}
Expand Down
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;

/*
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -48,8 +50,8 @@ public void addTextField(TextFieldWrapper<? extends GuiTextFieldGeneric> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -50,8 +52,8 @@ public void addTextField(TextFieldWrapper<? extends GuiTextFieldGeneric> 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
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 4d9f7a8

Please sign in to comment.