From 0c667eaf72fd18913b4b7bb8fed9285b3aab5cc2 Mon Sep 17 00:00:00 2001 From: Connor Slade Date: Tue, 13 Jun 2023 21:18:44 -0400 Subject: [PATCH 1/4] Update mod version --- gradle.properties | 11 +++++------ .../sigmautils/modules/rendering/Zoom.java | 12 ++++++++++++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/gradle.properties b/gradle.properties index 5ec089b..df860f9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,14 +1,13 @@ # Done to increase the memory available to gradle. org.gradle.jvmargs=-Xmx1G - # Fabric Properties -minecraft_version=1.19.4 -yarn_mappings=1.19.4+build.1 -loader_version=0.14.17 +minecraft_version=1.20 +yarn_mappings=1.20+build.1 +loader_version=0.14.21 # Mod Properties mod_version=0.1.3_alpha maven_group=com.connorcode archives_base_name=sigma-utils # Dependencies -fabric_version=0.76.0+1.19.4 -mod_menu_version=6.1.0-rc.4 \ No newline at end of file +fabric_version=0.83.0+1.20 +mod_menu_version=6.1.0-rc.4 diff --git a/src/main/java/com/connorcode/sigmautils/modules/rendering/Zoom.java b/src/main/java/com/connorcode/sigmautils/modules/rendering/Zoom.java index feea693..9abfd1c 100644 --- a/src/main/java/com/connorcode/sigmautils/modules/rendering/Zoom.java +++ b/src/main/java/com/connorcode/sigmautils/modules/rendering/Zoom.java @@ -31,6 +31,10 @@ public class Zoom extends Module { static double zoomModifier = 1; private static long tick = 0; private static long animationStart = 0; +// private final BoolSetting toggle = new BoolSetting(Zoom.class, "Toggle").value(true) +// .description("Makes this module toggle on and off rather than when the keybinding is held down.") +// .build(); + public Zoom() { super("zoom", "Zoom", "Zoom (Fov multiplier)", Category.Rendering); @@ -64,6 +68,14 @@ public void tick() { tick = 0; animationStart = 0; } +// +// System.out.printf("%s, %s, %s, %s\n", !enabled, this.toggle.value(), +// !(Config.moduleSettings.get(this.getClass()).get(1) instanceof KeyBindSetting), +// ((KeyBindSetting) Config.moduleSettings.get(this.getClass()).get(1)).pressed()); +// if (!enabled || this.toggle.value() || +// !(Config.moduleSettings.get(this.getClass()).get(1) instanceof KeyBindSetting keybinding) || +// keybinding.pressed()) return; +// enabled = false; } @Override From a9eb904d9e1d7e4342c79df1c8d3ab274de6176f Mon Sep 17 00:00:00 2001 From: Connor Slade Date: Fri, 16 Jun 2023 13:57:10 -0400 Subject: [PATCH 2/4] Get it to launch --- gradle.properties | 2 +- .../connorcode/sigmautils/commands/Note.java | 8 ++--- .../sigmautils/config/ConfigGui.java | 6 ++-- .../sigmautils/config/ModuleConfigGui.java | 11 +++--- .../config/settings/BoolSetting.java | 2 +- .../config/settings/DynamicListSetting.java | 6 ++-- .../config/settings/KeyBindSetting.java | 4 +-- .../config/settings/NumberSetting.java | 2 +- .../config/settings/SelectorSetting.java | 10 +++--- .../sigmautils/config/settings/Setting.java | 4 +-- .../config/settings/StringSetting.java | 4 +-- .../config/settings/list/SimpleList.java | 12 ++++--- .../sigmautils/misc/Components.java | 31 ++++++++-------- .../sigmautils/misc/util/WorldUtils.java | 2 +- .../sigmautils/mixin/BossBarHudMixin.java | 12 +++---- .../sigmautils/mixin/ChatScreenMixin.java | 2 +- .../mixin/DownloadingTerrainScreenMixin.java | 12 +++---- .../mixin/EntryListWidgetMixin.java | 25 ++++++------- .../sigmautils/mixin/InGameHudMixin.java | 35 ++++++++++--------- .../mixin/InventoryScreenMixin.java | 12 +++---- .../sigmautils/mixin/LogoDrawerMixin.java | 2 +- .../mixin/MultiplayerScreenMixin.java | 8 ++--- .../sigmautils/mixin/ProgressScreenMixin.java | 12 +++---- .../sigmautils/mixin/ScreenAccessor.java | 6 ++-- .../sigmautils/mixin/ScreenMixin.java | 14 +++----- .../SplashTextResourceSupplierMixin.java | 5 +-- .../sigmautils/mixin/TitleScreenMixin.java | 9 ++--- .../modules/_interface/ConfirmDisconnect.java | 11 +++--- .../modules/_interface/RandomBackground.java | 6 ++-- .../modules/hud/CoordinatesHud.java | 2 +- .../sigmautils/modules/hud/Hud.java | 13 ++++--- .../sigmautils/modules/meta/OpenFolder.java | 6 ++-- .../sigmautils/modules/meta/Padding.java | 2 +- .../sigmautils/modules/misc/AutoSign.java | 3 +- .../sigmautils/modules/misc/SoundControl.java | 9 +++-- .../sigmautils/modules/misc/TickSpeed.java | 2 +- .../modules/rendering/EntityHighlight.java | 7 ++-- .../modules/server/PlayerHistory.java | 9 ++--- .../modules/server/VictoryMute.java | 5 +-- src/main/resources/fabric.mod.json | 4 +-- 40 files changed, 169 insertions(+), 168 deletions(-) diff --git a/gradle.properties b/gradle.properties index df860f9..6499f1f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,4 +10,4 @@ maven_group=com.connorcode archives_base_name=sigma-utils # Dependencies fabric_version=0.83.0+1.20 -mod_menu_version=6.1.0-rc.4 +mod_menu_version=7.0.1 diff --git a/src/main/java/com/connorcode/sigmautils/commands/Note.java b/src/main/java/com/connorcode/sigmautils/commands/Note.java index 321514d..1d24d22 100644 --- a/src/main/java/com/connorcode/sigmautils/commands/Note.java +++ b/src/main/java/com/connorcode/sigmautils/commands/Note.java @@ -4,8 +4,8 @@ import com.mojang.brigadier.context.CommandContext; import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager; import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.StringVisitable; import net.minecraft.text.Text; @@ -142,17 +142,17 @@ protected void init() { } @Override - public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { + public void render(DrawContext matrices, int mouseX, int mouseY, float delta) { renderBackground(matrices); var lines = textRenderer.wrapLines(StringVisitable.plain(note.text), noteWidth); var startX = width / 2f - noteWidth / 2f; var height = lines.size() * 10; - fill(matrices, (int) startX, 0, (int) (startX + noteWidth), height, 0x7F000000); + matrices.fill((int) startX, 0, (int) (startX + noteWidth), height, 0x7F000000); for (int i = 0; i < lines.size(); i++) - textRenderer.draw(matrices, lines.get(i), startX, i * 10, 0xFFFFFF); + matrices.drawText(textRenderer, lines.get(i), (int) startX, i * 10, 0xFFFFFF, false); super.render(matrices, mouseX, mouseY, delta); } diff --git a/src/main/java/com/connorcode/sigmautils/config/ConfigGui.java b/src/main/java/com/connorcode/sigmautils/config/ConfigGui.java index 57b0552..624affc 100644 --- a/src/main/java/com/connorcode/sigmautils/config/ConfigGui.java +++ b/src/main/java/com/connorcode/sigmautils/config/ConfigGui.java @@ -4,9 +4,9 @@ import com.connorcode.sigmautils.module.Category; import com.connorcode.sigmautils.module.Module; import com.connorcode.sigmautils.modules.meta.Padding; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.Text; import net.minecraft.util.Util; @@ -69,12 +69,12 @@ protected void init() { }).position(width - githubLen - padding * 5, height - 20 - padding).size(githubLen + padding * 4, 20).build()); } - public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { + public void render(DrawContext matrices, int mouseX, int mouseY, float delta) { int padding = getPadding(); this.renderBackground(matrices); for (int x = 0; x < Category.values().length; x++) - drawCenteredTextWithShadow(matrices, textRenderer, Text.of("§f§n§l" + Category.values()[x].toString()), + matrices.drawCenteredTextWithShadow(textRenderer, Text.of("§f§n§l" + Category.values()[x].toString()), 75 + padding + x * (150 + padding), padding, 0); super.render(matrices, mouseX, mouseY, delta); diff --git a/src/main/java/com/connorcode/sigmautils/config/ModuleConfigGui.java b/src/main/java/com/connorcode/sigmautils/config/ModuleConfigGui.java index 7b01824..56ff039 100644 --- a/src/main/java/com/connorcode/sigmautils/config/ModuleConfigGui.java +++ b/src/main/java/com/connorcode/sigmautils/config/ModuleConfigGui.java @@ -3,10 +3,10 @@ import com.connorcode.sigmautils.config.settings.Setting; import com.connorcode.sigmautils.misc.util.Util; import com.connorcode.sigmautils.module.Module; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.tooltip.Tooltip; import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.Text; import net.minecraft.util.Pair; @@ -83,7 +83,7 @@ public void close() { } @Override - public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { + public void render(DrawContext matrices, int mouseX, int mouseY, float delta) { Setting.RenderData renderData = new Setting.RenderData(this, matrices, mouseX, mouseY, delta); int padding = getPadding(); @@ -94,15 +94,14 @@ public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { for (Pair>> entry : settings) { x += 150 + padding; if (entry.getLeft() != null) - drawCenteredTextWithShadow(matrices, textRenderer, Text.of(String.format("§f§n§l%s", entry.getLeft())), - x, - padding * 2 + textRenderer.fontHeight, 0); + matrices.drawCenteredTextWithShadow(textRenderer, Text.of(String.format("§f§n§l%s", entry.getLeft())), + x, padding * 2 + textRenderer.fontHeight, 0); for (Setting setting : entry.getRight()) setting.render(renderData, x - 75, elementPositions.get(setting.getName())); } - drawCenteredTextWithShadow(matrices, textRenderer, Text.of(String.format("§f§n§l%s Settings", module.name)), + matrices.drawCenteredTextWithShadow(textRenderer, Text.of(String.format("§f§n§l%s Settings", module.name)), width / 2, padding, 0); } diff --git a/src/main/java/com/connorcode/sigmautils/config/settings/BoolSetting.java b/src/main/java/com/connorcode/sigmautils/config/settings/BoolSetting.java index 1de1e27..a7799c1 100644 --- a/src/main/java/com/connorcode/sigmautils/config/settings/BoolSetting.java +++ b/src/main/java/com/connorcode/sigmautils/config/settings/BoolSetting.java @@ -100,7 +100,7 @@ public int initRender(Screen screen, int x, int y, int width) { (button -> BoolSetting.this.value = button.isChecked()), ((button, matrices, mouseX, mouseY) -> { if (this.description == null) return; - screen.renderOrderedTooltip(matrices, + matrices.drawOrderedTooltip(client.textRenderer, client.textRenderer.wrapLines(getDescription(), 200), mouseX, mouseY); }))); diff --git a/src/main/java/com/connorcode/sigmautils/config/settings/DynamicListSetting.java b/src/main/java/com/connorcode/sigmautils/config/settings/DynamicListSetting.java index 4a27abb..269461b 100644 --- a/src/main/java/com/connorcode/sigmautils/config/settings/DynamicListSetting.java +++ b/src/main/java/com/connorcode/sigmautils/config/settings/DynamicListSetting.java @@ -4,11 +4,11 @@ import com.connorcode.sigmautils.misc.Components; import com.connorcode.sigmautils.misc.util.Util; import com.connorcode.sigmautils.module.Module; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.tooltip.Tooltip; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtElement; import net.minecraft.text.Text; @@ -171,7 +171,7 @@ public void close() { } @Override - public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { + public void render(DrawContext matrices, int mouseX, int mouseY, float delta) { renderBackground(matrices); super.render(matrices, mouseX, mouseY, delta); this.searchField.render(matrices, mouseX, mouseY, delta); @@ -250,7 +250,7 @@ public void close() { } @Override - public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { + public void render(DrawContext matrices, int mouseX, int mouseY, float delta) { renderBackground(matrices); super.render(matrices, mouseX, mouseY, delta); } diff --git a/src/main/java/com/connorcode/sigmautils/config/settings/KeyBindSetting.java b/src/main/java/com/connorcode/sigmautils/config/settings/KeyBindSetting.java index 03b608d..aa2ac60 100644 --- a/src/main/java/com/connorcode/sigmautils/config/settings/KeyBindSetting.java +++ b/src/main/java/com/connorcode/sigmautils/config/settings/KeyBindSetting.java @@ -100,7 +100,7 @@ public int initRender(Screen screen, int x, int y, int width) { else editing = true; }, (((button, matrices, mouseX, mouseY) -> { if (this.description == null) return; - screen.renderOrderedTooltip(matrices, + matrices.drawOrderedTooltip(client.textRenderer, client.textRenderer.wrapLines(getDescription(), 200), mouseX, mouseY); }))) { @@ -116,7 +116,7 @@ public Text getMessage() { @Override public void render(RenderData data, int x, int y) { if (!showTitle) return; - client.textRenderer.draw(data.matrices(), String.format("§f%s:", this.name), x, y, 0); + data.drawContext().drawText(client.textRenderer, String.format("§f%s:", this.name), x, y, 0, false); } @Override diff --git a/src/main/java/com/connorcode/sigmautils/config/settings/NumberSetting.java b/src/main/java/com/connorcode/sigmautils/config/settings/NumberSetting.java index 5821766..7bca7b9 100644 --- a/src/main/java/com/connorcode/sigmautils/config/settings/NumberSetting.java +++ b/src/main/java/com/connorcode/sigmautils/config/settings/NumberSetting.java @@ -137,7 +137,7 @@ public int initRender(Screen screen, SliderText slider, int x, int y, int width) Util.addChild(screen, new Components.TooltipSlider(x, y, width, 20, slider.getText(), MathHelper.clamp((this.value - this.min) / this.max, 0, 1)) { @Override - protected Text getTooltip() { + protected Text tooltip() { return Text.of(NumberSetting.this.description); } diff --git a/src/main/java/com/connorcode/sigmautils/config/settings/SelectorSetting.java b/src/main/java/com/connorcode/sigmautils/config/settings/SelectorSetting.java index 6a771da..d2852db 100644 --- a/src/main/java/com/connorcode/sigmautils/config/settings/SelectorSetting.java +++ b/src/main/java/com/connorcode/sigmautils/config/settings/SelectorSetting.java @@ -6,12 +6,12 @@ import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager; import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback; import net.minecraft.client.MinecraftClient; +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.tooltip.Tooltip; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.EntryListWidget; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.nbt.NbtCompound; import net.minecraft.text.Text; import org.jetbrains.annotations.Nullable; @@ -136,7 +136,7 @@ protected void init() { } @Override - public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { + public void render(DrawContext matrices, int mouseX, int mouseY, float delta) { this.selectorWidget.render(matrices, mouseX, mouseY, delta); super.render(matrices, mouseX, mouseY, delta); } @@ -183,9 +183,9 @@ public boolean equals(Object obj) { } @Override - public void render(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) { - SelectorWidget.this.client.textRenderer.drawWithShadow(matrices, this.value, - width / 2f - client.textRenderer.getWidth(this.value) / 2f, y + 1, 16777215, true); + public void render(DrawContext matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) { + matrices.drawText(SelectorWidget.this.client.textRenderer, this.value, + (int) (width / 2f - client.textRenderer.getWidth(this.value) / 2f), y + 1, 16777215, true); } @Override diff --git a/src/main/java/com/connorcode/sigmautils/config/settings/Setting.java b/src/main/java/com/connorcode/sigmautils/config/settings/Setting.java index 75c7009..d3bf9c4 100644 --- a/src/main/java/com/connorcode/sigmautils/config/settings/Setting.java +++ b/src/main/java/com/connorcode/sigmautils/config/settings/Setting.java @@ -4,8 +4,8 @@ import com.connorcode.sigmautils.config.Config; import com.connorcode.sigmautils.misc.util.Util; import com.connorcode.sigmautils.module.Module; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.nbt.NbtCompound; import net.minecraft.text.Text; import org.jetbrains.annotations.Nullable; @@ -89,6 +89,6 @@ public boolean onKeypress(int key, int scanCode, int modifiers) { public void onClose() { } - public record RenderData(Screen screen, MatrixStack matrices, int mouseX, int mouseY, float delta) { + public record RenderData(Screen screen, DrawContext drawContext, int mouseX, int mouseY, float delta) { } } \ No newline at end of file diff --git a/src/main/java/com/connorcode/sigmautils/config/settings/StringSetting.java b/src/main/java/com/connorcode/sigmautils/config/settings/StringSetting.java index 33429c3..796ea0c 100644 --- a/src/main/java/com/connorcode/sigmautils/config/settings/StringSetting.java +++ b/src/main/java/com/connorcode/sigmautils/config/settings/StringSetting.java @@ -111,8 +111,8 @@ public int initRender(Screen screen, int x, int y, int width) { @Override public void render(RenderData data, int x, int y) { if (!showName) return; - client.textRenderer.draw(data.matrices(), String.format("§f%s:", this.name), x, - y + getPadding(), 0); + data.drawContext().drawText(client.textRenderer, String.format("§f%s:", this.name), x, + y + getPadding(), 0, false); } interface Callback { diff --git a/src/main/java/com/connorcode/sigmautils/config/settings/list/SimpleList.java b/src/main/java/com/connorcode/sigmautils/config/settings/list/SimpleList.java index 291e5f1..ed206ee 100644 --- a/src/main/java/com/connorcode/sigmautils/config/settings/list/SimpleList.java +++ b/src/main/java/com/connorcode/sigmautils/config/settings/list/SimpleList.java @@ -37,8 +37,10 @@ public static void selector(DynamicListSetting setting, T resource, Strin setting.add(resource); ((ScreenAccessor) screen).invokeClearAndInit(); }).position(x, y).size(20, 20).tooltip(Tooltip.of(Text.of("Add element"))).build()); - Util.addDrawable(screen, (matrices, mouseX, mouseY, delta) -> client.textRenderer.draw(matrices, display, - x + 20 + padding * 4 + gap, y + padding / 2f + 10 - client.textRenderer.fontHeight / 2f, 0xFFFFFF)); + Util.addDrawable(screen, (matrices, mouseX, mouseY, delta) -> + matrices.drawText(client.textRenderer, display, x + 20 + padding * 4 + gap, + (int) (y + padding / 2f + 10 - client.textRenderer.fontHeight / 2f), 0xFFFFFF, false) + ); } public static void render(DynamicListSetting setting, T resource, String display, Screen screen, int x, int y, int gap) { @@ -47,8 +49,10 @@ public static void render(DynamicListSetting setting, T resource, String setting.remove(resource); ((ScreenAccessor) screen).invokeClearAndInit(); }).position(x, y).size(20, 20).tooltip(Tooltip.of(Text.of("Remove element"))).build()); - Util.addDrawable(screen, (matrices, mouseX, mouseY, delta) -> client.textRenderer.draw(matrices, display, - x + 20 + padding * 4 + gap, y + padding / 2f + 10 - client.textRenderer.fontHeight / 2f, 0xffffff)); + Util.addDrawable(screen, (matrices, mouseX, mouseY, delta) -> + matrices.drawText(client.textRenderer, display, x + 20 + padding * 4 + gap, + (int) (y + padding / 2f + 10 - client.textRenderer.fontHeight / 2f), 0xffffff, false)) + ; } diff --git a/src/main/java/com/connorcode/sigmautils/misc/Components.java b/src/main/java/com/connorcode/sigmautils/misc/Components.java index 217794d..1253bec 100644 --- a/src/main/java/com/connorcode/sigmautils/misc/Components.java +++ b/src/main/java/com/connorcode/sigmautils/misc/Components.java @@ -6,6 +6,7 @@ import com.connorcode.sigmautils.misc.util.Util; import com.connorcode.sigmautils.mixin.ScreenAccessor; import com.connorcode.sigmautils.module.Module; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.Element; import net.minecraft.client.gui.Selectable; @@ -15,12 +16,9 @@ import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.CheckboxWidget; import net.minecraft.client.gui.widget.SliderWidget; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.Text; import net.minecraft.util.math.MathHelper; -import java.util.Objects; - import static com.connorcode.sigmautils.SigmaUtils.client; import static com.connorcode.sigmautils.config.ConfigGui.getPadding; @@ -44,7 +42,7 @@ public static void addToggleButton(Screen screen, Module module, int x, int y, i else module.disable(client); sa.invokeClearAndInit(); - }, ((button, matrices, mouseX, mouseY) -> screen.renderOrderedTooltip(matrices, sa.getTextRenderer() + }, ((button, matrices, mouseX, mouseY) -> matrices.drawOrderedTooltip(sa.getTextRenderer(), sa.getTextRenderer() .wrapLines(Text.of(module.description), 200), mouseX, mouseY)))); } @@ -103,9 +101,9 @@ protected ScrollableScreen(Text title, int padding, int entryHeight, int entryWi } @Override - public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { + public void render(DrawContext matrices, int mouseX, int mouseY, float delta) { var xStart = startX(); - fill(matrices, xStart, 0, xStart + entryWidth, height, 0x80000000); + matrices.fill(xStart, 0, xStart + entryWidth, height, 0x80000000); var drawables = ((ScreenAccessor) this).getDrawables(); for (var i : drawables) i.render(matrices, mouseX, mouseY, delta); @@ -158,7 +156,7 @@ protected boolean isValidClickButton(int button) { } @Override - public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { + public void render(DrawContext matrices, int mouseX, int mouseY, float delta) { super.render(matrices, mouseX, mouseY, delta); if (this.hovered) tooltipSupplier.onTooltip(this, matrices, mouseX, mouseY); super.render(matrices, mouseX, mouseY, delta); @@ -169,30 +167,31 @@ public interface PressAction { } public interface TooltipSupplier { - void onTooltip(MultiClickButton button, MatrixStack matrices, int mouseX, int mouseY); + void onTooltip(MultiClickButton button, DrawContext matrices, int mouseX, int mouseY); } } + // TODO: See if this is even needed anymore public static abstract class TooltipSlider extends SliderWidget { public TooltipSlider(int x, int y, int width, int height, Text text, double value) { super(x, y, width, height, text, value); } - protected Text getTooltip() { + protected Text tooltip() { return null; } @Override - public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { + public void render(DrawContext matrices, int mouseX, int mouseY, float delta) { super.render(matrices, mouseX, mouseY, delta); if (!this.hovered) return; - Text tooltip = this.getTooltip(); + Text tooltip = this.tooltip(); if (tooltip == null) return; - Objects.requireNonNull(client.currentScreen) - .renderOrderedTooltip(matrices, client.textRenderer.wrapLines(tooltip, 200), mouseX, mouseY); + matrices.drawOrderedTooltip(client.textRenderer, client.textRenderer.wrapLines(tooltip, 200), mouseX, + mouseY); } } @@ -212,12 +211,12 @@ public void onPress() { this.onPress.onPress(this); } - public void renderTooltip(MatrixStack matrices, int mouseX, int mouseY) { + public void renderTooltip(DrawContext matrices, int mouseX, int mouseY) { tooltipSupplier.onTooltip(this, matrices, mouseX, mouseY); } @Override - public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float delta) { + public void renderButton(DrawContext matrices, int mouseX, int mouseY, float delta) { super.renderButton(matrices, mouseX, mouseY, delta); if (this.isSelected()) this.renderTooltip(matrices, mouseX, mouseY); @@ -228,7 +227,7 @@ public interface PressAction { } public interface TooltipSupplier { - void onTooltip(EventCheckbox button, MatrixStack matrices, int mouseX, int mouseY); + void onTooltip(EventCheckbox button, DrawContext matrices, int mouseX, int mouseY); } } } diff --git a/src/main/java/com/connorcode/sigmautils/misc/util/WorldUtils.java b/src/main/java/com/connorcode/sigmautils/misc/util/WorldUtils.java index 1294f14..ce25e9c 100644 --- a/src/main/java/com/connorcode/sigmautils/misc/util/WorldUtils.java +++ b/src/main/java/com/connorcode/sigmautils/misc/util/WorldUtils.java @@ -7,7 +7,7 @@ public class WorldUtils { public static HitResult raycast(Entity entity, double maxDistance, float tickDelta) { var end = entity.getCameraPosVec(tickDelta).add(entity.getRotationVec(tickDelta).multiply(maxDistance)); - return entity.world.raycast( + return entity.getWorld().raycast( new RaycastContext(entity.getCameraPosVec(tickDelta), end, RaycastContext.ShapeType.OUTLINE, RaycastContext.FluidHandling.NONE, entity)); } diff --git a/src/main/java/com/connorcode/sigmautils/mixin/BossBarHudMixin.java b/src/main/java/com/connorcode/sigmautils/mixin/BossBarHudMixin.java index 3776921..01b34ef 100644 --- a/src/main/java/com/connorcode/sigmautils/mixin/BossBarHudMixin.java +++ b/src/main/java/com/connorcode/sigmautils/mixin/BossBarHudMixin.java @@ -3,8 +3,8 @@ import com.connorcode.sigmautils.config.Config; import com.connorcode.sigmautils.modules._interface.NoBossBarValue; import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.hud.BossBarHud; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.boss.BossBar; import net.minecraft.text.Text; import org.spongepowered.asm.mixin.Mixin; @@ -15,16 +15,16 @@ @Mixin(BossBarHud.class) public class BossBarHudMixin { - @Inject(method = "renderBossBar(Lnet/minecraft/client/util/math/MatrixStack;IILnet/minecraft/entity/boss/BossBar;)V", at = @At("HEAD"), cancellable = true) - void onRenderBossBar(MatrixStack matrices, int x, int y, BossBar bossBar, CallbackInfo ci) { + @Inject(method = "renderBossBar(Lnet/minecraft/client/gui/DrawContext;IILnet/minecraft/entity/boss/BossBar;)V", at = @At("HEAD"), cancellable = true) + void onRenderBossBar(DrawContext context, int x, int y, BossBar bossBar, CallbackInfo ci) { if (Config.getEnabled(NoBossBarValue.class)) ci.cancel(); } - @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/TextRenderer;drawWithShadow(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/text/Text;FFI)I")) - int onDrawWithShadow(TextRenderer instance, MatrixStack matrices, Text text, float x, float y, int color) { + @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTextWithShadow(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/text/Text;III)I")) + int onDrawWithShadow(DrawContext instance, TextRenderer textRenderer, Text text, int x, int y, int color) { if (Config.getEnabled(NoBossBarValue.class)) y = 9 * (y / 19) + 2; - return instance.drawWithShadow(matrices, text, x, y, color); + return instance.drawTextWithShadow(textRenderer, text, x, y, color); } } diff --git a/src/main/java/com/connorcode/sigmautils/mixin/ChatScreenMixin.java b/src/main/java/com/connorcode/sigmautils/mixin/ChatScreenMixin.java index 1b36e7f..8283dff 100644 --- a/src/main/java/com/connorcode/sigmautils/mixin/ChatScreenMixin.java +++ b/src/main/java/com/connorcode/sigmautils/mixin/ChatScreenMixin.java @@ -39,7 +39,7 @@ private double mouseYValueClick(double value) { return value + mouseYModifier(); } - @ModifyArg(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ChatScreen;renderTextHoverEffect(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/text/Style;II)V"), index = 3) + @ModifyArg(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawHoverEvent(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/text/Style;II)V"), index = 3) int onRenderTextHover(int value) { return value - mouseYModifier(); } diff --git a/src/main/java/com/connorcode/sigmautils/mixin/DownloadingTerrainScreenMixin.java b/src/main/java/com/connorcode/sigmautils/mixin/DownloadingTerrainScreenMixin.java index 1f52269..f6d3449 100644 --- a/src/main/java/com/connorcode/sigmautils/mixin/DownloadingTerrainScreenMixin.java +++ b/src/main/java/com/connorcode/sigmautils/mixin/DownloadingTerrainScreenMixin.java @@ -2,9 +2,9 @@ import com.connorcode.sigmautils.config.Config; import com.connorcode.sigmautils.modules._interface.SeeThruLoading; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.DownloadingTerrainScreen; import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.Text; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -26,15 +26,15 @@ void ohShouldCloseOnEsc(CallbackInfoReturnable cir) { } // For see_through_loading - @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/DownloadingTerrainScreen;renderBackgroundTexture(Lnet/minecraft/client/util/math/MatrixStack;)V")) - void onRenderBackground(DownloadingTerrainScreen instance, MatrixStack matrixStack) { + @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/DownloadingTerrainScreen;renderBackgroundTexture(Lnet/minecraft/client/gui/DrawContext;)V")) + void onRenderBackground(DownloadingTerrainScreen instance, DrawContext drawContext) { if (!Config.getEnabled(SeeThruLoading.class)) - this.renderBackgroundTexture(matrixStack); + this.renderBackgroundTexture(drawContext); } @Inject(method = "render", at = @At("HEAD")) - void onRender(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) { + void onRender(DrawContext matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) { if (Config.getEnabled(SeeThruLoading.class)) - fillGradient(matrices, 0, 0, this.width, this.height, -1072689136, -804253680); + matrices.fillGradient(0, 0, this.width, this.height, -1072689136, -804253680); } } diff --git a/src/main/java/com/connorcode/sigmautils/mixin/EntryListWidgetMixin.java b/src/main/java/com/connorcode/sigmautils/mixin/EntryListWidgetMixin.java index c4ce00d..e19f07d 100644 --- a/src/main/java/com/connorcode/sigmautils/mixin/EntryListWidgetMixin.java +++ b/src/main/java/com/connorcode/sigmautils/mixin/EntryListWidgetMixin.java @@ -2,30 +2,25 @@ import com.connorcode.sigmautils.config.Config; import com.connorcode.sigmautils.modules._interface.RandomBackground; -import com.mojang.blaze3d.systems.RenderSystem; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.widget.EntryListWidget; import net.minecraft.util.Identifier; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; -import static net.minecraft.client.gui.DrawableHelper.OPTIONS_BACKGROUND_TEXTURE; @Mixin(EntryListWidget.class) public class EntryListWidgetMixin { - @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;setShaderTexture(ILnet/minecraft/util/Identifier;)V", ordinal = 0)) - private void setShaderTexture(int texture, Identifier id) { - if (Config.getEnabled(RandomBackground.class)) - RandomBackground.setTexture(); - else - RenderSystem.setShaderTexture(0, OPTIONS_BACKGROUND_TEXTURE); + @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Lnet/minecraft/util/Identifier;IIFFIIII)V")) + private void setShaderTexture(DrawContext instance, Identifier texture, int x, int y, float u, float v, int width, int height, int textureWidth, int textureHeight) { + if (Config.getEnabled(RandomBackground.class)) texture = RandomBackground.getTexture(); + instance.drawTexture(texture, 0, 0, 0, 0.0F, 0.0F, width, height, 32, 32); } - @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;setShaderTexture(ILnet/minecraft/util/Identifier;)V", ordinal = 1)) - private void setShaderTexture2(int texture, Identifier id) { - if (Config.getEnabled(RandomBackground.class)) - RandomBackground.setTexture(); - else - RenderSystem.setShaderTexture(0, OPTIONS_BACKGROUND_TEXTURE); - } +// @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Lnet/minecraft/util/Identifier;IIFFIIII)V")) +// private void setShaderTexture2(int texture, Identifier id) { +// if (Config.getEnabled(RandomBackground.class)) texture = RandomBackground.getTexture(); +// instance.drawTexture(texture, 0, 0, 0, 0.0F, 0.0F, width, height, 32, 32); +// } } diff --git a/src/main/java/com/connorcode/sigmautils/mixin/InGameHudMixin.java b/src/main/java/com/connorcode/sigmautils/mixin/InGameHudMixin.java index cfe8a16..258ba51 100644 --- a/src/main/java/com/connorcode/sigmautils/mixin/InGameHudMixin.java +++ b/src/main/java/com/connorcode/sigmautils/mixin/InGameHudMixin.java @@ -9,6 +9,7 @@ import com.connorcode.sigmautils.modules.misc.BlockDistance; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.hud.ChatHud; import net.minecraft.client.gui.hud.InGameHud; import net.minecraft.client.util.math.MatrixStack; @@ -38,7 +39,7 @@ public abstract class InGameHudMixin { public abstract TextRenderer getTextRenderer(); @Inject(method = "renderCrosshair", at = @At("TAIL")) - void onRenderCrosshair(MatrixStack matrices, CallbackInfo ci) { + void onRenderCrosshair(DrawContext ctx, CallbackInfo ci) { if (!Config.getEnabled(BlockDistance.class)) return; client.getProfiler().push("SigmaUtils::BlockDistance"); @@ -52,13 +53,14 @@ void onRenderCrosshair(MatrixStack matrices, CallbackInfo ci) { .distanceTo(Objects.requireNonNull(client.player).getPos()); String text = String.format("§f[%d]", (int) distance); - client.textRenderer.draw(matrices, Text.of(text), scaledWidth / 2f - client.textRenderer.getWidth(text) / 2f, - scaledHeight / 2f + client.textRenderer.fontHeight, 0); + ctx.drawText(client.textRenderer, + Text.of(text).asOrderedText(), scaledWidth / 2 - client.textRenderer.getWidth(text) / 2, + scaledHeight / 2 + client.textRenderer.fontHeight, 0, true); client.getProfiler().pop(); } @Inject(method = "render", at = @At("TAIL")) - void onRender(MatrixStack matrices, float tickDelta, CallbackInfo ci) { + void onRender(DrawContext matrices, float tickDelta, CallbackInfo ci) { if (client.options.hudHidden || !Config.getEnabled(Hud.class)) return; Hud.renderHud(matrices); @@ -72,11 +74,11 @@ int onGetWidth(TextRenderer instance, String text) { } - @Redirect(method = "renderScoreboardSidebar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/TextRenderer;draw(Lnet/minecraft/client/util/math/MatrixStack;Ljava/lang/String;FFI)I")) - int onDraw(TextRenderer instance, MatrixStack matrices, String text, float x, float y, int color) { + @Redirect(method = "renderScoreboardSidebar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawText(Lnet/minecraft/client/font/TextRenderer;Ljava/lang/String;IIIZ)I")) + int onDraw(DrawContext instance, TextRenderer textRenderer, String text, int x, int y, int color, boolean shadow) { if (Config.getEnabled(NoScoreboardValue.class)) return 0; - return instance.draw(matrices, text, x, y, color); + return instance.drawText(textRenderer, text, x, y, color, shadow); } @Redirect(method = "renderScoreboardSidebar", at = @At(value = "INVOKE", target = "Ljava/lang/Integer;toString(I)Ljava/lang/String;")) @@ -86,12 +88,13 @@ String onToString(int buf) { return Integer.toString(buf); } - @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ChatHud;render(Lnet/minecraft/client/util/math/MatrixStack;III)V")) - void onRenderChat(ChatHud instance, MatrixStack matrices, int currentTick, int mouseX, int mouseY) { + @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ChatHud;render(Lnet/minecraft/client/gui/DrawContext;III)V")) + void onRenderChat(ChatHud instance, DrawContext context, int currentTick, int mouseX, int mouseY) { + MatrixStack matrices = context.getMatrices(); matrices.push(); if (Config.getEnabled(ChatPosition.class)) matrices.translate(0, -ChatPosition.yPosition.intValue() * client.textRenderer.fontHeight, 0); - instance.render(matrices, currentTick, mouseX, mouseY); + instance.render(context, currentTick, mouseX, mouseY); matrices.pop(); } @@ -100,17 +103,17 @@ int getHotbarPos() { } // Modified from https://github.com/yurisuika/Raise - @ModifyArg(method = "renderHotbar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;drawTexture(Lnet/minecraft/client/util/math/MatrixStack;IIIIII)V"), index = 2) + @ModifyArg(method = "renderHotbar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Lnet/minecraft/util/Identifier;IIIIII)V"), index = 2) private int modifyHotbar(int value) { return value - getHotbarPos(); } - @ModifyArg(method = "renderHotbar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;drawTexture(Lnet/minecraft/client/util/math/MatrixStack;IIIIII)V", ordinal = 1), index = 6) + @ModifyArg(method = "renderHotbar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Lnet/minecraft/util/Identifier;IIIIII)V", ordinal = 1), index = 6) private int modifySelectorHeight(int value) { return value + 2; } - @ModifyArg(method = "renderHotbar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;renderHotbarItem(Lnet/minecraft/client/util/math/MatrixStack;IIFLnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/item/ItemStack;I)V"), index = 2) + @ModifyArg(method = "renderHotbar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;renderHotbarItem(Lnet/minecraft/client/gui/DrawContext;IIFLnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/item/ItemStack;I)V"), index = 2) private int modifyItem(int value) { return value - getHotbarPos(); } @@ -120,13 +123,13 @@ private int modifyJumpBar(int value) { return value - getHotbarPos(); } - @ModifyArg(method = "renderExperienceBar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;drawTexture(Lnet/minecraft/client/util/math/MatrixStack;IIIIII)V"), index = 2) + @ModifyArg(method = "renderExperienceBar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Lnet/minecraft/util/Identifier;IIIIII)V"), index = 2) private int modifyExperienceBar(int value) { return value - getHotbarPos(); } - @ModifyArg(method = "renderExperienceBar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/TextRenderer;draw(Lnet/minecraft/client/util/math/MatrixStack;Ljava/lang/String;FFI)I"), index = 3) - private float modifyXpText(float value) { + @ModifyArg(method = "renderExperienceBar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawText(Lnet/minecraft/client/font/TextRenderer;Ljava/lang/String;IIIZ)I"), index = 3) + private int modifyXpText(int value) { return value - getHotbarPos(); } diff --git a/src/main/java/com/connorcode/sigmautils/mixin/InventoryScreenMixin.java b/src/main/java/com/connorcode/sigmautils/mixin/InventoryScreenMixin.java index 2d8f3e5..6cf9579 100644 --- a/src/main/java/com/connorcode/sigmautils/mixin/InventoryScreenMixin.java +++ b/src/main/java/com/connorcode/sigmautils/mixin/InventoryScreenMixin.java @@ -2,12 +2,11 @@ import com.connorcode.sigmautils.SigmaUtils; import com.connorcode.sigmautils.modules._interface.UiTweaks; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.ingame.AbstractInventoryScreen; import net.minecraft.client.gui.screen.ingame.InventoryScreen; import net.minecraft.client.gui.screen.recipebook.RecipeBookProvider; -import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.entity.EntityRenderDispatcher; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.screen.PlayerScreenHandler; @@ -27,8 +26,8 @@ public InventoryScreenMixin(PlayerScreenHandler screenHandler, PlayerInventory p super(screenHandler, playerInventory, text); } - @Inject(method = "drawEntity(Lnet/minecraft/client/util/math/MatrixStack;IIILorg/joml/Quaternionf;Lorg/joml/Quaternionf;Lnet/minecraft/entity/LivingEntity;)V", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;runAsFancy(Ljava/lang/Runnable;)V"), locals = LocalCapture.CAPTURE_FAILHARD) - private static void onDrawEntity(MatrixStack matrices, int x, int y, int size, Quaternionf quaternionf, Quaternionf quaternionf2, LivingEntity entity, CallbackInfo ci, double d, MatrixStack matrixStack, EntityRenderDispatcher entityRenderDispatcher, VertexConsumerProvider.Immediate immediate) { + @Inject(method = "drawEntity(Lnet/minecraft/client/gui/DrawContext;IIILorg/joml/Quaternionf;Lorg/joml/Quaternionf;Lnet/minecraft/entity/LivingEntity;)V", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;runAsFancy(Ljava/lang/Runnable;)V"), locals = LocalCapture.CAPTURE_FAILHARD) + private static void onDrawEntity(DrawContext context, int x, int y, int size, Quaternionf quaternionf, Quaternionf quaternionf2, LivingEntity entity, CallbackInfo ci, EntityRenderDispatcher entityRenderDispatcher) { if (!UiTweaks.fastDoll()) return; var ca = ((MinecraftClientAccessor) SigmaUtils.client); var tickDelta = SigmaUtils.client.isPaused() ? ca.getPausedTickDelta() : ca.getRenderTickCounter().tickDelta; @@ -41,14 +40,15 @@ private static void onDrawEntity(MatrixStack matrices, int x, int y, int size, Q entity.prevYaw = entity.getYaw(); entity.prevPitch = entity.getPitch(); entity.prevHeadYaw = entity.headYaw; - entityRenderDispatcher.render(entity, 0.0, 0.0, 0.0, 0.0F, tickDelta, matrices, immediate, 0xF000F0); + entityRenderDispatcher.render(entity, 0.0, 0.0, 0.0, 0.0F, tickDelta, context.getMatrices(), + context.getVertexConsumers(), 0xF000F0); entity.prevBodyYaw = h; entity.prevYaw = i; entity.prevPitch = j; entity.prevHeadYaw = k; } - @Redirect(method = "drawEntity(Lnet/minecraft/client/util/math/MatrixStack;IIILorg/joml/Quaternionf;Lorg/joml/Quaternionf;Lnet/minecraft/entity/LivingEntity;)V", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;runAsFancy(Ljava/lang/Runnable;)V")) + @Redirect(method = "drawEntity(Lnet/minecraft/client/gui/DrawContext;IIILorg/joml/Quaternionf;Lorg/joml/Quaternionf;Lnet/minecraft/entity/LivingEntity;)V", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;runAsFancy(Ljava/lang/Runnable;)V")) private static void onRender(Runnable runnable) { if (!UiTweaks.fastDoll()) runnable.run(); } diff --git a/src/main/java/com/connorcode/sigmautils/mixin/LogoDrawerMixin.java b/src/main/java/com/connorcode/sigmautils/mixin/LogoDrawerMixin.java index e825653..5e24aa1 100644 --- a/src/main/java/com/connorcode/sigmautils/mixin/LogoDrawerMixin.java +++ b/src/main/java/com/connorcode/sigmautils/mixin/LogoDrawerMixin.java @@ -10,7 +10,7 @@ @Mixin(LogoDrawer.class) public class LogoDrawerMixin { // For minceraft - @Redirect(method = "draw(Lnet/minecraft/client/util/math/MatrixStack;IFI)V", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/LogoDrawer;minceraft:Z")) + @Redirect(method = "draw(Lnet/minecraft/client/gui/DrawContext;IFI)V", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/LogoDrawer;minceraft:Z")) boolean isMinecraft(LogoDrawer instance) { return Config.getEnabled(Minceraft.class); } diff --git a/src/main/java/com/connorcode/sigmautils/mixin/MultiplayerScreenMixin.java b/src/main/java/com/connorcode/sigmautils/mixin/MultiplayerScreenMixin.java index f29fa71..deca44f 100644 --- a/src/main/java/com/connorcode/sigmautils/mixin/MultiplayerScreenMixin.java +++ b/src/main/java/com/connorcode/sigmautils/mixin/MultiplayerScreenMixin.java @@ -3,9 +3,9 @@ import com.connorcode.sigmautils.misc.Components; import com.connorcode.sigmautils.misc.util.NetworkUtils; import com.connorcode.sigmautils.modules._interface.UiTweaks; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.Text; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -26,10 +26,10 @@ void onInit(CallbackInfo ci) { return; addDrawableChild(new Components.DrawableElement() { @Override - public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { + public void render(DrawContext matrices, int mouseX, int mouseY, float delta) { var text = NetworkUtils.getAuthStatus().getText(); - Objects.requireNonNull(client).textRenderer.draw(matrices, text, - width - client.textRenderer.getWidth(text) - 10, 10, 0xFFFFFF); + matrices.drawText(Objects.requireNonNull(client).textRenderer, text, + width - client.textRenderer.getWidth(text) - 10, 10, 0xFFFFFF, false); } }); } diff --git a/src/main/java/com/connorcode/sigmautils/mixin/ProgressScreenMixin.java b/src/main/java/com/connorcode/sigmautils/mixin/ProgressScreenMixin.java index 246fb45..25e888b 100644 --- a/src/main/java/com/connorcode/sigmautils/mixin/ProgressScreenMixin.java +++ b/src/main/java/com/connorcode/sigmautils/mixin/ProgressScreenMixin.java @@ -2,9 +2,9 @@ import com.connorcode.sigmautils.config.Config; import com.connorcode.sigmautils.modules._interface.SeeThruLoading; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.ProgressScreen; import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.Text; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -26,15 +26,15 @@ void ohShouldCloseOnEsc(CallbackInfoReturnable cir) { } // For see_through_loading - @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ProgressScreen;renderBackground(Lnet/minecraft/client/util/math/MatrixStack;)V")) - void onRenderBackground(ProgressScreen instance, MatrixStack matrixStack) { + @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ProgressScreen;renderBackground(Lnet/minecraft/client/gui/DrawContext;)V")) + void onRenderBackground(ProgressScreen instance, DrawContext matrixStack) { if (!Config.getEnabled(SeeThruLoading.class)) this.renderBackground(matrixStack); } - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ProgressScreen;renderBackground(Lnet/minecraft/client/util/math/MatrixStack;)V", shift = At.Shift.BEFORE)) - void onRender(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) { + @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ProgressScreen;renderBackground(Lnet/minecraft/client/gui/DrawContext;)V", shift = At.Shift.BEFORE)) + void onRender(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) { if (Config.getEnabled(SeeThruLoading.class)) - fillGradient(matrices, 0, 0, this.width, this.height, -1072689136, -804253680); + context.fillGradient(0, 0, this.width, this.height, -1072689136, -804253680); } } diff --git a/src/main/java/com/connorcode/sigmautils/mixin/ScreenAccessor.java b/src/main/java/com/connorcode/sigmautils/mixin/ScreenAccessor.java index 84cea91..897db9a 100644 --- a/src/main/java/com/connorcode/sigmautils/mixin/ScreenAccessor.java +++ b/src/main/java/com/connorcode/sigmautils/mixin/ScreenAccessor.java @@ -3,8 +3,6 @@ import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.text.OrderedText; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; import org.spongepowered.asm.mixin.gen.Invoker; @@ -34,6 +32,6 @@ public interface ScreenAccessor { @Invoker void invokeClearAndInit(); - @Invoker - void invokeRenderOrderedTooltip(MatrixStack matrices, List sigma_utils, int mouseX, int mouseY); +// @Invoker +// void invokeRenderOrderedTooltip(MatrixStack matrices, List sigma_utils, int mouseX, int mouseY); } diff --git a/src/main/java/com/connorcode/sigmautils/mixin/ScreenMixin.java b/src/main/java/com/connorcode/sigmautils/mixin/ScreenMixin.java index ade252c..6b1a06c 100644 --- a/src/main/java/com/connorcode/sigmautils/mixin/ScreenMixin.java +++ b/src/main/java/com/connorcode/sigmautils/mixin/ScreenMixin.java @@ -2,8 +2,8 @@ import com.connorcode.sigmautils.config.Config; import com.connorcode.sigmautils.modules._interface.RandomBackground; -import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.util.Identifier; import org.jetbrains.annotations.Nullable; @@ -12,19 +12,15 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; -import static net.minecraft.client.gui.DrawableHelper.OPTIONS_BACKGROUND_TEXTURE; - @Mixin(Screen.class) public class ScreenMixin { @Shadow @Nullable protected MinecraftClient client; - @Redirect(method = "renderBackgroundTexture", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;setShaderTexture(ILnet/minecraft/util/Identifier;)V")) - private void setShaderTexture(int texture, Identifier id) { - if (Config.getEnabled(RandomBackground.class)) - RandomBackground.setTexture(); - else - RenderSystem.setShaderTexture(0, OPTIONS_BACKGROUND_TEXTURE); + @Redirect(method = "renderBackgroundTexture", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Lnet/minecraft/util/Identifier;IIIFFIIII)V")) + private void setShaderTexture(DrawContext instance, Identifier texture, int x, int y, int z, float u, float v, int width, int height, int textureWidth, int textureHeight) { + if (Config.getEnabled(RandomBackground.class)) texture = RandomBackground.getTexture(); + instance.drawTexture(texture, 0, 0, 0, 0.0F, 0.0F, width, height, 32, 32); } } diff --git a/src/main/java/com/connorcode/sigmautils/mixin/SplashTextResourceSupplierMixin.java b/src/main/java/com/connorcode/sigmautils/mixin/SplashTextResourceSupplierMixin.java index 72d4fa4..50c25ca 100644 --- a/src/main/java/com/connorcode/sigmautils/mixin/SplashTextResourceSupplierMixin.java +++ b/src/main/java/com/connorcode/sigmautils/mixin/SplashTextResourceSupplierMixin.java @@ -2,6 +2,7 @@ import com.connorcode.sigmautils.config.Config; import com.connorcode.sigmautils.modules._interface.BetterSplashes; +import net.minecraft.client.gui.screen.SplashTextRenderer; import net.minecraft.client.resource.SplashTextResourceSupplier; import net.minecraft.util.math.random.Random; import org.spongepowered.asm.mixin.Final; @@ -24,13 +25,13 @@ public class SplashTextResourceSupplierMixin { private List splashTexts; @Inject(method = "get", at = @At(value = "INVOKE", target = "Ljava/util/List;get(I)Ljava/lang/Object;", shift = At.Shift.BEFORE), cancellable = true) - void get(CallbackInfoReturnable cir) { + void get(CallbackInfoReturnable cir) { if (!Config.getEnabled(BetterSplashes.class)) return; ArrayList totalSplashes = new ArrayList<>(); totalSplashes.addAll(splashTexts); totalSplashes.addAll(BetterSplashes.betterSplashes); - cir.setReturnValue(totalSplashes.get(RANDOM.nextInt(totalSplashes.size()))); + cir.setReturnValue(new SplashTextRenderer(totalSplashes.get(RANDOM.nextInt(totalSplashes.size())))); } } diff --git a/src/main/java/com/connorcode/sigmautils/mixin/TitleScreenMixin.java b/src/main/java/com/connorcode/sigmautils/mixin/TitleScreenMixin.java index ab39949..db9255a 100644 --- a/src/main/java/com/connorcode/sigmautils/mixin/TitleScreenMixin.java +++ b/src/main/java/com/connorcode/sigmautils/mixin/TitleScreenMixin.java @@ -6,11 +6,12 @@ import com.connorcode.sigmautils.modules._interface.EscapeExit; import com.connorcode.sigmautils.modules._interface.SplashRefresh; import com.connorcode.sigmautils.modules._interface.UiTweaks; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.screen.SplashTextRenderer; import net.minecraft.client.gui.screen.TitleScreen; import net.minecraft.client.gui.tooltip.Tooltip; import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.Text; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; @@ -25,10 +26,10 @@ @Mixin(TitleScreen.class) public class TitleScreenMixin extends Screen { - long updateTime; @Shadow @Nullable - private String splashText; + private SplashTextRenderer splashText; + long updateTime; protected TitleScreenMixin(Text title) { super(title); @@ -51,7 +52,7 @@ void init(CallbackInfo ci) { // For splash_refresh @Inject(method = "render", at = @At("HEAD")) - void onRender(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) { + void onRender(DrawContext matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) { long now = System.currentTimeMillis(); if (!Config.getEnabled(SplashRefresh.class) || now - updateTime < SplashRefresh.refreshTime.intValue() * 1000L) return; diff --git a/src/main/java/com/connorcode/sigmautils/modules/_interface/ConfirmDisconnect.java b/src/main/java/com/connorcode/sigmautils/modules/_interface/ConfirmDisconnect.java index 7c1b4b7..3673220 100644 --- a/src/main/java/com/connorcode/sigmautils/modules/_interface/ConfirmDisconnect.java +++ b/src/main/java/com/connorcode/sigmautils/modules/_interface/ConfirmDisconnect.java @@ -2,13 +2,13 @@ import com.connorcode.sigmautils.module.Category; import com.connorcode.sigmautils.module.Module; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.MessageScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.TitleScreen; import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.realms.gui.screen.RealmsMainScreen; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.Text; public class ConfirmDisconnect extends Module { @@ -48,12 +48,13 @@ protected void init() { } @Override - public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { + public void render(DrawContext matrices, int mouseX, int mouseY, float delta) { assert client != null; - fillGradient(matrices, 0, 0, this.width, this.height, -1072689136, -804253680); + matrices.fillGradient(0, 0, this.width, this.height, -1072689136, -804253680); Text text = Text.of("Do you want to disconnect?"); - client.textRenderer.draw(matrices, text, this.width / 2f - textRenderer.getWidth(text) / 2f, - this.height / 4f - 20 - textRenderer.fontHeight / 2f, 16777215); + matrices.drawText(client.textRenderer, text.asOrderedText(), + this.width / 2 - textRenderer.getWidth(text) / 2, + this.height / 4 - 20 - textRenderer.fontHeight / 2, 16777215, false); super.render(matrices, mouseX, mouseY, delta); } } diff --git a/src/main/java/com/connorcode/sigmautils/modules/_interface/RandomBackground.java b/src/main/java/com/connorcode/sigmautils/modules/_interface/RandomBackground.java index cd50d76..63ac201 100644 --- a/src/main/java/com/connorcode/sigmautils/modules/_interface/RandomBackground.java +++ b/src/main/java/com/connorcode/sigmautils/modules/_interface/RandomBackground.java @@ -3,7 +3,6 @@ import com.connorcode.sigmautils.SigmaUtils; import com.connorcode.sigmautils.module.Category; import com.connorcode.sigmautils.module.Module; -import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.util.Identifier; import java.io.BufferedReader; @@ -27,7 +26,7 @@ public RandomBackground() { Category.Interface); } - public static void setTexture() { + public static Identifier getTexture() { int currentScreenHash = Objects.requireNonNull(Objects.requireNonNull(client).currentScreen).hashCode(); if (screenHash != currentScreenHash || assetIndex < 0) { @@ -35,8 +34,7 @@ public static void setTexture() { assetIndex = new Random().nextInt(RandomBackground.validBackgrounds.size()); } - RenderSystem.setShaderTexture(0, - Identifier.tryParse("textures/block/" + RandomBackground.validBackgrounds.get(assetIndex) + ".png")); + return Identifier.tryParse("textures/block/" + RandomBackground.validBackgrounds.get(assetIndex) + ".png"); } // If you dare try to make backgrounds selectable again: // https://gist.github.com/Basicprogrammer10/2c0b3f0dd815e93cd64abe4bf4810511 diff --git a/src/main/java/com/connorcode/sigmautils/modules/hud/CoordinatesHud.java b/src/main/java/com/connorcode/sigmautils/modules/hud/CoordinatesHud.java index f658b8d..d97b1d6 100644 --- a/src/main/java/com/connorcode/sigmautils/modules/hud/CoordinatesHud.java +++ b/src/main/java/com/connorcode/sigmautils/modules/hud/CoordinatesHud.java @@ -48,7 +48,7 @@ private String formatPos(Vec3d pos) { @Override public String line() { ClientPlayerEntity player = Objects.requireNonNull(client.player); - RegistryKey registryKey = player.world.getRegistryKey(); + RegistryKey registryKey = player.getWorld().getRegistryKey(); Vec3d otherPos = null; if (registryKey == OVERWORLD) otherPos = player.getPos() diff --git a/src/main/java/com/connorcode/sigmautils/modules/hud/Hud.java b/src/main/java/com/connorcode/sigmautils/modules/hud/Hud.java index 0ea0255..b999074 100644 --- a/src/main/java/com/connorcode/sigmautils/modules/hud/Hud.java +++ b/src/main/java/com/connorcode/sigmautils/modules/hud/Hud.java @@ -8,15 +8,14 @@ import com.connorcode.sigmautils.module.HudModule; import com.connorcode.sigmautils.module.Module; 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.util.Pair; import java.util.*; import static com.connorcode.sigmautils.SigmaUtils.client; import static com.connorcode.sigmautils.config.ConfigGui.getPadding; -import static net.minecraft.client.gui.DrawableHelper.fill; public class Hud extends Module { public static List hudModules = new ArrayList<>(); @@ -63,14 +62,14 @@ public static List getHud(int scaledHeight, int scaledWidth) { return hudStacks; } - public static void renderHud(MatrixStack matrices) { + public static void renderHud(DrawContext ctx) { if (client.options.debugEnabled && hideF3.value()) return; InGameHudAccessor hudAccessor = (InGameHudAccessor) client.inGameHud; int padding = getPadding(); client.getProfiler().push("SigmaUtils::Hud"); getHud(hudAccessor.getScaledHeight(), hudAccessor.getScaledWidth()).forEach( - hudStack -> hudStack.render(matrices, padding)); + hudStack -> hudStack.render(ctx, padding)); client.getProfiler().pop(); } @@ -123,15 +122,15 @@ boolean isRight() { } record HudStack(RealLocation location, List lines, int startX, int startY, int maxWidth) { - void render(MatrixStack matrices, int padding) { + void render(DrawContext ctx, int padding) { int y = startY; var p = padding / 2f; var pr = (int) Math.ceil(p); for (String line : lines) { var x = location.isRight() ? startX + (maxWidth - client.textRenderer.getWidth(line)) : startX; - if (background.value()) fill(matrices, x - pr, y - pr, x + client.textRenderer.getWidth(line) + pr, + if (background.value()) ctx.fill(x - pr, y - pr, x + client.textRenderer.getWidth(line) + pr, y + client.textRenderer.fontHeight + (int) (p), 0x88000000); - client.textRenderer.drawWithShadow(matrices, line, x, y, 0); + ctx.drawTextWithShadow(client.textRenderer, line, x, y, 0); y += client.textRenderer.fontHeight + padding; } } diff --git a/src/main/java/com/connorcode/sigmautils/modules/meta/OpenFolder.java b/src/main/java/com/connorcode/sigmautils/modules/meta/OpenFolder.java index 95e5c63..b2d7a5b 100644 --- a/src/main/java/com/connorcode/sigmautils/modules/meta/OpenFolder.java +++ b/src/main/java/com/connorcode/sigmautils/modules/meta/OpenFolder.java @@ -18,8 +18,10 @@ public void drawInterface(MinecraftClient client, Screen screen, int x, int y) { ScreenAccessor sa = (ScreenAccessor) screen; com.connorcode.sigmautils.misc.util.Util.addChild(screen, new Components.MultiClickButton(x, y, 150, 20, Text.of(name), button -> enable(client), - ((button, matrices, mouseX, mouseY) -> screen.renderOrderedTooltip(matrices, sa.getTextRenderer() - .wrapLines(Text.of(description), 200), mouseX, mouseY)))); + ((button, matrices, mouseX, mouseY) -> + matrices.drawOrderedTooltip(sa.getTextRenderer(), + sa.getTextRenderer().wrapLines(Text.of(description), 200), mouseX, mouseY) + ))); } @Override diff --git a/src/main/java/com/connorcode/sigmautils/modules/meta/Padding.java b/src/main/java/com/connorcode/sigmautils/modules/meta/Padding.java index d0d5c08..8163b20 100644 --- a/src/main/java/com/connorcode/sigmautils/modules/meta/Padding.java +++ b/src/main/java/com/connorcode/sigmautils/modules/meta/Padding.java @@ -35,7 +35,7 @@ public void drawInterface(MinecraftClient client, Screen screen, int x, int y) { new Components.TooltipSlider(x + 20 + padding, y, 130 - padding, 20, getSliderTitle(), MathHelper.clamp(padding / 10f, 0, 1)) { @Override - protected Text getTooltip() { + protected Text tooltip() { return Padding.padding.getDescription(); } diff --git a/src/main/java/com/connorcode/sigmautils/modules/misc/AutoSign.java b/src/main/java/com/connorcode/sigmautils/modules/misc/AutoSign.java index 7c7bbe6..e271800 100644 --- a/src/main/java/com/connorcode/sigmautils/modules/misc/AutoSign.java +++ b/src/main/java/com/connorcode/sigmautils/modules/misc/AutoSign.java @@ -36,8 +36,9 @@ public void init() { ScreenOpenCallback.EVENT.register(screen -> { if (!(screen.get() instanceof AbstractSignEditScreen && enabled)) return; SignBlockEntity signBlock = ((AbstractSignEditScreenAccessor) screen.get()).getSign(); + // TODO: add support for sign backs Objects.requireNonNull(client.player).networkHandler.sendPacket( - new UpdateSignC2SPacket(signBlock.getPos(), line1.value(), line2.value(), line3.value(), + new UpdateSignC2SPacket(signBlock.getPos(), true, line1.value(), line2.value(), line3.value(), line4.value())); screen.cancel(); }); diff --git a/src/main/java/com/connorcode/sigmautils/modules/misc/SoundControl.java b/src/main/java/com/connorcode/sigmautils/modules/misc/SoundControl.java index e9d1638..197d8f1 100644 --- a/src/main/java/com/connorcode/sigmautils/modules/misc/SoundControl.java +++ b/src/main/java/com/connorcode/sigmautils/modules/misc/SoundControl.java @@ -79,9 +79,12 @@ protected void applyValue() { } }); Util.addDrawable(screen, - (matrices, mouseX, mouseY, delta) -> client.textRenderer.draw(matrices, getDisplay(resource), - x + 120 + padding * 4, y + padding / 2f + 10 - client.textRenderer.fontHeight / 2f, - 0xffffff)); + (matrices, mouseX, mouseY, delta) -> + matrices.drawText(client.textRenderer, getDisplay(resource), + x + 120 + padding * 4, + (int) (y + padding / 2f + 10 - client.textRenderer.fontHeight / 2f), + 0xffffff, false) + ); } Text getSliderText(SoundSettings resource) { diff --git a/src/main/java/com/connorcode/sigmautils/modules/misc/TickSpeed.java b/src/main/java/com/connorcode/sigmautils/modules/misc/TickSpeed.java index 93b468c..81b1d44 100644 --- a/src/main/java/com/connorcode/sigmautils/modules/misc/TickSpeed.java +++ b/src/main/java/com/connorcode/sigmautils/modules/misc/TickSpeed.java @@ -46,7 +46,7 @@ public void drawInterface(MinecraftClient client, Screen screen, int x, int y) { Util.addChild(screen, new Components.TooltipSlider(x + 20 + padding, y, 130 - padding, 20, getSliderTitle(), MathHelper.clamp(mspt.value() / 100d, 0, 1)) { @Override - protected Text getTooltip() { + protected Text tooltip() { return mspt.getDescription(); } diff --git a/src/main/java/com/connorcode/sigmautils/modules/rendering/EntityHighlight.java b/src/main/java/com/connorcode/sigmautils/modules/rendering/EntityHighlight.java index af1d281..02b8f66 100644 --- a/src/main/java/com/connorcode/sigmautils/modules/rendering/EntityHighlight.java +++ b/src/main/java/com/connorcode/sigmautils/modules/rendering/EntityHighlight.java @@ -10,10 +10,10 @@ import com.connorcode.sigmautils.module.Category; import com.connorcode.sigmautils.module.Module; import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.sound.PositionedSoundInstance; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.nbt.NbtCompound; @@ -30,7 +30,6 @@ import static com.connorcode.sigmautils.SigmaUtils.client; import static com.connorcode.sigmautils.config.ConfigGui.getPadding; -import static net.minecraft.client.gui.DrawableHelper.fill; public class EntityHighlight extends Module { public static BoolSetting disableF1 = new BoolSetting(EntityHighlight.class, "Disable on F1").value(true) @@ -126,8 +125,8 @@ public void render(GlowingEntity resource, Screen screen, int x, int y) { } else { Util.addChild(screen, new Components.DrawableElement() { @Override - public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { - fill(matrices, x + 20 + padding, y + padding, x - padding + 40, y - padding + 20, + public void render(DrawContext matrices, int mouseX, int mouseY, float delta) { + matrices.fill(x + 20 + padding, y + padding, x - padding + 40, y - padding + 20, getColor(resource.color)); } diff --git a/src/main/java/com/connorcode/sigmautils/modules/server/PlayerHistory.java b/src/main/java/com/connorcode/sigmautils/modules/server/PlayerHistory.java index 785a306..ffa239a 100644 --- a/src/main/java/com/connorcode/sigmautils/modules/server/PlayerHistory.java +++ b/src/main/java/com/connorcode/sigmautils/modules/server/PlayerHistory.java @@ -158,8 +158,9 @@ public int initRender(Screen screen, int x, int y, int width) { @Override public void render(RenderData data, int x, int y) { - client.textRenderer.draw(data.matrices(), - "§fTotal Seen Players: " + totalSeen, x, y + getPadding(), 0); + data.drawContext() + .drawText(client.textRenderer, "§fTotal Seen Players: " + totalSeen, x, y + getPadding(), 0, + false); } }.category("Info").build(); @@ -180,8 +181,8 @@ public int initRender(Screen screen, int x, int y, int width) { @Override public void render(RenderData data, int x, int y) { if (client.getCurrentServerEntry() == null) return; - client.textRenderer.draw(data.matrices(), "§fSeen on Current Server: " + thisServer, x, - y + getPadding(), 0); + data.drawContext().drawText(client.textRenderer, "§fSeen on Current Server: " + thisServer, x, + y + getPadding(), 0, false); } }.category("Info").build(); } diff --git a/src/main/java/com/connorcode/sigmautils/modules/server/VictoryMute.java b/src/main/java/com/connorcode/sigmautils/modules/server/VictoryMute.java index aba7c3a..1187b9c 100644 --- a/src/main/java/com/connorcode/sigmautils/modules/server/VictoryMute.java +++ b/src/main/java/com/connorcode/sigmautils/modules/server/VictoryMute.java @@ -48,8 +48,9 @@ public int initRender(Screen screen, int x, int y, int width) { @Override public void render(RenderData data, int x, int y) { if (!muted || !enabled) return; - client.textRenderer.draw(data.matrices(), TextStyle.Color.LightPurple.code() + "Currently Muted", x, - y + getPadding(), 0); + data.drawContext() + .drawText(client.textRenderer, TextStyle.Color.LightPurple.code() + "Currently Muted", x, + y + getPadding(), 0, false); } }.build(); super.init(); diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 7558b2a..8530f85 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -28,9 +28,9 @@ ], "accessWidener": "sigma_utils.accesswidener", "depends": { - "fabricloader": ">=0.14.13", + "fabricloader": ">=0.14.21", "fabric": "*", - "minecraft": "1.19.4" + "minecraft": "1.20" }, "custom": { "modmenu": { From ca0ed0ee0d3edf8dd30ae3e88080dcdedf29b1a8 Mon Sep 17 00:00:00 2001 From: Connor Slade Date: Fri, 16 Jun 2023 14:10:43 -0400 Subject: [PATCH 3/4] Rename matrices to drawContext --- .../connorcode/sigmautils/commands/Note.java | 10 +++--- .../sigmautils/config/ConfigGui.java | 8 ++--- .../sigmautils/config/ModuleConfigGui.java | 13 +++---- .../config/settings/DynamicListSetting.java | 14 ++++---- .../config/settings/SelectorSetting.java | 10 +++--- .../sigmautils/misc/Components.java | 34 +++++++++---------- .../mixin/DownloadingTerrainScreenMixin.java | 4 +-- .../sigmautils/mixin/InGameHudMixin.java | 4 +-- .../mixin/MultiplayerScreenMixin.java | 4 +-- .../sigmautils/mixin/TitleScreenMixin.java | 2 +- .../modules/_interface/ConfirmDisconnect.java | 8 ++--- .../modules/rendering/EntityHighlight.java | 4 +-- 12 files changed, 58 insertions(+), 57 deletions(-) diff --git a/src/main/java/com/connorcode/sigmautils/commands/Note.java b/src/main/java/com/connorcode/sigmautils/commands/Note.java index 1d24d22..49e612f 100644 --- a/src/main/java/com/connorcode/sigmautils/commands/Note.java +++ b/src/main/java/com/connorcode/sigmautils/commands/Note.java @@ -142,19 +142,19 @@ protected void init() { } @Override - public void render(DrawContext matrices, int mouseX, int mouseY, float delta) { - renderBackground(matrices); + public void render(DrawContext drawContext, int mouseX, int mouseY, float delta) { + renderBackground(drawContext); var lines = textRenderer.wrapLines(StringVisitable.plain(note.text), noteWidth); var startX = width / 2f - noteWidth / 2f; var height = lines.size() * 10; - matrices.fill((int) startX, 0, (int) (startX + noteWidth), height, 0x7F000000); + drawContext.fill((int) startX, 0, (int) (startX + noteWidth), height, 0x7F000000); for (int i = 0; i < lines.size(); i++) - matrices.drawText(textRenderer, lines.get(i), (int) startX, i * 10, 0xFFFFFF, false); + drawContext.drawText(textRenderer, lines.get(i), (int) startX, i * 10, 0xFFFFFF, false); - super.render(matrices, mouseX, mouseY, delta); + super.render(drawContext, mouseX, mouseY, delta); } } } diff --git a/src/main/java/com/connorcode/sigmautils/config/ConfigGui.java b/src/main/java/com/connorcode/sigmautils/config/ConfigGui.java index 624affc..031d393 100644 --- a/src/main/java/com/connorcode/sigmautils/config/ConfigGui.java +++ b/src/main/java/com/connorcode/sigmautils/config/ConfigGui.java @@ -69,15 +69,15 @@ protected void init() { }).position(width - githubLen - padding * 5, height - 20 - padding).size(githubLen + padding * 4, 20).build()); } - public void render(DrawContext matrices, int mouseX, int mouseY, float delta) { + public void render(DrawContext drawContext, int mouseX, int mouseY, float delta) { int padding = getPadding(); - this.renderBackground(matrices); + this.renderBackground(drawContext); for (int x = 0; x < Category.values().length; x++) - matrices.drawCenteredTextWithShadow(textRenderer, Text.of("§f§n§l" + Category.values()[x].toString()), + drawContext.drawCenteredTextWithShadow(textRenderer, Text.of("§f§n§l" + Category.values()[x].toString()), 75 + padding + x * (150 + padding), padding, 0); - super.render(matrices, mouseX, mouseY, delta); + super.render(drawContext, mouseX, mouseY, delta); } public void close() { diff --git a/src/main/java/com/connorcode/sigmautils/config/ModuleConfigGui.java b/src/main/java/com/connorcode/sigmautils/config/ModuleConfigGui.java index 56ff039..8094bba 100644 --- a/src/main/java/com/connorcode/sigmautils/config/ModuleConfigGui.java +++ b/src/main/java/com/connorcode/sigmautils/config/ModuleConfigGui.java @@ -83,25 +83,26 @@ public void close() { } @Override - public void render(DrawContext matrices, int mouseX, int mouseY, float delta) { - Setting.RenderData renderData = new Setting.RenderData(this, matrices, mouseX, mouseY, delta); + public void render(DrawContext drawContext, int mouseX, int mouseY, float delta) { + Setting.RenderData renderData = new Setting.RenderData(this, drawContext, mouseX, mouseY, delta); int padding = getPadding(); - this.renderBackground(matrices); - super.render(matrices, mouseX, mouseY, delta); + this.renderBackground(drawContext); + super.render(drawContext, mouseX, mouseY, delta); int x = -75 + 20 + padding; for (Pair>> entry : settings) { x += 150 + padding; if (entry.getLeft() != null) - matrices.drawCenteredTextWithShadow(textRenderer, Text.of(String.format("§f§n§l%s", entry.getLeft())), + drawContext.drawCenteredTextWithShadow(textRenderer, + Text.of(String.format("§f§n§l%s", entry.getLeft())), x, padding * 2 + textRenderer.fontHeight, 0); for (Setting setting : entry.getRight()) setting.render(renderData, x - 75, elementPositions.get(setting.getName())); } - matrices.drawCenteredTextWithShadow(textRenderer, Text.of(String.format("§f§n§l%s Settings", module.name)), + drawContext.drawCenteredTextWithShadow(textRenderer, Text.of(String.format("§f§n§l%s Settings", module.name)), width / 2, padding, 0); } diff --git a/src/main/java/com/connorcode/sigmautils/config/settings/DynamicListSetting.java b/src/main/java/com/connorcode/sigmautils/config/settings/DynamicListSetting.java index 269461b..e50a706 100644 --- a/src/main/java/com/connorcode/sigmautils/config/settings/DynamicListSetting.java +++ b/src/main/java/com/connorcode/sigmautils/config/settings/DynamicListSetting.java @@ -171,10 +171,10 @@ public void close() { } @Override - public void render(DrawContext matrices, int mouseX, int mouseY, float delta) { - renderBackground(matrices); - super.render(matrices, mouseX, mouseY, delta); - this.searchField.render(matrices, mouseX, mouseY, delta); + public void render(DrawContext drawContext, int mouseX, int mouseY, float delta) { + renderBackground(drawContext); + super.render(drawContext, mouseX, mouseY, delta); + this.searchField.render(drawContext, mouseX, mouseY, delta); } @Override @@ -250,9 +250,9 @@ public void close() { } @Override - public void render(DrawContext matrices, int mouseX, int mouseY, float delta) { - renderBackground(matrices); - super.render(matrices, mouseX, mouseY, delta); + public void render(DrawContext drawContext, int mouseX, int mouseY, float delta) { + renderBackground(drawContext); + super.render(drawContext, mouseX, mouseY, delta); } @Override diff --git a/src/main/java/com/connorcode/sigmautils/config/settings/SelectorSetting.java b/src/main/java/com/connorcode/sigmautils/config/settings/SelectorSetting.java index d2852db..28f15de 100644 --- a/src/main/java/com/connorcode/sigmautils/config/settings/SelectorSetting.java +++ b/src/main/java/com/connorcode/sigmautils/config/settings/SelectorSetting.java @@ -136,9 +136,9 @@ protected void init() { } @Override - public void render(DrawContext matrices, int mouseX, int mouseY, float delta) { - this.selectorWidget.render(matrices, mouseX, mouseY, delta); - super.render(matrices, mouseX, mouseY, delta); + public void render(DrawContext drawContext, int mouseX, int mouseY, float delta) { + this.selectorWidget.render(drawContext, mouseX, mouseY, delta); + super.render(drawContext, mouseX, mouseY, delta); } @Override @@ -183,8 +183,8 @@ public boolean equals(Object obj) { } @Override - public void render(DrawContext matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) { - matrices.drawText(SelectorWidget.this.client.textRenderer, this.value, + public void render(DrawContext drawContext, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) { + drawContext.drawText(SelectorWidget.this.client.textRenderer, this.value, (int) (width / 2f - client.textRenderer.getWidth(this.value) / 2f), y + 1, 16777215, true); } diff --git a/src/main/java/com/connorcode/sigmautils/misc/Components.java b/src/main/java/com/connorcode/sigmautils/misc/Components.java index 1253bec..40c03f2 100644 --- a/src/main/java/com/connorcode/sigmautils/misc/Components.java +++ b/src/main/java/com/connorcode/sigmautils/misc/Components.java @@ -101,12 +101,12 @@ protected ScrollableScreen(Text title, int padding, int entryHeight, int entryWi } @Override - public void render(DrawContext matrices, int mouseX, int mouseY, float delta) { + public void render(DrawContext drawContext, int mouseX, int mouseY, float delta) { var xStart = startX(); - matrices.fill(xStart, 0, xStart + entryWidth, height, 0x80000000); + drawContext.fill(xStart, 0, xStart + entryWidth, height, 0x80000000); var drawables = ((ScreenAccessor) this).getDrawables(); for (var i : drawables) - i.render(matrices, mouseX, mouseY, delta); + i.render(drawContext, mouseX, mouseY, delta); } protected abstract double maxScroll(); @@ -156,10 +156,10 @@ protected boolean isValidClickButton(int button) { } @Override - public void render(DrawContext matrices, int mouseX, int mouseY, float delta) { - super.render(matrices, mouseX, mouseY, delta); - if (this.hovered) tooltipSupplier.onTooltip(this, matrices, mouseX, mouseY); - super.render(matrices, mouseX, mouseY, delta); + public void render(DrawContext drawContext, int mouseX, int mouseY, float delta) { + super.render(drawContext, mouseX, mouseY, delta); + if (this.hovered) tooltipSupplier.onTooltip(this, drawContext, mouseX, mouseY); + super.render(drawContext, mouseX, mouseY, delta); } public interface PressAction { @@ -167,7 +167,7 @@ public interface PressAction { } public interface TooltipSupplier { - void onTooltip(MultiClickButton button, DrawContext matrices, int mouseX, int mouseY); + void onTooltip(MultiClickButton button, DrawContext drawContext, int mouseX, int mouseY); } } @@ -182,15 +182,15 @@ protected Text tooltip() { } @Override - public void render(DrawContext matrices, int mouseX, int mouseY, float delta) { - super.render(matrices, mouseX, mouseY, delta); + public void render(DrawContext drawContext, int mouseX, int mouseY, float delta) { + super.render(drawContext, mouseX, mouseY, delta); if (!this.hovered) return; Text tooltip = this.tooltip(); if (tooltip == null) return; - matrices.drawOrderedTooltip(client.textRenderer, client.textRenderer.wrapLines(tooltip, 200), mouseX, + drawContext.drawOrderedTooltip(client.textRenderer, client.textRenderer.wrapLines(tooltip, 200), mouseX, mouseY); } } @@ -211,15 +211,15 @@ public void onPress() { this.onPress.onPress(this); } - public void renderTooltip(DrawContext matrices, int mouseX, int mouseY) { - tooltipSupplier.onTooltip(this, matrices, mouseX, mouseY); + public void renderTooltip(DrawContext drawContext, int mouseX, int mouseY) { + tooltipSupplier.onTooltip(this, drawContext, mouseX, mouseY); } @Override - public void renderButton(DrawContext matrices, int mouseX, int mouseY, float delta) { - super.renderButton(matrices, mouseX, mouseY, delta); + public void renderButton(DrawContext drawContext, int mouseX, int mouseY, float delta) { + super.renderButton(drawContext, mouseX, mouseY, delta); if (this.isSelected()) - this.renderTooltip(matrices, mouseX, mouseY); + this.renderTooltip(drawContext, mouseX, mouseY); } public interface PressAction { @@ -227,7 +227,7 @@ public interface PressAction { } public interface TooltipSupplier { - void onTooltip(EventCheckbox button, DrawContext matrices, int mouseX, int mouseY); + void onTooltip(EventCheckbox button, DrawContext drawContext, int mouseX, int mouseY); } } } diff --git a/src/main/java/com/connorcode/sigmautils/mixin/DownloadingTerrainScreenMixin.java b/src/main/java/com/connorcode/sigmautils/mixin/DownloadingTerrainScreenMixin.java index f6d3449..945e4a2 100644 --- a/src/main/java/com/connorcode/sigmautils/mixin/DownloadingTerrainScreenMixin.java +++ b/src/main/java/com/connorcode/sigmautils/mixin/DownloadingTerrainScreenMixin.java @@ -33,8 +33,8 @@ void onRenderBackground(DownloadingTerrainScreen instance, DrawContext drawConte } @Inject(method = "render", at = @At("HEAD")) - void onRender(DrawContext matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) { + void onRender(DrawContext drawContext, int mouseX, int mouseY, float delta, CallbackInfo ci) { if (Config.getEnabled(SeeThruLoading.class)) - matrices.fillGradient(0, 0, this.width, this.height, -1072689136, -804253680); + drawContext.fillGradient(0, 0, this.width, this.height, -1072689136, -804253680); } } diff --git a/src/main/java/com/connorcode/sigmautils/mixin/InGameHudMixin.java b/src/main/java/com/connorcode/sigmautils/mixin/InGameHudMixin.java index 258ba51..aeb854e 100644 --- a/src/main/java/com/connorcode/sigmautils/mixin/InGameHudMixin.java +++ b/src/main/java/com/connorcode/sigmautils/mixin/InGameHudMixin.java @@ -60,10 +60,10 @@ void onRenderCrosshair(DrawContext ctx, CallbackInfo ci) { } @Inject(method = "render", at = @At("TAIL")) - void onRender(DrawContext matrices, float tickDelta, CallbackInfo ci) { + void onRender(DrawContext drawContext, float tickDelta, CallbackInfo ci) { if (client.options.hudHidden || !Config.getEnabled(Hud.class)) return; - Hud.renderHud(matrices); + Hud.renderHud(drawContext); } @Redirect(method = "renderScoreboardSidebar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/TextRenderer;getWidth(Ljava/lang/String;)I")) diff --git a/src/main/java/com/connorcode/sigmautils/mixin/MultiplayerScreenMixin.java b/src/main/java/com/connorcode/sigmautils/mixin/MultiplayerScreenMixin.java index deca44f..6b5e9bc 100644 --- a/src/main/java/com/connorcode/sigmautils/mixin/MultiplayerScreenMixin.java +++ b/src/main/java/com/connorcode/sigmautils/mixin/MultiplayerScreenMixin.java @@ -26,9 +26,9 @@ void onInit(CallbackInfo ci) { return; addDrawableChild(new Components.DrawableElement() { @Override - public void render(DrawContext matrices, int mouseX, int mouseY, float delta) { + public void render(DrawContext drawContext, int mouseX, int mouseY, float delta) { var text = NetworkUtils.getAuthStatus().getText(); - matrices.drawText(Objects.requireNonNull(client).textRenderer, text, + drawContext.drawText(Objects.requireNonNull(client).textRenderer, text, width - client.textRenderer.getWidth(text) - 10, 10, 0xFFFFFF, false); } }); diff --git a/src/main/java/com/connorcode/sigmautils/mixin/TitleScreenMixin.java b/src/main/java/com/connorcode/sigmautils/mixin/TitleScreenMixin.java index db9255a..ecdc2db 100644 --- a/src/main/java/com/connorcode/sigmautils/mixin/TitleScreenMixin.java +++ b/src/main/java/com/connorcode/sigmautils/mixin/TitleScreenMixin.java @@ -52,7 +52,7 @@ void init(CallbackInfo ci) { // For splash_refresh @Inject(method = "render", at = @At("HEAD")) - void onRender(DrawContext matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) { + void onRender(DrawContext drawContext, int mouseX, int mouseY, float delta, CallbackInfo ci) { long now = System.currentTimeMillis(); if (!Config.getEnabled(SplashRefresh.class) || now - updateTime < SplashRefresh.refreshTime.intValue() * 1000L) return; diff --git a/src/main/java/com/connorcode/sigmautils/modules/_interface/ConfirmDisconnect.java b/src/main/java/com/connorcode/sigmautils/modules/_interface/ConfirmDisconnect.java index 3673220..3456f2b 100644 --- a/src/main/java/com/connorcode/sigmautils/modules/_interface/ConfirmDisconnect.java +++ b/src/main/java/com/connorcode/sigmautils/modules/_interface/ConfirmDisconnect.java @@ -48,14 +48,14 @@ protected void init() { } @Override - public void render(DrawContext matrices, int mouseX, int mouseY, float delta) { + public void render(DrawContext drawContext, int mouseX, int mouseY, float delta) { assert client != null; - matrices.fillGradient(0, 0, this.width, this.height, -1072689136, -804253680); + drawContext.fillGradient(0, 0, this.width, this.height, -1072689136, -804253680); Text text = Text.of("Do you want to disconnect?"); - matrices.drawText(client.textRenderer, text.asOrderedText(), + drawContext.drawText(client.textRenderer, text.asOrderedText(), this.width / 2 - textRenderer.getWidth(text) / 2, this.height / 4 - 20 - textRenderer.fontHeight / 2, 16777215, false); - super.render(matrices, mouseX, mouseY, delta); + super.render(drawContext, mouseX, mouseY, delta); } } } diff --git a/src/main/java/com/connorcode/sigmautils/modules/rendering/EntityHighlight.java b/src/main/java/com/connorcode/sigmautils/modules/rendering/EntityHighlight.java index 02b8f66..b75bac4 100644 --- a/src/main/java/com/connorcode/sigmautils/modules/rendering/EntityHighlight.java +++ b/src/main/java/com/connorcode/sigmautils/modules/rendering/EntityHighlight.java @@ -125,8 +125,8 @@ public void render(GlowingEntity resource, Screen screen, int x, int y) { } else { Util.addChild(screen, new Components.DrawableElement() { @Override - public void render(DrawContext matrices, int mouseX, int mouseY, float delta) { - matrices.fill(x + 20 + padding, y + padding, x - padding + 40, y - padding + 20, + public void render(DrawContext drawContext, int mouseX, int mouseY, float delta) { + drawContext.fill(x + 20 + padding, y + padding, x - padding + 40, y - padding + 20, getColor(resource.color)); } From 19dbec6a4bc69022cade9ab13681c209ebb9ec51 Mon Sep 17 00:00:00 2001 From: Connor Slade Date: Wed, 28 Jun 2023 13:53:40 -0400 Subject: [PATCH 4/4] Prepare for publish --- gradle.properties | 2 +- .../java/com/connorcode/sigmautils/mixin/TitleScreenMixin.java | 2 +- .../connorcode/sigmautils/modules/server/BridgeAnalysis.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 6499f1f..8c2a8ff 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ minecraft_version=1.20 yarn_mappings=1.20+build.1 loader_version=0.14.21 # Mod Properties -mod_version=0.1.3_alpha +mod_version=0.1.4_alpha maven_group=com.connorcode archives_base_name=sigma-utils # Dependencies diff --git a/src/main/java/com/connorcode/sigmautils/mixin/TitleScreenMixin.java b/src/main/java/com/connorcode/sigmautils/mixin/TitleScreenMixin.java index ecdc2db..9dacbc6 100644 --- a/src/main/java/com/connorcode/sigmautils/mixin/TitleScreenMixin.java +++ b/src/main/java/com/connorcode/sigmautils/mixin/TitleScreenMixin.java @@ -26,10 +26,10 @@ @Mixin(TitleScreen.class) public class TitleScreenMixin extends Screen { + long updateTime; @Shadow @Nullable private SplashTextRenderer splashText; - long updateTime; protected TitleScreenMixin(Text title) { super(title); diff --git a/src/main/java/com/connorcode/sigmautils/modules/server/BridgeAnalysis.java b/src/main/java/com/connorcode/sigmautils/modules/server/BridgeAnalysis.java index 012f002..fb62050 100644 --- a/src/main/java/com/connorcode/sigmautils/modules/server/BridgeAnalysis.java +++ b/src/main/java/com/connorcode/sigmautils/modules/server/BridgeAnalysis.java @@ -35,7 +35,7 @@ public void init() { if (!this.enabled) return; if (!(packet.get() instanceof TitleS2CPacket title)) return; var regex = Pattern.compile(endRegex.value()); - if (!regex.matcher(title.getTitle().getString()).matches()) return; + if (!regex.matcher(title.getTitle().getString()).matches()) {} // wdl });