From 301fa2ebbc9a8a8a6849514e3825a2990d502391 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 22 Sep 2021 07:19:31 +0200 Subject: [PATCH 1/9] Fix HackListHUD glitching out when opening ClickGUI --- src/main/java/net/wurstclient/hack/Hack.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/wurstclient/hack/Hack.java b/src/main/java/net/wurstclient/hack/Hack.java index 0dc16778dc..a2b0c16c1c 100644 --- a/src/main/java/net/wurstclient/hack/Hack.java +++ b/src/main/java/net/wurstclient/hack/Hack.java @@ -11,6 +11,7 @@ import net.wurstclient.Category; import net.wurstclient.Feature; +import net.wurstclient.hacks.ClickGuiHack; import net.wurstclient.hacks.NavigatorHack; import net.wurstclient.hacks.TooManyHaxHack; @@ -76,7 +77,7 @@ public final void setEnabled(boolean enabled) this.enabled = enabled; - if(!(this instanceof NavigatorHack)) + if(!(this instanceof NavigatorHack || this instanceof ClickGuiHack)) WURST.getHud().getHackList().updateState(this); if(enabled) From 25af63b7b1fa2b58b578d5b9f156d94fc12cf797 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 22 Sep 2021 07:44:01 +0200 Subject: [PATCH 2/9] Add sorting settings to HackListOtf --- .../java/net/wurstclient/hud/HackListHUD.java | 41 ++++------- .../other_features/HackListOtf.java | 70 +++++++++++++++++++ 2 files changed, 82 insertions(+), 29 deletions(-) diff --git a/src/main/java/net/wurstclient/hud/HackListHUD.java b/src/main/java/net/wurstclient/hud/HackListHUD.java index fa36e86c6e..072f55b781 100644 --- a/src/main/java/net/wurstclient/hud/HackListHUD.java +++ b/src/main/java/net/wurstclient/hud/HackListHUD.java @@ -9,6 +9,7 @@ import java.util.ArrayList; import java.util.Collections; +import java.util.Comparator; import java.util.Iterator; import net.minecraft.client.font.TextRenderer; @@ -53,11 +54,6 @@ public void render(MatrixStack matrixStack, float partialTicks) }else textColor = 0x04ffffff; - - // YesCheat+ mode indicator - // YesCheatSpf yesCheatSpf = WurstClient.INSTANCE.special.yesCheatSpf; - // if(yesCheatSpf.modeIndicator.isChecked()) - // drawString("YesCheat+: " + yesCheatSpf.getProfile().getName()); int height = posY + activeHax.size() * 9; Window sr = WurstClient.MC.getWindow(); @@ -96,15 +92,25 @@ public void updateState(Hack hack) return; activeHax.add(entry); - Collections.sort(activeHax); + sort(); }else if(!otf.isAnimations()) activeHax.remove(entry); } + private void sort() + { + Comparator comparator = + Comparator.comparing(hle -> hle.hack, otf.getComparator()); + Collections.sort(activeHax, comparator); + } + @Override public void onUpdate() { + if(otf.shouldSort()) + sort(); + if(!otf.isAnimations()) return; @@ -172,7 +178,6 @@ private void drawWithOffset(MatrixStack matrixStack, HackListEntry e, } private static final class HackListEntry - implements Comparable { private final Hack hack; private int offset; @@ -184,27 +189,5 @@ public HackListEntry(Hack mod, int offset) this.offset = offset; prevOffset = offset; } - - @Override - public int compareTo(HackListEntry o) - { - return hack.getRenderName() - .compareToIgnoreCase(o.hack.getRenderName()); - } - - @Override - public boolean equals(Object obj) - { - if(!(obj instanceof HackListEntry other)) - return false; - - return hack == other.hack; - } - - @Override - public int hashCode() - { - return hack.hashCode(); - } } } diff --git a/src/main/java/net/wurstclient/other_features/HackListOtf.java b/src/main/java/net/wurstclient/other_features/HackListOtf.java index cdc5863af6..d31377f5cb 100644 --- a/src/main/java/net/wurstclient/other_features/HackListOtf.java +++ b/src/main/java/net/wurstclient/other_features/HackListOtf.java @@ -7,8 +7,12 @@ */ package net.wurstclient.other_features; +import java.util.Comparator; + import net.wurstclient.DontBlock; import net.wurstclient.SearchTags; +import net.wurstclient.WurstClient; +import net.wurstclient.hack.Hack; import net.wurstclient.other_feature.OtherFeature; import net.wurstclient.settings.CheckboxSetting; import net.wurstclient.settings.EnumSetting; @@ -29,9 +33,18 @@ public final class HackListOtf extends OtherFeature private final EnumSetting position = new EnumSetting<>("Position", Position.values(), Position.LEFT); + private final EnumSetting sortBy = + new EnumSetting<>("Sort by", SortBy.values(), SortBy.NAME); + + private final CheckboxSetting revSort = + new CheckboxSetting("Reverse sorting", false); + private final CheckboxSetting animations = new CheckboxSetting("Animations", true); + private SortBy prevSortBy; + private Boolean prevRevSort; + public HackListOtf() { super("HackList", "Shows a list of active hacks on the screen.\n" @@ -40,6 +53,8 @@ public HackListOtf() addSetting(mode); addSetting(position); + addSetting(sortBy); + addSetting(revSort); addSetting(animations); } @@ -58,6 +73,38 @@ public boolean isAnimations() return animations.isChecked(); } + public Comparator getComparator() + { + if(revSort.isChecked()) + return sortBy.getSelected().comparator.reversed(); + + return sortBy.getSelected().comparator; + } + + public boolean shouldSort() + { + try + { + // width of a renderName could change at any time + // must sort the HackList every tick + if(sortBy.getSelected() == SortBy.WIDTH) + return true; + + if(sortBy.getSelected() != prevSortBy) + return true; + + if(!Boolean.valueOf(revSort.isChecked()).equals(prevRevSort)) + return true; + + return false; + + }finally + { + prevSortBy = sortBy.getSelected(); + prevRevSort = revSort.isChecked(); + } + } + public static enum Mode { AUTO("Auto"), @@ -99,4 +146,27 @@ public String toString() return name; } } + + public static enum SortBy + { + NAME("Name", (a, b) -> a.getName().compareToIgnoreCase(b.getName())), + + WIDTH("Width", Comparator.comparingInt( + h -> WurstClient.MC.textRenderer.getWidth(h.getRenderName()))); + + private final String name; + private final Comparator comparator; + + private SortBy(String name, Comparator comparator) + { + this.name = name; + this.comparator = comparator; + } + + @Override + public String toString() + { + return name; + } + } } From 523a0949d2ac1159edfa89fb5c583bc05a0560f0 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 22 Sep 2021 08:46:54 +0200 Subject: [PATCH 3/9] Fix SettingsWindow sometimes opening at the wrong position --- src/main/java/net/wurstclient/clickgui/SettingsWindow.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/net/wurstclient/clickgui/SettingsWindow.java b/src/main/java/net/wurstclient/clickgui/SettingsWindow.java index 60c9840b3d..178fdd2ac1 100644 --- a/src/main/java/net/wurstclient/clickgui/SettingsWindow.java +++ b/src/main/java/net/wurstclient/clickgui/SettingsWindow.java @@ -9,6 +9,7 @@ import java.util.stream.Stream; +import net.minecraft.util.math.MathHelper; import net.wurstclient.Feature; import net.wurstclient.WurstClient; import net.wurstclient.settings.Setting; @@ -24,6 +25,7 @@ public SettingsWindow(Feature feature, Window parent, int buttonY) setClosable(true); setMinimizable(false); + setMaxHeight(187); pack(); setInitialPosition(parent, buttonY); @@ -41,6 +43,9 @@ private void setInitialPosition(Window parent, int buttonY) if(y + getHeight() > mcWindow.getScaledHeight()) y -= getHeight() - 14; + x = MathHelper.clamp(x, 0, mcWindow.getScaledWidth()); + y = MathHelper.clamp(y, 0, mcWindow.getScaledHeight()); + setX(x); setY(y); } From 00d2db076c87b3ccdbbfa926dc45a4af0c3a0619 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Thu, 23 Sep 2021 23:20:10 +0200 Subject: [PATCH 4/9] Fix duplicated entries in HackListHUD --- .../java/net/wurstclient/hud/HackListHUD.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/java/net/wurstclient/hud/HackListHUD.java b/src/main/java/net/wurstclient/hud/HackListHUD.java index 072f55b781..93e6a48d7f 100644 --- a/src/main/java/net/wurstclient/hud/HackListHUD.java +++ b/src/main/java/net/wurstclient/hud/HackListHUD.java @@ -189,5 +189,20 @@ public HackListEntry(Hack mod, int offset) this.offset = offset; prevOffset = offset; } + + @Override + public boolean equals(Object obj) + { + if(!(obj instanceof HackListEntry other)) + return false; + + return hack == other.hack; + } + + @Override + public int hashCode() + { + return hack.hashCode(); + } } } From 065b38136c47ade00ccc90a947242a299bb94838 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Thu, 23 Sep 2021 23:29:43 +0200 Subject: [PATCH 5/9] Fix HackListEntry breaking Eclipse --- src/main/java/net/wurstclient/hud/HackListHUD.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/wurstclient/hud/HackListHUD.java b/src/main/java/net/wurstclient/hud/HackListHUD.java index 93e6a48d7f..78f4f4af78 100644 --- a/src/main/java/net/wurstclient/hud/HackListHUD.java +++ b/src/main/java/net/wurstclient/hud/HackListHUD.java @@ -193,9 +193,12 @@ public HackListEntry(Hack mod, int offset) @Override public boolean equals(Object obj) { - if(!(obj instanceof HackListEntry other)) + // do not use Java 16 syntax here, + // it breaks Eclipse's Clean Up feature + if(!(obj instanceof HackListEntry)) return false; + HackListEntry other = (HackListEntry)obj; return hack == other.hack; } From 4fae6035a7ee600d519240a963b721f21e88f522 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Thu, 23 Sep 2021 23:34:55 +0200 Subject: [PATCH 6/9] Change version to 7.17.1 --- src/main/java/net/wurstclient/WurstClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index f77412c338..4321d9d589 100644 --- a/src/main/java/net/wurstclient/WurstClient.java +++ b/src/main/java/net/wurstclient/WurstClient.java @@ -56,7 +56,7 @@ public enum WurstClient public static final MinecraftClient MC = MinecraftClient.getInstance(); public static final IMinecraftClient IMC = (IMinecraftClient)MC; - public static final String VERSION = "7.17"; + public static final String VERSION = "7.17.1"; public static final String MC_VERSION = "1.17.1"; private WurstAnalytics analytics; From d350bc744cf19a64550ce822565b5a7edc4d11b6 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Fri, 24 Sep 2021 22:05:20 +0200 Subject: [PATCH 7/9] Properly change version to 7.17.1 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 78d7df9187..1f7d6ca3ce 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ loader_version=0.11.6 fabric_version=0.37.1+1.17 # Mod Properties -mod_version = v7.17-MC1.17.1 +mod_version = v7.17.1-MC1.17.1 maven_group = net.wurstclient archives_base_name = Wurst-Client From ce4286e02c1b4a7ddc91ad9f438f263ddcf199dc Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Fri, 24 Sep 2021 22:41:59 +0200 Subject: [PATCH 8/9] Fix ModMenu breaking AltManager button Fixes #54 --- .../wurstclient/mixin/TitleScreenMixin.java | 41 +++++++++++++++---- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java index 4c5d282dc4..5d0b4b56ca 100644 --- a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java @@ -27,32 +27,55 @@ @Mixin(TitleScreen.class) public abstract class TitleScreenMixin extends Screen { + private ClickableWidget realmsButton = null; + private ButtonWidget altsButton; + private TitleScreenMixin(WurstClient wurst, Text text_1) { super(text_1); } - @Inject(at = {@At("RETURN")}, method = {"initWidgetsNormal(II)V"}) - private void onInitWidgetsNormal(int y, int spacingY, CallbackInfo ci) + @Inject(at = {@At("RETURN")}, method = {"init()V"}) + private void onInitWidgetsNormal(CallbackInfo ci) { if(!WurstClient.INSTANCE.isEnabled()) return; - addDrawableChild(new ButtonWidget(width / 2 + 2, y + spacingY * 2, 98, - 20, new LiteralText("Alt Manager"), - b -> client.setScreen(new AltManagerScreen(this, - WurstClient.INSTANCE.getAltManager())))); - for(Drawable d : ((IScreen)this).getButtons()) { - if(!(d instanceof ClickableWidget button)) + if(!(d instanceof ClickableWidget)) continue; + ClickableWidget button = (ClickableWidget)d; if(!button.getMessage().getString() .equals(I18n.translate("menu.online"))) continue; - button.setWidth(98); + realmsButton = button; + break; } + + if(realmsButton == null) + throw new IllegalStateException("Couldn't find realms button!"); + + // make Realms button smaller + realmsButton.setWidth(98); + + // add AltManager button + addDrawableChild(altsButton = new ButtonWidget(width / 2 + 2, + realmsButton.y, 98, 20, new LiteralText("Alt Manager"), + b -> client.setScreen(new AltManagerScreen(this, + WurstClient.INSTANCE.getAltManager())))); + } + + @Inject(at = {@At("RETURN")}, method = {"tick()V"}) + private void onTick(CallbackInfo ci) + { + if(realmsButton == null || altsButton == null) + return; + + // adjust AltManager button if Realms button has been moved + // happens when ModMenu is installed + altsButton.y = realmsButton.y; } } From b4ed10adf8ffc5d372b28d370857c69aa46e3139 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Tue, 28 Sep 2021 03:23:18 +0200 Subject: [PATCH 9/9] Fix PlayerEspHack tracer color Closes #472 --- .../net/wurstclient/hacks/PlayerEspHack.java | 47 +++++++++++++------ 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/PlayerEspHack.java b/src/main/java/net/wurstclient/hacks/PlayerEspHack.java index 96176049a1..5b920c92b7 100644 --- a/src/main/java/net/wurstclient/hacks/PlayerEspHack.java +++ b/src/main/java/net/wurstclient/hacks/PlayerEspHack.java @@ -27,6 +27,7 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; +import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Matrix4f; import net.minecraft.util.math.Vec3d; import net.wurstclient.Category; @@ -189,35 +190,51 @@ private void renderBoxes(MatrixStack matrixStack, double partialTicks, private void renderTracers(MatrixStack matrixStack, double partialTicks, int regionX, int regionZ) { - Vec3d start = - RotationUtils.getClientLookVec().add(RenderUtils.getCameraPos()); + RenderSystem.setShader(GameRenderer::getPositionColorShader); + RenderSystem.setShaderColor(1, 1, 1, 1); Matrix4f matrix = matrixStack.peek().getModel(); - BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer(); - RenderSystem.setShader(GameRenderer::getPositionShader); + BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer(); bufferBuilder.begin(VertexFormat.DrawMode.DEBUG_LINES, - VertexFormats.POSITION); + VertexFormats.POSITION_COLOR); + + Vec3d start = RotationUtils.getClientLookVec() + .add(RenderUtils.getCameraPos()).subtract(regionX, 0, regionZ); + for(PlayerEntity e : players) { + Vec3d interpolationOffset = new Vec3d(e.getX(), e.getY(), e.getZ()) + .subtract(e.prevX, e.prevY, e.prevZ).multiply(1 - partialTicks); + Vec3d end = e.getBoundingBox().getCenter() - .subtract(new Vec3d(e.getX(), e.getY(), e.getZ()) - .subtract(e.prevX, e.prevY, e.prevZ) - .multiply(1 - partialTicks)); + .subtract(interpolationOffset).subtract(regionX, 0, regionZ); + + float r, g, b; if(WURST.getFriends().contains(e.getEntityName())) - RenderSystem.setShaderColor(0, 0, 1, 0.5F); - else + { + r = 0; + g = 0; + b = 1; + + }else { float f = MC.player.distanceTo(e) / 20F; - RenderSystem.setShaderColor(2 - f, f, 0, 0.5F); + r = MathHelper.clamp(2 - f, 0, 1); + g = MathHelper.clamp(f, 0, 1); + b = 0; } - bufferBuilder.vertex(matrix, (float)start.x - regionX, - (float)start.y, (float)start.z - regionZ).next(); - bufferBuilder.vertex(matrix, (float)end.x - regionX, (float)end.y, - (float)end.z - regionZ).next(); + bufferBuilder + .vertex(matrix, (float)start.x, (float)start.y, (float)start.z) + .color(r, g, b, 0.5F).next(); + + bufferBuilder + .vertex(matrix, (float)end.x, (float)end.y, (float)end.z) + .color(r, g, b, 0.5F).next(); } + bufferBuilder.end(); BufferRenderer.draw(bufferBuilder); }