From 71b81e9867abea878831acce049b171b526f849d Mon Sep 17 00:00:00 2001 From: Kendell R Date: Sat, 25 Dec 2021 09:52:31 -0800 Subject: [PATCH 001/282] Add stale issue checker --- .github/actions/stale.yaml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/actions/stale.yaml diff --git a/.github/actions/stale.yaml b/.github/actions/stale.yaml new file mode 100644 index 0000000000..1c87b981de --- /dev/null +++ b/.github/actions/stale.yaml @@ -0,0 +1,20 @@ +name: "Close stale issues / pull requests" +on: + schedule: + - cron: "30 1 * * *" + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v4 + with: + stale-issue-message: | + This issue has been open for a while. It will be closed soon if nobody comments on it. + Issues should be closed if: + - They are duplicates of other issues + - There is not enough demand + - They are no longer relevant + - There are not enough details + days-before-stale: 30 + days-before-close: 30 From 11c95355d4156733e7b39a17cef19f38f0f98dac Mon Sep 17 00:00:00 2001 From: Kendell R Date: Sun, 26 Dec 2021 07:58:05 -0800 Subject: [PATCH 002/282] Change time until stale to 2 months Requested by @buiawpkgew --- .github/actions/stale.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/stale.yaml b/.github/actions/stale.yaml index 1c87b981de..1bd15cadfa 100644 --- a/.github/actions/stale.yaml +++ b/.github/actions/stale.yaml @@ -16,5 +16,5 @@ jobs: - There is not enough demand - They are no longer relevant - There are not enough details - days-before-stale: 30 + days-before-stale: 60 days-before-close: 30 From 5d6c8cd5a3e7dafb55d1d47f98df15fd8c931ed9 Mon Sep 17 00:00:00 2001 From: DrMaxNix Date: Wed, 19 Oct 2022 20:16:51 +0200 Subject: [PATCH 003/282] :sparkles: add entity filter for allay --- .../wurstclient/hacks/KillauraLegitHack.java | 1 + .../net/wurstclient/hacks/ProtectHack.java | 1 + .../filterlists/AnchorAuraFilterList.java | 5 +++ .../filterlists/CrystalAuraFilterList.java | 5 +++ .../filterlists/EntityFilterList.java | 1 + .../filterlists/FollowFilterList.java | 3 ++ .../filterlists/RemoteViewFilterList.java | 3 ++ .../settings/filters/FilterAllaysSetting.java | 31 +++++++++++++++++++ 8 files changed, 50 insertions(+) create mode 100644 src/main/java/net/wurstclient/settings/filters/FilterAllaysSetting.java diff --git a/src/main/java/net/wurstclient/hacks/KillauraLegitHack.java b/src/main/java/net/wurstclient/hacks/KillauraLegitHack.java index 4f24fb1eee..5f2d150a79 100644 --- a/src/main/java/net/wurstclient/hacks/KillauraLegitHack.java +++ b/src/main/java/net/wurstclient/hacks/KillauraLegitHack.java @@ -81,6 +81,7 @@ public final class KillauraLegitHack extends Hack FilterPetsSetting.genericCombat(false), FilterTradersSetting.genericCombat(false), FilterGolemsSetting.genericCombat(false), + FilterAllaysSetting.genericCombat(false), FilterInvisibleSetting.genericCombat(true), FilterNamedSetting.genericCombat(false), FilterArmorStandsSetting.genericCombat(false), diff --git a/src/main/java/net/wurstclient/hacks/ProtectHack.java b/src/main/java/net/wurstclient/hacks/ProtectHack.java index 341bc800b3..807cb64b5b 100644 --- a/src/main/java/net/wurstclient/hacks/ProtectHack.java +++ b/src/main/java/net/wurstclient/hacks/ProtectHack.java @@ -60,6 +60,7 @@ public final class ProtectHack extends Hack FilterPetsSetting.genericCombat(false), FilterTradersSetting.genericCombat(false), FilterGolemsSetting.genericCombat(false), + FilterAllaysSetting.genericCombat(false), FilterInvisibleSetting.genericCombat(false), FilterNamedSetting.genericCombat(false), FilterArmorStandsSetting.genericCombat(false), diff --git a/src/main/java/net/wurstclient/settings/filterlists/AnchorAuraFilterList.java b/src/main/java/net/wurstclient/settings/filterlists/AnchorAuraFilterList.java index 9c34f3c742..ff87a16aa1 100644 --- a/src/main/java/net/wurstclient/settings/filterlists/AnchorAuraFilterList.java +++ b/src/main/java/net/wurstclient/settings/filterlists/AnchorAuraFilterList.java @@ -50,6 +50,11 @@ public static AnchorAuraFilterList create() + damageWarning, true)); + builder.add(new FilterAllaysSetting( + "Won't target allays when auto-placing anchors." + + damageWarning, + true)); + builder.add(new FilterInvisibleSetting( "Won't target invisible entities when auto-placing anchors." + damageWarning, diff --git a/src/main/java/net/wurstclient/settings/filterlists/CrystalAuraFilterList.java b/src/main/java/net/wurstclient/settings/filterlists/CrystalAuraFilterList.java index d8be378b56..b594fc8323 100644 --- a/src/main/java/net/wurstclient/settings/filterlists/CrystalAuraFilterList.java +++ b/src/main/java/net/wurstclient/settings/filterlists/CrystalAuraFilterList.java @@ -50,6 +50,11 @@ public static CrystalAuraFilterList create() + damageWarning, true)); + builder.add(new FilterAllaysSetting( + "Won't target allays when auto-placing crystals." + + damageWarning, + true)); + builder.add(new FilterInvisibleSetting( "Won't target invisible entities when auto-placing crystals." + damageWarning, diff --git a/src/main/java/net/wurstclient/settings/filterlists/EntityFilterList.java b/src/main/java/net/wurstclient/settings/filterlists/EntityFilterList.java index ae2053bdcf..a3fb2fffeb 100644 --- a/src/main/java/net/wurstclient/settings/filterlists/EntityFilterList.java +++ b/src/main/java/net/wurstclient/settings/filterlists/EntityFilterList.java @@ -63,6 +63,7 @@ public static EntityFilterList genericCombat() FilterPetsSetting.genericCombat(false), FilterTradersSetting.genericCombat(false), FilterGolemsSetting.genericCombat(false), + FilterAllaysSetting.genericCombat(false), FilterInvisibleSetting.genericCombat(false), FilterNamedSetting.genericCombat(false), FilterArmorStandsSetting.genericCombat(false), diff --git a/src/main/java/net/wurstclient/settings/filterlists/FollowFilterList.java b/src/main/java/net/wurstclient/settings/filterlists/FollowFilterList.java index f66d0292b2..22776f983b 100644 --- a/src/main/java/net/wurstclient/settings/filterlists/FollowFilterList.java +++ b/src/main/java/net/wurstclient/settings/filterlists/FollowFilterList.java @@ -56,6 +56,9 @@ public static FollowFilterList create() builder.add(new FilterGolemsSetting( "Won't follow iron golems, snow golems and shulkers.", true)); + builder.add(new FilterAllaysSetting( + "Won't follow allays.", true)); + builder.add(new FilterInvisibleSetting( "Won't follow invisible entities.", false)); diff --git a/src/main/java/net/wurstclient/settings/filterlists/RemoteViewFilterList.java b/src/main/java/net/wurstclient/settings/filterlists/RemoteViewFilterList.java index 8a30b52ba5..a0c1c624a2 100644 --- a/src/main/java/net/wurstclient/settings/filterlists/RemoteViewFilterList.java +++ b/src/main/java/net/wurstclient/settings/filterlists/RemoteViewFilterList.java @@ -55,6 +55,9 @@ public static RemoteViewFilterList create() builder.add(new FilterGolemsSetting( "Won't view iron golems, snow golems and shulkers.", true)); + builder.add(new FilterAllaysSetting( + "Won't view allays.", true)); + builder.add(new FilterInvisibleSetting("Won't view invisible entities.", false)); diff --git a/src/main/java/net/wurstclient/settings/filters/FilterAllaysSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterAllaysSetting.java new file mode 100644 index 0000000000..04053deace --- /dev/null +++ b/src/main/java/net/wurstclient/settings/filters/FilterAllaysSetting.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2014-2022 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.settings.filters; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.passive.AllayEntity; + +public final class FilterAllaysSetting extends EntityFilterCheckbox +{ + public FilterAllaysSetting(String description, boolean checked) + { + super("Filter allays", description, checked); + } + + @Override + public boolean test(Entity e) + { + return !(e instanceof AllayEntity); + } + + public static FilterAllaysSetting genericCombat(boolean checked) + { + return new FilterAllaysSetting( + "Won't attack allays.", checked); + } +} From 7f131f6a79e1f382db92881d5f2968d09a797738 Mon Sep 17 00:00:00 2001 From: ThisTestUser Date: Sat, 28 Jan 2023 13:51:59 -0500 Subject: [PATCH 004/282] Fix jitter issues Discontinue use of applyRenderOffset --- .../java/net/wurstclient/ai/PathFinder.java | 13 +++++--- .../java/net/wurstclient/ai/PathRenderer.java | 15 +++++---- .../net/wurstclient/hacks/BowAimbotHack.java | 10 ++++-- .../net/wurstclient/hacks/ExcavatorHack.java | 32 +++++++++++-------- .../net/wurstclient/hacks/FeedAuraHack.java | 10 ++++-- .../net/wurstclient/hacks/FreecamHack.java | 18 +++++++---- .../wurstclient/hacks/InstantBunkerHack.java | 12 +++++-- .../net/wurstclient/hacks/ItemEspHack.java | 14 ++++---- .../net/wurstclient/hacks/OverlayHack.java | 9 ++++-- .../wurstclient/hacks/PlayerFinderHack.java | 15 ++++++--- .../wurstclient/hacks/ProphuntEspHack.java | 10 ++++-- .../net/wurstclient/util/RenderUtils.java | 8 ----- 12 files changed, 103 insertions(+), 63 deletions(-) diff --git a/src/main/java/net/wurstclient/ai/PathFinder.java b/src/main/java/net/wurstclient/ai/PathFinder.java index f8f76b6177..5bb84d5931 100644 --- a/src/main/java/net/wurstclient/ai/PathFinder.java +++ b/src/main/java/net/wurstclient/ai/PathFinder.java @@ -562,7 +562,11 @@ public void renderPath(MatrixStack matrixStack, boolean debugMode, GL11.glDepthMask(false); matrixStack.push(); - RenderUtils.applyRenderOffset(matrixStack); + RenderUtils.applyRegionalRenderOffset(matrixStack); + + BlockPos camPos = RenderUtils.getCameraBlockPos(); + int regionX = (camPos.getX() >> 9) * 512; + int regionZ = (camPos.getZ() >> 9) * 512; matrixStack.translate(0.5, 0.5, 0.5); if(debugMode) @@ -576,7 +580,7 @@ public void renderPath(MatrixStack matrixStack, boolean debugMode, if(renderedThings >= 5000) break; - PathRenderer.renderNode(matrixStack, element); + PathRenderer.renderNode(matrixStack, element, regionX, regionZ); renderedThings++; } @@ -592,7 +596,7 @@ public void renderPath(MatrixStack matrixStack, boolean debugMode, RenderSystem.setShaderColor(1, 0, 0, 0.75F); PathRenderer.renderArrow(matrixStack, entry.getValue(), - entry.getKey()); + entry.getKey(), regionX, regionZ); renderedThings++; } } @@ -603,7 +607,8 @@ public void renderPath(MatrixStack matrixStack, boolean debugMode, else RenderSystem.setShaderColor(0, 1, 0, 0.75F); for(int i = 0; i < path.size() - 1; i++) - PathRenderer.renderArrow(matrixStack, path.get(i), path.get(i + 1)); + PathRenderer.renderArrow(matrixStack, path.get(i), path.get(i + 1), + regionX, regionZ); matrixStack.pop(); diff --git a/src/main/java/net/wurstclient/ai/PathRenderer.java b/src/main/java/net/wurstclient/ai/PathRenderer.java index 96dbfc166d..8a0ad39438 100644 --- a/src/main/java/net/wurstclient/ai/PathRenderer.java +++ b/src/main/java/net/wurstclient/ai/PathRenderer.java @@ -22,20 +22,20 @@ public final class PathRenderer { public static void renderArrow(MatrixStack matrixStack, BlockPos start, - BlockPos end) + BlockPos end, int regionX, int regionZ) { Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); bufferBuilder.begin(VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION); - int startX = start.getX(); + int startX = start.getX() - regionX; int startY = start.getY(); - int startZ = start.getZ(); + int startZ = start.getZ() - regionZ; - int endX = end.getX(); + int endX = end.getX() - regionX; int endY = end.getY(); - int endZ = end.getZ(); + int endZ = end.getZ() - regionZ; matrixStack.push(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); @@ -96,11 +96,12 @@ public static void renderArrow(MatrixStack matrixStack, BlockPos start, tessellator.draw(); } - public static void renderNode(MatrixStack matrixStack, BlockPos pos) + public static void renderNode(MatrixStack matrixStack, BlockPos pos, int regionX, int regionZ) { matrixStack.push(); - matrixStack.translate(pos.getX(), pos.getY(), pos.getZ()); + matrixStack.translate(pos.getX() - regionX, pos.getY(), + pos.getZ() - regionZ); matrixStack.scale(0.1F, 0.1F, 0.1F); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); diff --git a/src/main/java/net/wurstclient/hacks/BowAimbotHack.java b/src/main/java/net/wurstclient/hacks/BowAimbotHack.java index f5cbb7abd7..f17afc613f 100644 --- a/src/main/java/net/wurstclient/hacks/BowAimbotHack.java +++ b/src/main/java/net/wurstclient/hacks/BowAimbotHack.java @@ -34,6 +34,7 @@ import net.minecraft.item.CrossbowItem; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; import net.wurstclient.Category; import net.wurstclient.SearchTags; @@ -211,10 +212,15 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glDisable(GL11.GL_DEPTH_TEST); matrixStack.push(); - RenderUtils.applyRenderOffset(matrixStack); + RenderUtils.applyRegionalRenderOffset(matrixStack); + + BlockPos camPos = RenderUtils.getCameraBlockPos(); + int regionX = (camPos.getX() >> 9) * 512; + int regionZ = (camPos.getZ() >> 9) * 512; // set position - matrixStack.translate(target.getX(), target.getY(), target.getZ()); + matrixStack.translate(target.getX() - regionX, + target.getY(), target.getZ() - regionZ); // set size float boxWidth = target.getWidth() + 0.1F; diff --git a/src/main/java/net/wurstclient/hacks/ExcavatorHack.java b/src/main/java/net/wurstclient/hacks/ExcavatorHack.java index 54ab75fbd8..fac8c9d77c 100644 --- a/src/main/java/net/wurstclient/hacks/ExcavatorHack.java +++ b/src/main/java/net/wurstclient/hacks/ExcavatorHack.java @@ -92,9 +92,7 @@ public String getRenderName() public void onEnable() { // disable conflicting hacks - // TODO: - // WURST.getHax().bowAimbotMod.setEnabled(false); - // WURST.getHax().templateToolMod.setEnabled(false); + WURST.getHax().bowAimbotHack.setEnabled(false); WURST.getHax().autoMineHack.setEnabled(false); WURST.getHax().nukerHack.setEnabled(false); WURST.getHax().nukerLegitHack.setEnabled(false); @@ -161,7 +159,11 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glDisable(GL11.GL_DEPTH_TEST); matrixStack.push(); - RenderUtils.applyRenderOffset(matrixStack); + RenderUtils.applyRegionalRenderOffset(matrixStack); + + BlockPos camPos = RenderUtils.getCameraBlockPos(); + int regionX = (camPos.getX() >> 9) * 512; + int regionZ = (camPos.getZ() >> 9) * 512; RenderSystem.setShader(GameRenderer::getPositionProgram); @@ -178,7 +180,8 @@ public void onRender(MatrixStack matrixStack, float partialTicks) BlockPos pos = area.blocksList.get(i); matrixStack.push(); - matrixStack.translate(pos.getX(), pos.getY(), pos.getZ()); + matrixStack.translate(pos.getX() - regionX, + pos.getY(), pos.getZ() - regionZ); matrixStack.translate(-0.005, -0.005, -0.005); matrixStack.scale(1.01F, 1.01F, 1.01F); @@ -192,8 +195,8 @@ public void onRender(MatrixStack matrixStack, float partialTicks) } matrixStack.push(); - matrixStack.translate(area.minX + offset, area.minY + offset, - area.minZ + offset); + matrixStack.translate(area.minX + offset - regionX, area.minY + offset, + area.minZ + offset - regionZ); matrixStack.scale(area.sizeX + scale, area.sizeY + scale, area.sizeZ + scale); @@ -230,7 +233,8 @@ public void onRender(MatrixStack matrixStack, float partialTicks) continue; matrixStack.push(); - matrixStack.translate(pos.getX(), pos.getY(), pos.getZ()); + matrixStack.translate(pos.getX() - regionX, pos.getY(), + pos.getZ() - regionZ); matrixStack.translate(offset, offset, offset); matrixStack.scale(scale, scale, scale); @@ -251,8 +255,8 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // area box matrixStack.push(); - matrixStack.translate(preview.minX + offset, preview.minY + offset, - preview.minZ + offset); + matrixStack.translate(preview.minX + offset - regionX, preview.minY + offset, + preview.minZ + offset - regionZ); matrixStack.scale(preview.sizeX + scale, preview.sizeY + scale, preview.sizeZ + scale); RenderSystem.setShaderColor(0F, 0F, 0F, 0.5F); @@ -266,8 +270,8 @@ public void onRender(MatrixStack matrixStack, float partialTicks) if(posLookingAt != null) { matrixStack.push(); - matrixStack.translate(posLookingAt.getX(), posLookingAt.getY(), - posLookingAt.getZ()); + matrixStack.translate(posLookingAt.getX() - regionX, posLookingAt.getY(), + posLookingAt.getZ() - regionZ); matrixStack.translate(offset, offset, offset); matrixStack.scale(scale, scale, scale); @@ -285,8 +289,8 @@ public void onRender(MatrixStack matrixStack, float partialTicks) if(currentBlock != null) { // set position - matrixStack.translate(currentBlock.getX(), currentBlock.getY(), - currentBlock.getZ()); + matrixStack.translate(currentBlock.getX() - regionX, currentBlock.getY(), + currentBlock.getZ() - regionZ); // get progress float progress; diff --git a/src/main/java/net/wurstclient/hacks/FeedAuraHack.java b/src/main/java/net/wurstclient/hacks/FeedAuraHack.java index 62971a363a..df7cc16d0e 100644 --- a/src/main/java/net/wurstclient/hacks/FeedAuraHack.java +++ b/src/main/java/net/wurstclient/hacks/FeedAuraHack.java @@ -167,7 +167,11 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glDisable(GL11.GL_DEPTH_TEST); matrixStack.push(); - RenderUtils.applyRenderOffset(matrixStack); + RenderUtils.applyRegionalRenderOffset(matrixStack); + + BlockPos camPos = RenderUtils.getCameraBlockPos(); + int regionX = (camPos.getX() >> 9) * 512; + int regionZ = (camPos.getZ() >> 9) * 512; Box box = new Box(BlockPos.ORIGIN); float p = 1; @@ -178,11 +182,11 @@ public void onRender(MatrixStack matrixStack, float partialTicks) matrixStack.translate( renderTarget.prevX - + (renderTarget.getX() - renderTarget.prevX) * partialTicks, + + (renderTarget.getX() - renderTarget.prevX) * partialTicks - regionX, renderTarget.prevY + (renderTarget.getY() - renderTarget.prevY) * partialTicks, renderTarget.prevZ - + (renderTarget.getZ() - renderTarget.prevZ) * partialTicks); + + (renderTarget.getZ() - renderTarget.prevZ) * partialTicks - regionZ); matrixStack.translate(0, 0.05, 0); matrixStack.scale(renderTarget.getWidth(), renderTarget.getHeight(), renderTarget.getWidth()); diff --git a/src/main/java/net/wurstclient/hacks/FreecamHack.java b/src/main/java/net/wurstclient/hacks/FreecamHack.java index fa7fa1c40d..01a273d1bb 100644 --- a/src/main/java/net/wurstclient/hacks/FreecamHack.java +++ b/src/main/java/net/wurstclient/hacks/FreecamHack.java @@ -24,6 +24,7 @@ import net.minecraft.client.render.VertexFormats; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; import net.minecraft.util.math.Vec3d; import net.wurstclient.Category; @@ -180,15 +181,19 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glDisable(GL11.GL_DEPTH_TEST); matrixStack.push(); - RenderUtils.applyRenderOffset(matrixStack); + RenderUtils.applyRegionalRenderOffset(matrixStack); + + BlockPos camPos = RenderUtils.getCameraBlockPos(); + int regionX = (camPos.getX() >> 9) * 512; + int regionZ = (camPos.getZ() >> 9) * 512; float[] colorF = color.getColorF(); RenderSystem.setShaderColor(colorF[0], colorF[1], colorF[2], 0.5F); // box matrixStack.push(); - matrixStack.translate(fakePlayer.getX(), fakePlayer.getY(), - fakePlayer.getZ()); + matrixStack.translate(fakePlayer.getX() - regionX, fakePlayer.getY(), + fakePlayer.getZ() - regionZ); matrixStack.scale(fakePlayer.getWidth() + 0.1F, fakePlayer.getHeight() + 0.1F, fakePlayer.getWidth() + 0.1F); Box bb = new Box(-0.5, 0, -0.5, 0.5, 1, 0.5); @@ -196,9 +201,10 @@ public void onRender(MatrixStack matrixStack, float partialTicks) matrixStack.pop(); // line - Vec3d start = - RotationUtils.getClientLookVec().add(RenderUtils.getCameraPos()); - Vec3d end = fakePlayer.getBoundingBox().getCenter(); + Vec3d start = RotationUtils.getClientLookVec(). + add(RenderUtils.getCameraPos()).subtract(regionX, 0, regionZ); + Vec3d end = fakePlayer.getBoundingBox().getCenter() + .subtract(regionX, 0, regionZ); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); diff --git a/src/main/java/net/wurstclient/hacks/InstantBunkerHack.java b/src/main/java/net/wurstclient/hacks/InstantBunkerHack.java index da7f22cfe9..3412bc49ae 100644 --- a/src/main/java/net/wurstclient/hacks/InstantBunkerHack.java +++ b/src/main/java/net/wurstclient/hacks/InstantBunkerHack.java @@ -260,7 +260,11 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glDisable(GL11.GL_CULL_FACE); matrixStack.push(); - RenderUtils.applyRenderOffset(matrixStack); + RenderUtils.applyRegionalRenderOffset(matrixStack); + + BlockPos camPos = RenderUtils.getCameraBlockPos(); + int regionX = (camPos.getX() >> 9) * 512; + int regionZ = (camPos.getZ() >> 9) * 512; // green box { @@ -269,7 +273,8 @@ public void onRender(MatrixStack matrixStack, float partialTicks) BlockPos pos = positions.get(blockIndex); matrixStack.push(); - matrixStack.translate(pos.getX(), pos.getY(), pos.getZ()); + matrixStack.translate(pos.getX() - regionX, pos.getY(), + pos.getZ() - regionZ); matrixStack.translate(offset, offset, offset); matrixStack.scale(scale, scale, scale); @@ -286,7 +291,8 @@ public void onRender(MatrixStack matrixStack, float partialTicks) BlockPos pos = positions.get(i); matrixStack.push(); - matrixStack.translate(pos.getX(), pos.getY(), pos.getZ()); + matrixStack.translate(pos.getX() - regionX, + pos.getY(), pos.getZ() - regionZ); matrixStack.translate(offset, offset, offset); matrixStack.scale(scale, scale, scale); diff --git a/src/main/java/net/wurstclient/hacks/ItemEspHack.java b/src/main/java/net/wurstclient/hacks/ItemEspHack.java index fdd473c363..3c5eb73a38 100644 --- a/src/main/java/net/wurstclient/hacks/ItemEspHack.java +++ b/src/main/java/net/wurstclient/hacks/ItemEspHack.java @@ -173,8 +173,8 @@ private void renderTracers(MatrixStack matrixStack, double partialTicks, BufferBuilder bufferBuilder = tessellator.getBuffer(); RenderSystem.setShader(GameRenderer::getPositionProgram); - Vec3d start = - RotationUtils.getClientLookVec().add(RenderUtils.getCameraPos()); + Vec3d start = RotationUtils.getClientLookVec() + .add(RenderUtils.getCameraPos()).subtract(regionX, 0, regionZ); bufferBuilder.begin(VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION); @@ -183,12 +183,12 @@ private void renderTracers(MatrixStack matrixStack, double 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)); + .multiply(1 - partialTicks)).subtract(regionX, 0, regionZ); - 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).next(); + bufferBuilder.vertex(matrix, (float)end.x, (float)end.y, + (float)end.z).next(); } tessellator.draw(); } diff --git a/src/main/java/net/wurstclient/hacks/OverlayHack.java b/src/main/java/net/wurstclient/hacks/OverlayHack.java index 7f19c85bf0..706bdfe2a0 100644 --- a/src/main/java/net/wurstclient/hacks/OverlayHack.java +++ b/src/main/java/net/wurstclient/hacks/OverlayHack.java @@ -63,10 +63,15 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glDisable(GL11.GL_DEPTH_TEST); matrixStack.push(); - RenderUtils.applyRenderOffset(matrixStack); + RenderUtils.applyRegionalRenderOffset(matrixStack); + + BlockPos camPos = RenderUtils.getCameraBlockPos(); + int regionX = (camPos.getX() >> 9) * 512; + int regionZ = (camPos.getZ() >> 9) * 512; // set position - matrixStack.translate(pos.getX(), pos.getY(), pos.getZ()); + matrixStack.translate(pos.getX() - regionX, pos.getY(), + pos.getZ() - regionZ); // get progress float progress = diff --git a/src/main/java/net/wurstclient/hacks/PlayerFinderHack.java b/src/main/java/net/wurstclient/hacks/PlayerFinderHack.java index 2266921d18..2c5548682f 100644 --- a/src/main/java/net/wurstclient/hacks/PlayerFinderHack.java +++ b/src/main/java/net/wurstclient/hacks/PlayerFinderHack.java @@ -89,7 +89,11 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glDisable(GL11.GL_DEPTH_TEST); matrixStack.push(); - RenderUtils.applyRenderOffset(matrixStack); + RenderUtils.applyRegionalRenderOffset(matrixStack); + + BlockPos camPos = RenderUtils.getCameraBlockPos(); + int regionX = (camPos.getX() >> 9) * 512; + int regionZ = (camPos.getZ() >> 9) * 512; float[] rainbow = RenderUtils.getRainbowColor(); RenderSystem.setShaderColor(rainbow[0], rainbow[1], rainbow[2], 0.5F); @@ -104,11 +108,11 @@ public void onRender(MatrixStack matrixStack, float partialTicks) VertexFormats.POSITION); // set start position - Vec3d start = - RotationUtils.getClientLookVec().add(RenderUtils.getCameraPos()); + Vec3d start = RotationUtils.getClientLookVec(). + add(RenderUtils.getCameraPos()).subtract(regionX, 0, regionZ); // set end position - Vec3d end = Vec3d.ofCenter(pos); + Vec3d end = Vec3d.ofCenter(pos).subtract(regionX, 0, regionZ); // draw line bufferBuilder @@ -122,7 +126,8 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // block box { matrixStack.push(); - matrixStack.translate(pos.getX(), pos.getY(), pos.getZ()); + matrixStack.translate(pos.getX() - regionX, pos.getY(), + pos.getZ() - regionZ); RenderUtils.drawOutlinedBox(matrixStack); diff --git a/src/main/java/net/wurstclient/hacks/ProphuntEspHack.java b/src/main/java/net/wurstclient/hacks/ProphuntEspHack.java index 1896c40409..9b42bbbbe2 100644 --- a/src/main/java/net/wurstclient/hacks/ProphuntEspHack.java +++ b/src/main/java/net/wurstclient/hacks/ProphuntEspHack.java @@ -14,6 +14,7 @@ import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.Entity; import net.minecraft.entity.mob.MobEntity; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; import net.minecraft.util.math.MathHelper; import net.wurstclient.Category; @@ -57,7 +58,11 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glDisable(GL11.GL_DEPTH_TEST); matrixStack.push(); - RenderUtils.applyRenderOffset(matrixStack); + RenderUtils.applyRegionalRenderOffset(matrixStack); + + BlockPos camPos = RenderUtils.getCameraBlockPos(); + int regionX = (camPos.getX() >> 9) * 512; + int regionZ = (camPos.getZ() >> 9) * 512; // set color float alpha = 0.5F + 0.25F * MathHelper @@ -77,7 +82,8 @@ public void onRender(MatrixStack matrixStack, float partialTicks) continue; matrixStack.push(); - matrixStack.translate(entity.getX(), entity.getY(), entity.getZ()); + matrixStack.translate(entity.getX() - regionX, entity.getY(), + entity.getZ() - regionZ); RenderUtils.drawOutlinedBox(FAKE_BLOCK_BOX, matrixStack); RenderUtils.drawSolidBox(FAKE_BLOCK_BOX, matrixStack); diff --git a/src/main/java/net/wurstclient/util/RenderUtils.java b/src/main/java/net/wurstclient/util/RenderUtils.java index d87fa4d676..47bac6e42a 100644 --- a/src/main/java/net/wurstclient/util/RenderUtils.java +++ b/src/main/java/net/wurstclient/util/RenderUtils.java @@ -49,14 +49,6 @@ public static void scissorBox(int startX, int startY, int endX, int endY) GL11.glScissor(scissorX, scissorY, scissorWidth, scissorHeight); } - public static void applyRenderOffset(MatrixStack matrixStack) - { - applyCameraRotationOnly(); - Vec3d camPos = getCameraPos(); - - matrixStack.translate(-camPos.x, -camPos.y, -camPos.z); - } - public static void applyRegionalRenderOffset(MatrixStack matrixStack) { applyCameraRotationOnly(); From 0d7ceb4f5588d5d43f8605bc51fe275a267e82fb Mon Sep 17 00:00:00 2001 From: ThisTestUser Date: Sun, 29 Jan 2023 11:17:07 -0500 Subject: [PATCH 005/282] Fix FeedAura using entity health for ESP --- .../net/wurstclient/hacks/FeedAuraHack.java | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/FeedAuraHack.java b/src/main/java/net/wurstclient/hacks/FeedAuraHack.java index df7cc16d0e..2e7dc09d33 100644 --- a/src/main/java/net/wurstclient/hacks/FeedAuraHack.java +++ b/src/main/java/net/wurstclient/hacks/FeedAuraHack.java @@ -174,12 +174,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) int regionZ = (camPos.getZ() >> 9) * 512; Box box = new Box(BlockPos.ORIGIN); - float p = 1; - LivingEntity le = renderTarget; - p = (le.getMaxHealth() - le.getHealth()) / le.getMaxHealth(); - float red = p * 2F; - float green = 2 - red; - matrixStack.translate( renderTarget.prevX + (renderTarget.getX() - renderTarget.prevX) * partialTicks - regionX, @@ -192,19 +186,12 @@ public void onRender(MatrixStack matrixStack, float partialTicks) renderTarget.getWidth()); matrixStack.translate(-0.5, 0, -0.5); - if(p < 1) - { - matrixStack.translate(0.5, 0.5, 0.5); - matrixStack.scale(p, p, p); - matrixStack.translate(-0.5, -0.5, -0.5); - } - RenderSystem.setShader(GameRenderer::getPositionProgram); - RenderSystem.setShaderColor(red, green, 0, 0.25F); + RenderSystem.setShaderColor(1, 0, 0, 0.25F); RenderUtils.drawSolidBox(box, matrixStack); - RenderSystem.setShaderColor(red, green, 0, 0.5F); + RenderSystem.setShaderColor(1, 0, 0, 0.5F); RenderUtils.drawOutlinedBox(box, matrixStack); matrixStack.pop(); From d164ef15c8f8435ce6d36777508fa9ef023c9d54 Mon Sep 17 00:00:00 2001 From: ThisTestUser Date: Sat, 11 Feb 2023 15:42:30 -0500 Subject: [PATCH 006/282] Fix AutoFarm crashing on second activation --- src/main/java/net/wurstclient/hacks/AutoFarmHack.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/net/wurstclient/hacks/AutoFarmHack.java b/src/main/java/net/wurstclient/hacks/AutoFarmHack.java index 3743d1dadb..1f492a8213 100644 --- a/src/main/java/net/wurstclient/hacks/AutoFarmHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoFarmHack.java @@ -111,6 +111,7 @@ public void onDisable() Stream.of(greenBuffer, cyanBuffer, redBuffer).filter(Objects::nonNull) .forEach(VertexBuffer::close); + greenBuffer = cyanBuffer = redBuffer = null; } @Override From 744c8df7047f680ffc743f4bef8a2590ad33f7f8 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 19 Mar 2023 20:10:17 +0100 Subject: [PATCH 007/282] Add Gradle CI workflow --- .github/workflows/gradle.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/gradle.yml diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 0000000000..3b44597e7f --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,34 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle + +name: Java CI with Gradle + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + - name: Build with Gradle + uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 + with: + arguments: build From a1765d4f1352678c7a03d98b03d7e546f2db13c6 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 19 Mar 2023 20:13:22 +0100 Subject: [PATCH 008/282] Attempt to fix Gradle CI --- .github/workflows/gradle.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 3b44597e7f..be48ae637f 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -29,6 +29,4 @@ jobs: java-version: '17' distribution: 'temurin' - name: Build with Gradle - uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 - with: - arguments: build + run: ./gradlew build From 41b2a7acf826ddcce00bc56ab205ca0cea2d7628 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 19 Mar 2023 20:15:21 +0100 Subject: [PATCH 009/282] 2nd attempt to fix Gradle CI --- .github/workflows/gradle.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index be48ae637f..4b9b463c82 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -28,5 +28,7 @@ jobs: with: java-version: '17' distribution: 'temurin' + - name: Grant execute permission for gradlew + run: chmod +x gradlew - name: Build with Gradle run: ./gradlew build From d2c966e97b431eb81e445918064c594a1914ca17 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 19 Mar 2023 20:21:37 +0100 Subject: [PATCH 010/282] Try using gradle-build-action v2 --- .github/workflows/gradle.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 4b9b463c82..c393b1fdf0 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -28,7 +28,7 @@ jobs: with: java-version: '17' distribution: 'temurin' - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Build with Gradle + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + - name: Execute Gradle build run: ./gradlew build From e7a1f005f8873127927e611ead07332520e81de4 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 19 Mar 2023 20:23:54 +0100 Subject: [PATCH 011/282] Apparently gradle-build-action v2 still needs the permission fix --- .github/workflows/gradle.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index c393b1fdf0..97e36781c0 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -28,6 +28,8 @@ jobs: with: java-version: '17' distribution: 'temurin' + - name: Grant execute permission for gradlew + run: chmod +x gradlew - name: Setup Gradle uses: gradle/gradle-build-action@v2 - name: Execute Gradle build From 74ac77fc2642f95f0b1b83f12b531dcb036a3d77 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Tue, 21 Mar 2023 02:46:51 +0100 Subject: [PATCH 012/282] Create a separate SuggestionHandler class --- .../wurstclient/hacks/AutoCompleteHack.java | 48 ++++--------- .../hacks/autocomplete/SuggestionHandler.java | 70 +++++++++++++++++++ 2 files changed, 83 insertions(+), 35 deletions(-) create mode 100644 src/main/java/net/wurstclient/hacks/autocomplete/SuggestionHandler.java diff --git a/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java b/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java index ea077bc28f..1490fad111 100644 --- a/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java @@ -8,7 +8,6 @@ package net.wurstclient.hacks; import java.io.IOException; -import java.util.ArrayList; import java.util.List; import java.util.function.BiConsumer; @@ -22,6 +21,7 @@ import net.wurstclient.events.ChatOutputListener; import net.wurstclient.events.UpdateListener; import net.wurstclient.hack.Hack; +import net.wurstclient.hacks.autocomplete.SuggestionHandler; import net.wurstclient.util.ChatUtils; import net.wurstclient.util.OpenAiUtils; import net.wurstclient.util.json.JsonException; @@ -32,12 +32,14 @@ public final class AutoCompleteHack extends Hack implements ChatOutputListener, UpdateListener { - private final ArrayList suggestions = new ArrayList<>(); + private final SuggestionHandler suggestionHandler = new SuggestionHandler(); + + private String draftMessage; + private BiConsumer suggestionsUpdater; + private Thread apiCallThread; private long lastApiCallTime; private long lastRefreshTime; - private String draftMessage; - private BiConsumer suggestionsUpdater; public AutoCompleteHack() { @@ -66,15 +68,14 @@ public void onDisable() { EVENTS.remove(ChatOutputListener.class, this); EVENTS.remove(UpdateListener.class, this); + + suggestionHandler.clearSuggestions(); } @Override public void onSentMessage(ChatOutputEvent event) { - synchronized(suggestions) - { - suggestions.clear(); - } + suggestionHandler.clearSuggestions(); } @Override @@ -105,8 +106,7 @@ public void onUpdate() return; // check if we already have a suggestion for the current draft message - if(suggestions.stream().anyMatch( - s -> s.toLowerCase().startsWith(draftMessage.toLowerCase()))) + if(suggestionHandler.hasSuggestionFor(draftMessage)) return; // copy fields to local variables, in case they change @@ -124,11 +124,8 @@ public void onUpdate() return; // apply suggestion - synchronized(suggestions) - { - suggestions.add(draftMessage2 + suggestion); - setSuggestions(draftMessage2, suggestionsUpdater2); - } + suggestionHandler.addSuggestion(suggestion, draftMessage2, + suggestionsUpdater2); }); apiCallThread.setName("AutoComplete API Call"); apiCallThread.setPriority(Thread.MIN_PRIORITY); @@ -142,32 +139,13 @@ public void onUpdate() public void onRefresh(String draftMessage, BiConsumer suggestionsUpdater) { - synchronized(suggestions) - { - setSuggestions(draftMessage, suggestionsUpdater); - } + suggestionHandler.showSuggestions(draftMessage, suggestionsUpdater); this.draftMessage = draftMessage; this.suggestionsUpdater = suggestionsUpdater; lastRefreshTime = System.currentTimeMillis(); } - private void setSuggestions(String draftMessage, - BiConsumer suggestionsUpdater) - { - SuggestionsBuilder builder = new SuggestionsBuilder(draftMessage, 0); - String inlineSuggestion = null; - - for(String s : suggestions) - if(s.toLowerCase().startsWith(draftMessage.toLowerCase())) - { - builder.suggest(s); - inlineSuggestion = s; - } - - suggestionsUpdater.accept(builder, inlineSuggestion); - } - private String completeChatMessage(String draftMessage) { // get API key and parameters diff --git a/src/main/java/net/wurstclient/hacks/autocomplete/SuggestionHandler.java b/src/main/java/net/wurstclient/hacks/autocomplete/SuggestionHandler.java new file mode 100644 index 0000000000..a8b2a37820 --- /dev/null +++ b/src/main/java/net/wurstclient/hacks/autocomplete/SuggestionHandler.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.hacks.autocomplete; + +import java.util.ArrayList; +import java.util.function.BiConsumer; + +import com.mojang.brigadier.suggestion.SuggestionsBuilder; + +public class SuggestionHandler +{ + private final ArrayList suggestions = new ArrayList<>(); + + public boolean hasSuggestionFor(String draftMessage) + { + synchronized(suggestions) + { + return suggestions.stream().anyMatch( + s -> s.toLowerCase().startsWith(draftMessage.toLowerCase())); + } + } + + public void addSuggestion(String suggestion, String draftMessage, + BiConsumer suggestionsUpdater) + { + synchronized(suggestions) + { + suggestions.add(draftMessage + suggestion); + showSuggestionsImpl(draftMessage, suggestionsUpdater); + } + } + + public void showSuggestions(String draftMessage, + BiConsumer suggestionsUpdater) + { + synchronized(suggestions) + { + showSuggestionsImpl(draftMessage, suggestionsUpdater); + } + } + + private void showSuggestionsImpl(String draftMessage, + BiConsumer suggestionsUpdater) + { + SuggestionsBuilder builder = new SuggestionsBuilder(draftMessage, 0); + String inlineSuggestion = null; + + for(String s : suggestions) + if(s.toLowerCase().startsWith(draftMessage.toLowerCase())) + { + builder.suggest(s); + inlineSuggestion = s; + } + + suggestionsUpdater.accept(builder, inlineSuggestion); + } + + public void clearSuggestions() + { + synchronized(suggestions) + { + suggestions.clear(); + } + } +} From 29df4adabb35a37e9094ec7c8c9577fca0415be7 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Tue, 21 Mar 2023 04:15:07 +0100 Subject: [PATCH 013/282] Improve SuggestionHandler - Limit the number of suggestions kept in memory and remove duplicates. - Limit the number of suggestions shown on screen. - Allow it to generate up to 3 suggestions for the same draft. --- .../wurstclient/hacks/AutoCompleteHack.java | 2 +- .../hacks/autocomplete/SuggestionHandler.java | 38 ++++++++++++++----- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java b/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java index 1490fad111..e23a3d143b 100644 --- a/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java @@ -106,7 +106,7 @@ public void onUpdate() return; // check if we already have a suggestion for the current draft message - if(suggestionHandler.hasSuggestionFor(draftMessage)) + if(suggestionHandler.hasEnoughSuggestionFor(draftMessage)) return; // copy fields to local variables, in case they change diff --git a/src/main/java/net/wurstclient/hacks/autocomplete/SuggestionHandler.java b/src/main/java/net/wurstclient/hacks/autocomplete/SuggestionHandler.java index a8b2a37820..8af6684bc7 100644 --- a/src/main/java/net/wurstclient/hacks/autocomplete/SuggestionHandler.java +++ b/src/main/java/net/wurstclient/hacks/autocomplete/SuggestionHandler.java @@ -16,12 +16,13 @@ public class SuggestionHandler { private final ArrayList suggestions = new ArrayList<>(); - public boolean hasSuggestionFor(String draftMessage) + public boolean hasEnoughSuggestionFor(String draftMessage) { synchronized(suggestions) { - return suggestions.stream().anyMatch( - s -> s.toLowerCase().startsWith(draftMessage.toLowerCase())); + return suggestions.stream().map(String::toLowerCase) + .filter(s -> s.startsWith(draftMessage.toLowerCase())) + .count() >= 3; } } @@ -30,7 +31,16 @@ public void addSuggestion(String suggestion, String draftMessage, { synchronized(suggestions) { - suggestions.add(draftMessage + suggestion); + String completedMessage = draftMessage + suggestion; + + if(!suggestions.contains(completedMessage)) + { + suggestions.add(completedMessage); + + if(suggestions.size() > 100) + suggestions.remove(0); + } + showSuggestionsImpl(draftMessage, suggestionsUpdater); } } @@ -50,12 +60,20 @@ private void showSuggestionsImpl(String draftMessage, SuggestionsBuilder builder = new SuggestionsBuilder(draftMessage, 0); String inlineSuggestion = null; - for(String s : suggestions) - if(s.toLowerCase().startsWith(draftMessage.toLowerCase())) - { - builder.suggest(s); - inlineSuggestion = s; - } + int shownSuggestions = 0; + for(int i = suggestions.size() - 1; i >= 0; i--) + { + String s = suggestions.get(i); + if(!s.toLowerCase().startsWith(draftMessage.toLowerCase())) + continue; + + if(shownSuggestions >= 5) + break; + + builder.suggest(s); + inlineSuggestion = s; + shownSuggestions++; + } suggestionsUpdater.accept(builder, inlineSuggestion); } From bd5e2bd355e8c977098ddeb332eab22417d6a8d9 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Tue, 21 Mar 2023 04:44:28 +0100 Subject: [PATCH 014/282] Add SuggestionHandler settings --- .../wurstclient/hacks/AutoCompleteHack.java | 1 + .../hacks/autocomplete/SuggestionHandler.java | 41 +++++++++++++++++-- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java b/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java index e23a3d143b..f67082f9af 100644 --- a/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java @@ -45,6 +45,7 @@ public AutoCompleteHack() { super("AutoComplete"); setCategory(Category.CHAT); + suggestionHandler.getSettings().forEach(this::addSetting); } @Override diff --git a/src/main/java/net/wurstclient/hacks/autocomplete/SuggestionHandler.java b/src/main/java/net/wurstclient/hacks/autocomplete/SuggestionHandler.java index 8af6684bc7..f07f9d56df 100644 --- a/src/main/java/net/wurstclient/hacks/autocomplete/SuggestionHandler.java +++ b/src/main/java/net/wurstclient/hacks/autocomplete/SuggestionHandler.java @@ -8,21 +8,56 @@ package net.wurstclient.hacks.autocomplete; import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import java.util.function.BiConsumer; import com.mojang.brigadier.suggestion.SuggestionsBuilder; +import net.wurstclient.settings.Setting; +import net.wurstclient.settings.SliderSetting; +import net.wurstclient.settings.SliderSetting.ValueDisplay; + public class SuggestionHandler { private final ArrayList suggestions = new ArrayList<>(); + private final SliderSetting maxSuggestionPerDraft = new SliderSetting( + "Max suggestions per draft", + "How many suggestions the AI is allowed to generate for the same draft" + + " message.\n\n" + + "\u00a7c\u00a7lWARNING:\u00a7r Higher values can use up a lot of" + + " tokens. Definitely limit this to 1 for expensive models like" + + " GPT-4.", + 3, 1, 10, 1, ValueDisplay.INTEGER); + + private final SliderSetting maxSuggestionsKept = new SliderSetting( + "Max suggestions kept", "Maximum number of suggestions kept in memory.", + 100, 10, 1000, 10, ValueDisplay.INTEGER); + + private final SliderSetting maxSuggestionsShown = new SliderSetting( + "Max suggestions shown", + "How many suggestions can be shown above the chat box.\n\n" + + "If this is set too high, the suggestions will obscure some of" + + " the existing chat messages. How high you can set this depends" + + " on your screen resolution and GUI scale.", + 5, 1, 10, 1, ValueDisplay.INTEGER); + + private final List settings = Arrays.asList(maxSuggestionPerDraft, + maxSuggestionsKept, maxSuggestionsShown); + + public List getSettings() + { + return settings; + } + public boolean hasEnoughSuggestionFor(String draftMessage) { synchronized(suggestions) { return suggestions.stream().map(String::toLowerCase) .filter(s -> s.startsWith(draftMessage.toLowerCase())) - .count() >= 3; + .count() >= maxSuggestionPerDraft.getValue(); } } @@ -37,7 +72,7 @@ public void addSuggestion(String suggestion, String draftMessage, { suggestions.add(completedMessage); - if(suggestions.size() > 100) + if(suggestions.size() > maxSuggestionsKept.getValue()) suggestions.remove(0); } @@ -67,7 +102,7 @@ private void showSuggestionsImpl(String draftMessage, if(!s.toLowerCase().startsWith(draftMessage.toLowerCase())) continue; - if(shownSuggestions >= 5) + if(shownSuggestions >= maxSuggestionsShown.getValue()) break; builder.suggest(s); From 183ed966da8328ea2cb020dacd07dfb5a8f86fcd Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Tue, 21 Mar 2023 18:15:49 +0100 Subject: [PATCH 015/282] Add a dummy system message to improve prediction quality --- src/main/java/net/wurstclient/hacks/AutoCompleteHack.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java b/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java index f67082f9af..df2b069088 100644 --- a/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java @@ -173,8 +173,10 @@ private String completeChatMessage(String draftMessage) private String buildPrompt(String draftMessage) { + // tell the model that it's talking in a Minecraft chat String prompt = "=== Minecraft chat log ===\n"; + // add chat history List chatHistory = MC.inGameHud.getChatHud().visibleMessages; for(int i = chatHistory.size() - 1; i >= 0; i--) @@ -193,6 +195,12 @@ private String buildPrompt(String draftMessage) prompt += message + "\n"; } + // if the chat history is empty, add a dummy system message + if(chatHistory.isEmpty()) + prompt += " " + MC.getSession().getUsername() + + " joined the game.\n"; + + // add draft message prompt += "<" + MC.getSession().getUsername() + "> " + draftMessage; return prompt; From 37cb0d90b6ebb63f6a17c7d7ae2d41837e1c8917 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Tue, 21 Mar 2023 18:21:26 +0100 Subject: [PATCH 016/282] Stop removing leading and trailing whitespace from the output This caused more issues than it fixed. If you type, for example: "How are", the model might respond with " you doing today?". But removing the whitespace would turn that into "How areyou doing today?". --- src/main/java/net/wurstclient/hacks/AutoCompleteHack.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java b/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java index df2b069088..23ab7bb124 100644 --- a/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java @@ -227,9 +227,6 @@ private String extractCompletion(WsonObject response) throws JsonException // remove newlines completion = completion.replace("\n", " "); - // remove leading and trailing whitespace - completion = completion.strip(); - return completion; } From 9d40c7f603bc5ed6e9386bae30df3cc9c0e06b22 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 22 Mar 2023 18:07:17 +0100 Subject: [PATCH 017/282] Add code style config files --- codestyle/cleanup.xml | 144 ++++++++++++++ codestyle/codetemplates.xml | 12 ++ codestyle/formatter.xml | 365 ++++++++++++++++++++++++++++++++++++ 3 files changed, 521 insertions(+) create mode 100644 codestyle/cleanup.xml create mode 100644 codestyle/codetemplates.xml create mode 100644 codestyle/formatter.xml diff --git a/codestyle/cleanup.xml b/codestyle/cleanup.xml new file mode 100644 index 0000000000..70a36773b5 --- /dev/null +++ b/codestyle/cleanup.xml @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/codestyle/codetemplates.xml b/codestyle/codetemplates.xml new file mode 100644 index 0000000000..c5c5151241 --- /dev/null +++ b/codestyle/codetemplates.xml @@ -0,0 +1,12 @@ + \ No newline at end of file diff --git a/codestyle/formatter.xml b/codestyle/formatter.xml new file mode 100644 index 0000000000..cec91d9900 --- /dev/null +++ b/codestyle/formatter.xml @@ -0,0 +1,365 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 38ce5660f277094ee7ecc8b101499b273862ae91 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 22 Mar 2023 18:10:09 +0100 Subject: [PATCH 018/282] Don't run gradle if no code files have changed --- .github/workflows/gradle.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 97e36781c0..040e51c39c 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -10,8 +10,12 @@ name: Java CI with Gradle on: push: branches: [ "master" ] + paths: + - '**.java' pull_request: branches: [ "master" ] + paths: + - '**.java' permissions: contents: read From f2f52f94049ddf7b37b2b5afbb856ab69162f380 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 22 Mar 2023 18:43:38 +0100 Subject: [PATCH 019/282] [Wurst-Bot] Update to 23w12a --- gradle.properties | 10 +++++----- src/main/java/net/wurstclient/WurstClient.java | 2 +- .../java/net/wurstclient/mixin/StatsScreenMixin.java | 2 +- .../java/net/wurstclient/mixin/TitleScreenMixin.java | 2 +- .../net/wurstclient/navigator/NavigatorMainScreen.java | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/gradle.properties b/gradle.properties index fe99851a8e..56226dc318 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,15 +4,15 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these at https://fabricmc.net/develop/ and # https://www.curseforge.com/minecraft/mc-mods/fabric-api -minecraft_version=1.19.4 -yarn_mappings=1.19.4+build.1 -loader_version=0.14.17 +minecraft_version=23w12a +yarn_mappings=23w12a+build.1 +loader_version=0.14.18 #Fabric api -fabric_version=0.75.3+1.19.4 +fabric_version=0.76.1+1.20 # Mod Properties -mod_version = v7.32-MC1.19.4 +mod_version = v7.32-MC23w12a maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index 2a718480c8..3c7b546379 100644 --- a/src/main/java/net/wurstclient/WurstClient.java +++ b/src/main/java/net/wurstclient/WurstClient.java @@ -57,7 +57,7 @@ public enum WurstClient public static IMinecraftClient IMC; public static final String VERSION = "7.32"; - public static final String MC_VERSION = "1.19.4"; + public static final String MC_VERSION = "23w12a"; private WurstAnalytics analytics; private EventManager eventManager; diff --git a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java index 187f0eeda4..5297484e74 100644 --- a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java @@ -55,7 +55,7 @@ private void onCreateButtons(CallbackInfo ci) .equals(I18n.translate("gui.done"))) continue; - button.setX(width / 2 + 2); + button.method_46421(width / 2 + 2); button.setWidth(150); } } diff --git a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java index 28488e077b..87f2248691 100644 --- a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java @@ -77,7 +77,7 @@ private void onTick(CallbackInfo ci) // adjust AltManager button if Realms button has been moved // happens when ModMenu is installed - altsButton.setY(realmsButton.getY()); + altsButton.method_46419(realmsButton.getY()); } /** diff --git a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java index aec6fd0567..0ebbbc4b05 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java @@ -73,7 +73,7 @@ protected void onResize() setFocused(searchBar); searchBar.setFocused(true); - searchBar.setX(middleX - 100); + searchBar.method_46421(middleX - 100); setContentHeight(navigatorDisplayList.size() / 3 * 20); } From a3dfa1e339678984e0a3f39cbae0d2d2d8cb19bb Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 22 Mar 2023 21:31:53 +0100 Subject: [PATCH 020/282] Update to 23w12a --- build.gradle | 2 +- src/main/java/net/wurstclient/mixin/StatsScreenMixin.java | 2 +- src/main/java/net/wurstclient/mixin/TitleScreenMixin.java | 2 +- .../java/net/wurstclient/navigator/NavigatorMainScreen.java | 2 +- src/main/resources/assets/wurst/lang/de_de.json | 2 +- src/main/resources/assets/wurst/lang/en_us.json | 2 +- src/main/resources/fabric.mod.json | 6 +++--- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/build.gradle b/build.gradle index b8defa5936..1c8e16ef2f 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { } plugins { - id 'fabric-loom' version '1.0-SNAPSHOT' + id 'fabric-loom' version '1.1-SNAPSHOT' id 'maven-publish' } diff --git a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java index 5297484e74..187f0eeda4 100644 --- a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java @@ -55,7 +55,7 @@ private void onCreateButtons(CallbackInfo ci) .equals(I18n.translate("gui.done"))) continue; - button.method_46421(width / 2 + 2); + button.setX(width / 2 + 2); button.setWidth(150); } } diff --git a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java index 87f2248691..28488e077b 100644 --- a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java @@ -77,7 +77,7 @@ private void onTick(CallbackInfo ci) // adjust AltManager button if Realms button has been moved // happens when ModMenu is installed - altsButton.method_46419(realmsButton.getY()); + altsButton.setY(realmsButton.getY()); } /** diff --git a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java index 0ebbbc4b05..aec6fd0567 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java @@ -73,7 +73,7 @@ protected void onResize() setFocused(searchBar); searchBar.setFocused(true); - searchBar.method_46421(middleX - 100); + searchBar.setX(middleX - 100); setContentHeight(navigatorDisplayList.size() / 3 * 20); } diff --git a/src/main/resources/assets/wurst/lang/de_de.json b/src/main/resources/assets/wurst/lang/de_de.json index a4ac113183..48b5dd2c56 100644 --- a/src/main/resources/assets/wurst/lang/de_de.json +++ b/src/main/resources/assets/wurst/lang/de_de.json @@ -34,7 +34,7 @@ "description.wurst.hack.autopotion": "Benutzt automatisch Wurftränke der Heilung, wenn deine Gesundheit niedrig ist.", "description.wurst.hack.autoreconnect": "Verbindet dich automatisch wieder, wenn du vom Server gekickt wirst.", "description.wurst.hack.autorespawn": "Respawnt dich automatisch, wenn du stirbst.", - "description.wurst.hack.autosign": "Schreibt einen beliebigen Text automatisch auf jedes Schild, das du platzierst.\n\nNachdem du diesen Hack aktivierst, kannst du auf ein Schild ganz normal schreiben. Der Text von diesem Schild wird dann gespeichert und auf alle Schilder kopiert, die du danach platzierst.", + "description.wurst.hack.autosign": "Schreibt einen beliebigen Text automatisch auf jedes Schild, das du platzierst oder bearbeitest.\n\nNachdem du diesen Hack aktivierst, kannst du auf ein Schild ganz normal schreiben. Der Text von diesem Schild wird dann gespeichert und auf alle Schilder kopiert, die du danach platzierst.", "description.wurst.hack.autosoup": "Isst automatisch Pilzsuppe, wenn deine Gesundheit niedrig ist.\n\n§lAchtung:§r Dieser Hack ignoriert das Hunger-System und tut so als ob Pilzsuppe direkt deine Gesundheit auffüllt. Wenn der Server auf dem du spielst das nicht so macht, solltest du stattdessen AutoEat benutzen.", "description.wurst.hack.autosprint": "Lässt dich automatisch sprinten.", "description.wurst.hack.autosteal": "Klaut automatisch alle Items aus allen Kisten und Shulkerboxen, die du öffnest.", diff --git a/src/main/resources/assets/wurst/lang/en_us.json b/src/main/resources/assets/wurst/lang/en_us.json index e47d8ee791..d9632cc802 100644 --- a/src/main/resources/assets/wurst/lang/en_us.json +++ b/src/main/resources/assets/wurst/lang/en_us.json @@ -34,7 +34,7 @@ "description.wurst.hack.autopotion": "Automatically throws splash potions of instant health when your health is low.", "description.wurst.hack.autoreconnect": "Automatically reconnects when you get kicked from the server.", "description.wurst.hack.autorespawn": "Automatically respawns you whenever you die.", - "description.wurst.hack.autosign": "Instantly writes whatever text you want on every sign you place. Once activated, you can write normally on the first sign to specify the text for all other signs.", + "description.wurst.hack.autosign": "Instantly writes whatever text you want on every sign you place or edit. Once activated, you can write normally on the first sign to specify the text for all other signs.", "description.wurst.hack.autosoup": "Automatically eats soup when your health is low.\n\n§lNote:§r This hack ignores hunger and assumes that eating soup directly refills your health. If the server you are playing on is not configured to do that, use AutoEat instead.", "description.wurst.hack.autosprint": "Makes you sprint automatically.", "description.wurst.hack.autosteal": "Automatically steals everything from all chests and shulker boxes that you open.", diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 615be35531..b710db5909 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -29,9 +29,9 @@ "accessWidener" : "wurst.accesswidener", "depends": { - "fabricloader": ">=0.14.10", - "fabric-api": ">=0.75.1", - "minecraft": "~1.19.4-beta.2", + "fabricloader": ">=0.14.18", + "fabric-api": ">=0.76.1", + "minecraft": "~1.20-alpha.23.12.a", "java": ">=17" }, "suggests": { From 707a3c825178d40ea59265e11ca4b844e81a72ff Mon Sep 17 00:00:00 2001 From: Hassinator00 <109218095+Hassinator00@users.noreply.github.com> Date: Thu, 23 Mar 2023 00:40:49 +0100 Subject: [PATCH 021/282] Merge #806 (Sneak option to turn off when flying) * SneakHack fly detection Added the possibility to fly while Sneak is active * Update SneakHack.java * Update SneakHack.java * Update SneakHack.java * Update SneakHack.java * Update SneakHack.java * Update SneakHack.java * Update SneakHack.java * Update SneakHack.java * Update SneakHack.java * Update SneakHack.java * Update SneakHack.java * Update SneakHack.java thank you for your reviews, i've removed the useless code and added a setting to enable this feature * Clean up --------- Co-authored-by: Alexander01998 --- .../java/net/wurstclient/hacks/SneakHack.java | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/wurstclient/hacks/SneakHack.java b/src/main/java/net/wurstclient/hacks/SneakHack.java index cd035a6b30..8911374758 100644 --- a/src/main/java/net/wurstclient/hacks/SneakHack.java +++ b/src/main/java/net/wurstclient/hacks/SneakHack.java @@ -17,6 +17,7 @@ import net.wurstclient.events.PreMotionListener; import net.wurstclient.hack.Hack; import net.wurstclient.mixinterface.IKeyBinding; +import net.wurstclient.settings.CheckboxSetting; import net.wurstclient.settings.EnumSetting; @SearchTags({"AutoSneaking"}) @@ -28,11 +29,20 @@ public final class SneakHack extends Hack + "\u00a7lLegit\u00a7r mode actually makes you sneak.", SneakMode.values(), SneakMode.LEGIT); + private final CheckboxSetting offWhileFlying = + new CheckboxSetting("Turn off while flying", + "Automatically disables Legit Sneak while you are flying or using" + + " Freecam, so that it doesn't force you to fly down.\n\n" + + "Keep in mind that this also means you won't be hidden from" + + " other players while doing these things.", + false); + public SneakHack() { super("Sneak"); setCategory(Category.MOVEMENT); addSetting(mode); + addSetting(offWhileFlying); } @Override @@ -75,7 +85,10 @@ public void onPreMotion() switch(mode.getSelected()) { case LEGIT: - sneakKey.setPressed(true); + if(offWhileFlying.isChecked() && isFlying()) + ((IKeyBinding)sneakKey).resetPressedState(); + else + sneakKey.setPressed(true); break; case PACKET: @@ -96,6 +109,20 @@ public void onPostMotion() sendSneakPacket(Mode.PRESS_SHIFT_KEY); } + private boolean isFlying() + { + if(MC.player.getAbilities().flying) + return true; + + if(WURST.getHax().flightHack.isEnabled()) + return true; + + if(WURST.getHax().freecamHack.isEnabled()) + return true; + + return false; + } + private void sendSneakPacket(Mode mode) { ClientPlayerEntity player = MC.player; From 31584c63adf8862d2b2b8e88286d01404cd32423 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Thu, 23 Mar 2023 18:07:48 +0100 Subject: [PATCH 022/282] Ensure that Tunneller's buffers are never closed twice Probably fixes #807 --- .../java/net/wurstclient/hacks/TunnellerHack.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/TunnellerHack.java b/src/main/java/net/wurstclient/hacks/TunnellerHack.java index 1889edb90f..e87c57a654 100644 --- a/src/main/java/net/wurstclient/hacks/TunnellerHack.java +++ b/src/main/java/net/wurstclient/hacks/TunnellerHack.java @@ -157,9 +157,14 @@ public void onDisable() currentBlock = null; } - for(VertexBuffer buffer : vertexBuffers) - if(buffer != null) - buffer.close(); + for(int i = 0; i < vertexBuffers.length; i++) + { + if(vertexBuffers[i] == null) + continue; + + vertexBuffers[i].close(); + vertexBuffers[i] = null; + } } @Override @@ -734,7 +739,10 @@ public boolean canRun() lastTorch = null; nextTorch = BlockPos.ofFloored(MC.player.getPos()); if(vertexBuffers[4] != null) + { vertexBuffers[4].close(); + vertexBuffers[4] = null; + } return false; } From 41d635f07a3a546d4f967ade97e0611ac695554e Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Fri, 24 Mar 2023 19:56:57 +0100 Subject: [PATCH 023/282] Clean up --- .../settings/filterlists/AnchorAuraFilterList.java | 7 +++---- .../settings/filterlists/CrystalAuraFilterList.java | 7 +++---- .../wurstclient/settings/filterlists/FollowFilterList.java | 5 ++--- .../settings/filterlists/RemoteViewFilterList.java | 5 ++--- .../wurstclient/settings/filters/FilterAllaysSetting.java | 5 ++--- 5 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/main/java/net/wurstclient/settings/filterlists/AnchorAuraFilterList.java b/src/main/java/net/wurstclient/settings/filterlists/AnchorAuraFilterList.java index 87cd85adc4..71a02391bb 100644 --- a/src/main/java/net/wurstclient/settings/filterlists/AnchorAuraFilterList.java +++ b/src/main/java/net/wurstclient/settings/filterlists/AnchorAuraFilterList.java @@ -51,10 +51,9 @@ public static AnchorAuraFilterList create() true)); builder.add(new FilterAllaysSetting( - "Won't target allays when auto-placing anchors." - + damageWarning, - true)); - + "Won't target allays when auto-placing anchors." + damageWarning, + true)); + builder.add(new FilterInvisibleSetting( "Won't target invisible entities when auto-placing anchors." + damageWarning, diff --git a/src/main/java/net/wurstclient/settings/filterlists/CrystalAuraFilterList.java b/src/main/java/net/wurstclient/settings/filterlists/CrystalAuraFilterList.java index 72b056181f..754f8d596e 100644 --- a/src/main/java/net/wurstclient/settings/filterlists/CrystalAuraFilterList.java +++ b/src/main/java/net/wurstclient/settings/filterlists/CrystalAuraFilterList.java @@ -51,10 +51,9 @@ public static CrystalAuraFilterList create() true)); builder.add(new FilterAllaysSetting( - "Won't target allays when auto-placing crystals." - + damageWarning, - true)); - + "Won't target allays when auto-placing crystals." + damageWarning, + true)); + builder.add(new FilterInvisibleSetting( "Won't target invisible entities when auto-placing crystals." + damageWarning, diff --git a/src/main/java/net/wurstclient/settings/filterlists/FollowFilterList.java b/src/main/java/net/wurstclient/settings/filterlists/FollowFilterList.java index 1b3cb5993a..e6feb12926 100644 --- a/src/main/java/net/wurstclient/settings/filterlists/FollowFilterList.java +++ b/src/main/java/net/wurstclient/settings/filterlists/FollowFilterList.java @@ -56,9 +56,8 @@ public static FollowFilterList create() builder.add(new FilterGolemsSetting( "Won't follow iron golems, snow golems and shulkers.", true)); - builder.add(new FilterAllaysSetting( - "Won't follow allays.", true)); - + builder.add(new FilterAllaysSetting("Won't follow allays.", true)); + builder.add(new FilterInvisibleSetting( "Won't follow invisible entities.", false)); diff --git a/src/main/java/net/wurstclient/settings/filterlists/RemoteViewFilterList.java b/src/main/java/net/wurstclient/settings/filterlists/RemoteViewFilterList.java index 22a9aeb43c..882921458c 100644 --- a/src/main/java/net/wurstclient/settings/filterlists/RemoteViewFilterList.java +++ b/src/main/java/net/wurstclient/settings/filterlists/RemoteViewFilterList.java @@ -55,9 +55,8 @@ public static RemoteViewFilterList create() builder.add(new FilterGolemsSetting( "Won't view iron golems, snow golems and shulkers.", true)); - builder.add(new FilterAllaysSetting( - "Won't view allays.", true)); - + builder.add(new FilterAllaysSetting("Won't view allays.", true)); + builder.add(new FilterInvisibleSetting("Won't view invisible entities.", false)); diff --git a/src/main/java/net/wurstclient/settings/filters/FilterAllaysSetting.java b/src/main/java/net/wurstclient/settings/filters/FilterAllaysSetting.java index 04053deace..0627467f59 100644 --- a/src/main/java/net/wurstclient/settings/filters/FilterAllaysSetting.java +++ b/src/main/java/net/wurstclient/settings/filters/FilterAllaysSetting.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2022 Wurst-Imperium and contributors. + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. * * This source code is subject to the terms of the GNU General Public * License, version 3. If a copy of the GPL was not distributed with this @@ -25,7 +25,6 @@ public boolean test(Entity e) public static FilterAllaysSetting genericCombat(boolean checked) { - return new FilterAllaysSetting( - "Won't attack allays.", checked); + return new FilterAllaysSetting("Won't attack allays.", checked); } } From 4ea6c3cdf6ce0f97ec2fe38fcbd1d697ffc41a44 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sat, 25 Mar 2023 17:25:35 +0100 Subject: [PATCH 024/282] Run CI on gradle changes --- .github/workflows/gradle.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 040e51c39c..4286e2293c 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -12,10 +12,14 @@ on: branches: [ "master" ] paths: - '**.java' + - 'gradle**' + - 'build.gradle' pull_request: branches: [ "master" ] paths: - '**.java' + - 'gradle**' + - 'build.gradle' permissions: contents: read From 7a55a3a51fdaa3193d3425729bd6edbe683d6505 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sat, 25 Mar 2023 17:26:43 +0100 Subject: [PATCH 025/282] Update Fabric stuff --- build.gradle | 2 +- gradle.properties | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index b8defa5936..1c8e16ef2f 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { } plugins { - id 'fabric-loom' version '1.0-SNAPSHOT' + id 'fabric-loom' version '1.1-SNAPSHOT' id 'maven-publish' } diff --git a/gradle.properties b/gradle.properties index 762d5bc9ac..d320195683 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,10 +6,10 @@ org.gradle.jvmargs=-Xmx1G # https://www.curseforge.com/minecraft/mc-mods/fabric-api minecraft_version=1.19.4 yarn_mappings=1.19.4+build.1 -loader_version=0.14.17 +loader_version=0.14.18 #Fabric api -fabric_version=0.75.3+1.19.4 +fabric_version=0.76.0+1.19.4 # Mod Properties mod_version = v7.33-MC1.19.4 From b65b2b0e228770630f1300f7de47a8ab041a5c33 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 26 Mar 2023 16:47:23 +0200 Subject: [PATCH 026/282] Fix some descriptions saying "Format Error: " --- src/main/java/net/wurstclient/WurstClient.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index a4fb577e3f..2015ea67d6 100644 --- a/src/main/java/net/wurstclient/WurstClient.java +++ b/src/main/java/net/wurstclient/WurstClient.java @@ -180,6 +180,12 @@ public String translate(String key) { if(otfs.translationsOtf.getForceEnglish().isChecked()) return IMC.getLanguageManager().getEnglish().get(key); + + // This extra check is necessary because I18n.translate() doesn't + // always return the key when the translation is missing. If the key + // contains a '%', it will return "Format Error: key" instead. + if(!I18n.hasTranslation(key)) + return key; return I18n.translate(key); } From 036e08354c4bcf3cce6bddff7ccee02b16081e9f Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 26 Mar 2023 20:26:09 +0200 Subject: [PATCH 027/282] Improve AutoComplete - Added support for locally hosted models via oobabooga/text-generation-webui - Added some more settings (but many are still missing) - Didn't fix OpenAI mode. It's still hardcoded to the now-deleted code-davinci-002 model. --- .../wurstclient/hacks/AutoCompleteHack.java | 155 +++++++----------- .../hacks/autocomplete/MessageCompleter.java | 145 ++++++++++++++++ .../hacks/autocomplete/ModelSettings.java | 70 ++++++++ .../OobaboogaMessageCompleter.java | 81 +++++++++ .../autocomplete/OpenAiMessageCompleter.java | 16 ++ .../hacks/autocomplete/SuggestionHandler.java | 2 +- .../net/wurstclient/util/OpenAiUtils.java | 46 ------ .../resources/assets/wurst/lang/en_us.json | 2 +- 8 files changed, 372 insertions(+), 145 deletions(-) create mode 100644 src/main/java/net/wurstclient/hacks/autocomplete/MessageCompleter.java create mode 100644 src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java create mode 100644 src/main/java/net/wurstclient/hacks/autocomplete/OobaboogaMessageCompleter.java create mode 100644 src/main/java/net/wurstclient/hacks/autocomplete/OpenAiMessageCompleter.java delete mode 100644 src/main/java/net/wurstclient/util/OpenAiUtils.java diff --git a/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java b/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java index 23ab7bb124..c09e616c97 100644 --- a/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java @@ -7,33 +7,64 @@ */ package net.wurstclient.hacks; -import java.io.IOException; -import java.util.List; import java.util.function.BiConsumer; -import com.google.gson.JsonObject; import com.mojang.brigadier.suggestion.SuggestionsBuilder; -import net.minecraft.client.gui.hud.ChatHudLine; import net.minecraft.client.gui.screen.ChatScreen; import net.wurstclient.Category; import net.wurstclient.SearchTags; import net.wurstclient.events.ChatOutputListener; import net.wurstclient.events.UpdateListener; import net.wurstclient.hack.Hack; +import net.wurstclient.hacks.autocomplete.MessageCompleter; +import net.wurstclient.hacks.autocomplete.ModelSettings; +import net.wurstclient.hacks.autocomplete.OobaboogaMessageCompleter; +import net.wurstclient.hacks.autocomplete.OpenAiMessageCompleter; import net.wurstclient.hacks.autocomplete.SuggestionHandler; +import net.wurstclient.settings.EnumSetting; import net.wurstclient.util.ChatUtils; -import net.wurstclient.util.OpenAiUtils; -import net.wurstclient.util.json.JsonException; -import net.wurstclient.util.json.WsonObject; @SearchTags({"auto complete", "Copilot", "ChatGPT", "chat GPT", "GPT-3", "GPT3", "GPT 3", "OpenAI", "open ai", "ChatAI", "chat AI", "ChatBot", "chat bot"}) public final class AutoCompleteHack extends Hack implements ChatOutputListener, UpdateListener { + private final ModelSettings modelSettings = new ModelSettings(); private final SuggestionHandler suggestionHandler = new SuggestionHandler(); + private final EnumSetting apiProvider = new EnumSetting<>( + "API provider", + "\u00a7lOpenAI\u00a7r lets you use models like GPT-3, but requires an" + + " account with API access, costs money to use and sends your chat" + + " history to their servers. The name is a lie - it's closed" + + " source.\n\n" + + "\u00a7loobabooga\u00a7r lets you use models like LLaMA and many" + + " others. It's a true open source alternative to OpenAI that you" + + " can run locally on your own computer. It's free to use and does" + + " not send your chat history to any servers.", + ApiProvider.values(), ApiProvider.OOBABOOGA); + + private enum ApiProvider + { + OPENAI("OpenAI"), + OOBABOOGA("oobabooga"); + + private final String name; + + private ApiProvider(String name) + { + this.name = name; + } + + @Override + public String toString() + { + return name; + } + } + + private MessageCompleter completer; private String draftMessage; private BiConsumer suggestionsUpdater; @@ -45,19 +76,32 @@ public AutoCompleteHack() { super("AutoComplete"); setCategory(Category.CHAT); + + addSetting(apiProvider); + modelSettings.forEach(this::addSetting); suggestionHandler.getSettings().forEach(this::addSetting); } @Override protected void onEnable() { - String apiKey = System.getenv("WURST_OPENAI_KEY"); - if(apiKey == null) + switch(apiProvider.getSelected()) { - ChatUtils.error("API key not found. Please set the" - + " WURST_OPENAI_KEY environment variable and reboot."); - setEnabled(false); - return; + case OPENAI: + String apiKey = System.getenv("WURST_OPENAI_KEY"); + if(apiKey == null) + { + ChatUtils.error("API key not found. Please set the" + + " WURST_OPENAI_KEY environment variable and reboot."); + setEnabled(false); + return; + } + completer = new OpenAiMessageCompleter(modelSettings); + break; + + case OOBABOOGA: + completer = new OobaboogaMessageCompleter(modelSettings); + break; } EVENTS.add(ChatOutputListener.class, this); @@ -120,7 +164,7 @@ public void onUpdate() apiCallThread = new Thread(() -> { // get suggestion - String suggestion = completeChatMessage(draftMessage2); + String suggestion = completer.completeChatMessage(draftMessage2); if(suggestion.isEmpty()) return; @@ -147,88 +191,5 @@ public void onRefresh(String draftMessage, lastRefreshTime = System.currentTimeMillis(); } - private String completeChatMessage(String draftMessage) - { - // get API key and parameters - String apiKey = System.getenv("WURST_OPENAI_KEY"); - String prompt = buildPrompt(draftMessage); - JsonObject params = buildParams(prompt); - System.out.println(params); - - try - { - // send request - WsonObject response = OpenAiUtils.requestCompletion(apiKey, params); - System.out.println(response); - - // read response - return extractCompletion(response); - - }catch(IOException | JsonException e) - { - e.printStackTrace(); - return ""; - } - } - - private String buildPrompt(String draftMessage) - { - // tell the model that it's talking in a Minecraft chat - String prompt = "=== Minecraft chat log ===\n"; - - // add chat history - List chatHistory = - MC.inGameHud.getChatHud().visibleMessages; - for(int i = chatHistory.size() - 1; i >= 0; i--) - { - // get message - String message = ChatUtils.getAsString(chatHistory.get(i)); - - // filter out Wurst messages so the model won't admit it's hacking - if(message.startsWith(ChatUtils.WURST_PREFIX)) - continue; - - // give non-player messages a sender to avoid confusing the model - if(!message.startsWith("<")) - message = " " + message; - - prompt += message + "\n"; - } - - // if the chat history is empty, add a dummy system message - if(chatHistory.isEmpty()) - prompt += " " + MC.getSession().getUsername() - + " joined the game.\n"; - - // add draft message - prompt += "<" + MC.getSession().getUsername() + "> " + draftMessage; - - return prompt; - } - - private JsonObject buildParams(String prompt) - { - JsonObject params = new JsonObject(); - params.addProperty("prompt", prompt); - params.addProperty("stop", "\n<"); - params.addProperty("model", "code-davinci-002"); - params.addProperty("max_tokens", 16); - params.addProperty("temperature", 0.7); - params.addProperty("frequency_penalty", 0.6); - return params; - } - - private String extractCompletion(WsonObject response) throws JsonException - { - // extract completion from response - String completion = - response.getArray("choices").getObject(0).getString("text"); - - // remove newlines - completion = completion.replace("\n", " "); - - return completion; - } - // See ChatInputSuggestorMixin } diff --git a/src/main/java/net/wurstclient/hacks/autocomplete/MessageCompleter.java b/src/main/java/net/wurstclient/hacks/autocomplete/MessageCompleter.java new file mode 100644 index 0000000000..d0820427ba --- /dev/null +++ b/src/main/java/net/wurstclient/hacks/autocomplete/MessageCompleter.java @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.hacks.autocomplete; + +import java.io.IOException; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.List; + +import com.google.gson.JsonObject; + +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.hud.ChatHudLine; +import net.wurstclient.WurstClient; +import net.wurstclient.util.ChatUtils; +import net.wurstclient.util.json.JsonException; +import net.wurstclient.util.json.JsonUtils; +import net.wurstclient.util.json.WsonObject; + +public abstract class MessageCompleter +{ + protected static final MinecraftClient MC = WurstClient.MC; + + protected final ModelSettings modelSettings; + + public MessageCompleter(ModelSettings modelSettings) + { + this.modelSettings = modelSettings; + } + + public final String completeChatMessage(String draftMessage) + { + // build prompt and parameters + String prompt = buildPrompt(draftMessage); + JsonObject params = buildParams(prompt); + System.out.println(params); + + try + { + // send request + WsonObject response = requestCompletion(params); + System.out.println(response); + + // read response + return extractCompletion(response); + + }catch(IOException | JsonException e) + { + e.printStackTrace(); + return ""; + } + } + + protected String buildPrompt(String draftMessage) + { + // tell the model that it's talking in a Minecraft chat + String prompt = "=== Minecraft chat log ===\n"; + + // add chat history + List chatHistory = + MC.inGameHud.getChatHud().visibleMessages; + for(int i = chatHistory.size() - 1; i >= 0; i--) + { + // get message + String message = ChatUtils.getAsString(chatHistory.get(i)); + + // filter out Wurst messages so the model won't admit it's hacking + if(message.startsWith(ChatUtils.WURST_PREFIX)) + continue; + + // give non-player messages a sender to avoid confusing the model + if(!message.startsWith("<")) + message = " " + message; + + prompt += message + "\n"; + } + + // if the chat history is empty, add a dummy system message + if(chatHistory.isEmpty()) + prompt += " " + MC.getSession().getUsername() + + " joined the game.\n"; + + // add draft message + prompt += "<" + MC.getSession().getUsername() + "> " + draftMessage; + + return prompt; + } + + protected JsonObject buildParams(String prompt) + { + JsonObject params = new JsonObject(); + params.addProperty("prompt", prompt); + params.addProperty("stop", "\n<"); + params.addProperty("model", "code-davinci-002"); + params.addProperty("max_tokens", modelSettings.maxTokens.getValueI()); + params.addProperty("temperature", modelSettings.temperature.getValue()); + params.addProperty("top_p", modelSettings.topP.getValue()); + params.addProperty("presence_penalty", + modelSettings.presencePenalty.getValue()); + params.addProperty("frequency_penalty", + modelSettings.frequencyPenalty.getValue()); + return params; + } + + protected WsonObject requestCompletion(JsonObject parameters) + throws IOException, JsonException + { + // set up the API request + URL url = new URL("https://api.openai.com/v1/completions"); + HttpURLConnection conn = (HttpURLConnection)url.openConnection(); + conn.setRequestMethod("POST"); + conn.setRequestProperty("Content-Type", "application/json"); + conn.setRequestProperty("Authorization", + "Bearer " + System.getenv("WURST_OPENAI_KEY")); + + // set the request body + conn.setDoOutput(true); + try(OutputStream os = conn.getOutputStream()) + { + os.write(JsonUtils.GSON.toJson(parameters).getBytes()); + os.flush(); + } + + // parse the response + return JsonUtils.parseConnectionToObject(conn); + } + + protected String extractCompletion(WsonObject response) throws JsonException + { + // extract completion from response + String completion = + response.getArray("choices").getObject(0).getString("text"); + + // remove newlines + completion = completion.replace("\n", " "); + + return completion; + } +} diff --git a/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java b/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java new file mode 100644 index 0000000000..897a50509b --- /dev/null +++ b/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.hacks.autocomplete; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.function.Consumer; + +import net.wurstclient.settings.Setting; +import net.wurstclient.settings.SliderSetting; +import net.wurstclient.settings.SliderSetting.ValueDisplay; + +public final class ModelSettings +{ + public final SliderSetting maxTokens = new SliderSetting("Max tokens", + "The maximum number of tokens that the model can generate.\n\n" + + "Higher values allow the model to predict longer chat messages," + + " but also increase the time it takes to generate predictions.\n\n" + + "The default value of 16 is fine for most use cases.\n\n" + + "When using an API that doesn't support stop sequences (like the" + + " oobabooga web UI), higher values will result in a lot of wasted" + + " time and tokens.", + 16, 1, 100, 1, ValueDisplay.INTEGER); + + public final SliderSetting temperature = new SliderSetting("Temperature", + "Controls the model's creativity and randomness. A higher value will" + + " result in more creative and sometimes nonsensical completions," + + " while a lower value will result in more boring completions.", + 0.7, 0, 2, 0.01, ValueDisplay.DECIMAL); + + public final SliderSetting topP = new SliderSetting("Top P", + "An alternative to temperature. Makes the model less random by only" + + " letting it choose from the most likely tokens.\n\n" + + "A value of 100% disables this feature by letting the model" + + " choose from all tokens.", + 1, 0, 1, 0.01, ValueDisplay.PERCENTAGE); + + public final SliderSetting presencePenalty = + new SliderSetting("Presence penalty", + "Penalty for choosing tokens that already appear in the chat" + + " history.\n\n" + + "Positive values encourage the model to use synonyms and" + + " talk about different topics. Negative values encourage the" + + " model to repeat the same word over and over again.", + 0, -2, 2, 0.01, ValueDisplay.DECIMAL); + + public final SliderSetting frequencyPenalty = + new SliderSetting("Frequency penalty", + "Similar to presence penalty, but based on how often the token" + + " appears in the chat history.\n\n" + + "Positive values encourage the model to use synonyms and" + + " talk about different topics. Negative values encourage the" + + " model to repeat existing chat messages.", + 0.6, -2, 2, 0.01, ValueDisplay.DECIMAL); + + private final List settings = + Collections.unmodifiableList(Arrays.asList(maxTokens, temperature, topP, + presencePenalty, frequencyPenalty)); + + public void forEach(Consumer action) + { + settings.forEach(action); + } +} diff --git a/src/main/java/net/wurstclient/hacks/autocomplete/OobaboogaMessageCompleter.java b/src/main/java/net/wurstclient/hacks/autocomplete/OobaboogaMessageCompleter.java new file mode 100644 index 0000000000..03e7d4b5a8 --- /dev/null +++ b/src/main/java/net/wurstclient/hacks/autocomplete/OobaboogaMessageCompleter.java @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.hacks.autocomplete; + +import java.io.IOException; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.URL; + +import com.google.gson.JsonObject; + +import net.wurstclient.util.json.JsonException; +import net.wurstclient.util.json.JsonUtils; +import net.wurstclient.util.json.WsonObject; + +public final class OobaboogaMessageCompleter extends MessageCompleter +{ + public OobaboogaMessageCompleter(ModelSettings modelSettings) + { + super(modelSettings); + } + + @Override + protected JsonObject buildParams(String prompt) + { + JsonObject params = new JsonObject(); + params.addProperty("prompt", prompt); + params.addProperty("max_length", modelSettings.maxTokens.getValueI()); + params.addProperty("temperature", modelSettings.temperature.getValue()); + params.addProperty("top_p", modelSettings.topP.getValue()); + return params; + } + + @Override + protected WsonObject requestCompletion(JsonObject parameters) + throws IOException, JsonException + { + // set up the API request + URL url = new URL("http://127.0.0.1:5000/api/v1/generate"); + HttpURLConnection conn = (HttpURLConnection)url.openConnection(); + conn.setRequestMethod("POST"); + conn.setRequestProperty("Content-Type", "application/json"); + + // set the request body + conn.setDoOutput(true); + try(OutputStream os = conn.getOutputStream()) + { + os.write(JsonUtils.GSON.toJson(parameters).getBytes()); + os.flush(); + } + + // parse the response + return JsonUtils.parseConnectionToObject(conn); + } + + @Override + protected String extractCompletion(WsonObject response) throws JsonException + { + // extract completion from response + String completion = + response.getArray("results").getObject(0).getString("text"); + + // remove the extra character at the start + if(!completion.isEmpty()) + completion = completion.substring(1); + + // remove the next message + if(completion.contains("\n<")) + completion = completion.substring(0, completion.indexOf("\n<")); + + // remove newlines + completion = completion.replace("\n", " "); + + return completion; + } +} diff --git a/src/main/java/net/wurstclient/hacks/autocomplete/OpenAiMessageCompleter.java b/src/main/java/net/wurstclient/hacks/autocomplete/OpenAiMessageCompleter.java new file mode 100644 index 0000000000..4c670d9d55 --- /dev/null +++ b/src/main/java/net/wurstclient/hacks/autocomplete/OpenAiMessageCompleter.java @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.hacks.autocomplete; + +public final class OpenAiMessageCompleter extends MessageCompleter +{ + public OpenAiMessageCompleter(ModelSettings modelSettings) + { + super(modelSettings); + } +} diff --git a/src/main/java/net/wurstclient/hacks/autocomplete/SuggestionHandler.java b/src/main/java/net/wurstclient/hacks/autocomplete/SuggestionHandler.java index f07f9d56df..66bed401c6 100644 --- a/src/main/java/net/wurstclient/hacks/autocomplete/SuggestionHandler.java +++ b/src/main/java/net/wurstclient/hacks/autocomplete/SuggestionHandler.java @@ -18,7 +18,7 @@ import net.wurstclient.settings.SliderSetting; import net.wurstclient.settings.SliderSetting.ValueDisplay; -public class SuggestionHandler +public final class SuggestionHandler { private final ArrayList suggestions = new ArrayList<>(); diff --git a/src/main/java/net/wurstclient/util/OpenAiUtils.java b/src/main/java/net/wurstclient/util/OpenAiUtils.java deleted file mode 100644 index 95abe9e4ee..0000000000 --- a/src/main/java/net/wurstclient/util/OpenAiUtils.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2014-2023 Wurst-Imperium and contributors. - * - * This source code is subject to the terms of the GNU General Public - * License, version 3. If a copy of the GPL was not distributed with this - * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt - */ -package net.wurstclient.util; - -import java.io.IOException; -import java.io.OutputStream; -import java.net.HttpURLConnection; -import java.net.URL; - -import com.google.gson.JsonObject; - -import net.wurstclient.util.json.JsonException; -import net.wurstclient.util.json.JsonUtils; -import net.wurstclient.util.json.WsonObject; - -public enum OpenAiUtils -{ - ; - - public static WsonObject requestCompletion(String apiKey, - JsonObject parameters) throws IOException, JsonException - { - // set up the API request - URL url = new URL("https://api.openai.com/v1/completions"); - HttpURLConnection conn = (HttpURLConnection)url.openConnection(); - conn.setRequestMethod("POST"); - conn.setRequestProperty("Content-Type", "application/json"); - conn.setRequestProperty("Authorization", "Bearer " + apiKey); - - // set the request body - conn.setDoOutput(true); - try(OutputStream os = conn.getOutputStream()) - { - os.write(JsonUtils.GSON.toJson(parameters).getBytes()); - os.flush(); - } - - // parse the response - return JsonUtils.parseConnectionToObject(conn); - } -} diff --git a/src/main/resources/assets/wurst/lang/en_us.json b/src/main/resources/assets/wurst/lang/en_us.json index 6dec9d16bb..3a7c630d5c 100644 --- a/src/main/resources/assets/wurst/lang/en_us.json +++ b/src/main/resources/assets/wurst/lang/en_us.json @@ -15,7 +15,7 @@ "description.wurst.setting.arrowdmg.trident_yeet_mode": "When enabled, tridents fly much further. Doesn't seem to affect damage or Riptide.\n\n§c§lWARNING:§r You can easily lose your trident by enabling this option!", "description.wurst.hack.autoarmor": "Manages your armor automatically.", "description.wurst.hack.autobuild": "Builds things automatically.\nPlace a single block to start building.", - "description.wurst.hack.autocomplete": "Auto-completes your chat messages using GPT-3. Requires an OpenAI account with API access.\n\n§c§lPRIVACY WARNING:§r This hack sends your chat history to OpenAI.", + "description.wurst.hack.autocomplete": "Auto-completes your chat messages using large language models. Requires either an OpenAI account with API access or a locally installed language model with the oobabooga web UI.", "description.wurst.hack.autodrop": "Automatically drops unwanted items.", "description.wurst.hack.autoleave": "Automatically leaves the server when your health is low.", "description.wurst.hack.autolibrarian": "Automatically trains a villager to become a librarian that sells a specific enchanted book. You can set up an entire trading hall in no time by using this hack.", From 2285426b99161416a7e93e144950c331d101eeb6 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 29 Mar 2023 18:01:42 +0200 Subject: [PATCH 028/282] [Wurst-Bot] Update to 23w13a --- gradle.properties | 8 ++++---- src/main/java/net/wurstclient/WurstClient.java | 2 +- src/main/java/net/wurstclient/mixin/StatsScreenMixin.java | 2 +- src/main/java/net/wurstclient/mixin/TitleScreenMixin.java | 2 +- .../net/wurstclient/navigator/NavigatorMainScreen.java | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gradle.properties b/gradle.properties index 56226dc318..502881c30e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,15 +4,15 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these at https://fabricmc.net/develop/ and # https://www.curseforge.com/minecraft/mc-mods/fabric-api -minecraft_version=23w12a -yarn_mappings=23w12a+build.1 +minecraft_version=23w13a +yarn_mappings=23w13a+build.1 loader_version=0.14.18 #Fabric api -fabric_version=0.76.1+1.20 +fabric_version=0.76.2+1.20 # Mod Properties -mod_version = v7.32-MC23w12a +mod_version = v7.32-MC23w13a maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index 3c7b546379..e4043e6c43 100644 --- a/src/main/java/net/wurstclient/WurstClient.java +++ b/src/main/java/net/wurstclient/WurstClient.java @@ -57,7 +57,7 @@ public enum WurstClient public static IMinecraftClient IMC; public static final String VERSION = "7.32"; - public static final String MC_VERSION = "23w12a"; + public static final String MC_VERSION = "23w13a"; private WurstAnalytics analytics; private EventManager eventManager; diff --git a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java index 187f0eeda4..5297484e74 100644 --- a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java @@ -55,7 +55,7 @@ private void onCreateButtons(CallbackInfo ci) .equals(I18n.translate("gui.done"))) continue; - button.setX(width / 2 + 2); + button.method_46421(width / 2 + 2); button.setWidth(150); } } diff --git a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java index 28488e077b..87f2248691 100644 --- a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java @@ -77,7 +77,7 @@ private void onTick(CallbackInfo ci) // adjust AltManager button if Realms button has been moved // happens when ModMenu is installed - altsButton.setY(realmsButton.getY()); + altsButton.method_46419(realmsButton.getY()); } /** diff --git a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java index aec6fd0567..0ebbbc4b05 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java @@ -73,7 +73,7 @@ protected void onResize() setFocused(searchBar); searchBar.setFocused(true); - searchBar.setX(middleX - 100); + searchBar.method_46421(middleX - 100); setContentHeight(navigatorDisplayList.size() / 3 * 20); } From 6d258d75b69bd8b916636f9f02ecc26866e37ea1 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Thu, 30 Mar 2023 01:06:56 +0200 Subject: [PATCH 029/282] Update to 23w13a --- .../net/wurstclient/mixin/AbstractSignEditScreenMixin.java | 6 +++--- src/main/java/net/wurstclient/mixin/StatsScreenMixin.java | 2 +- src/main/java/net/wurstclient/mixin/TitleScreenMixin.java | 2 +- .../java/net/wurstclient/navigator/NavigatorMainScreen.java | 2 +- src/main/resources/fabric.mod.json | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/wurstclient/mixin/AbstractSignEditScreenMixin.java b/src/main/java/net/wurstclient/mixin/AbstractSignEditScreenMixin.java index 5cc389cf91..c6670c4629 100644 --- a/src/main/java/net/wurstclient/mixin/AbstractSignEditScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/AbstractSignEditScreenMixin.java @@ -25,7 +25,7 @@ public abstract class AbstractSignEditScreenMixin extends Screen { @Shadow @Final - private String[] text; + private String[] messages; private AbstractSignEditScreenMixin(WurstClient wurst, Text text_1) { @@ -42,7 +42,7 @@ private void onInit(CallbackInfo ci) return; for(int i = 0; i < 4; i++) - text[i] = autoSignText[i]; + messages[i] = autoSignText[i]; finishEditing(); } @@ -50,7 +50,7 @@ private void onInit(CallbackInfo ci) @Inject(at = {@At("HEAD")}, method = {"finishEditing()V"}) private void onFinishEditing(CallbackInfo ci) { - WurstClient.INSTANCE.getHax().autoSignHack.setSignText(text); + WurstClient.INSTANCE.getHax().autoSignHack.setSignText(messages); } @Shadow diff --git a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java index 5297484e74..187f0eeda4 100644 --- a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java @@ -55,7 +55,7 @@ private void onCreateButtons(CallbackInfo ci) .equals(I18n.translate("gui.done"))) continue; - button.method_46421(width / 2 + 2); + button.setX(width / 2 + 2); button.setWidth(150); } } diff --git a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java index 87f2248691..28488e077b 100644 --- a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java @@ -77,7 +77,7 @@ private void onTick(CallbackInfo ci) // adjust AltManager button if Realms button has been moved // happens when ModMenu is installed - altsButton.method_46419(realmsButton.getY()); + altsButton.setY(realmsButton.getY()); } /** diff --git a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java index 0ebbbc4b05..aec6fd0567 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java @@ -73,7 +73,7 @@ protected void onResize() setFocused(searchBar); searchBar.setFocused(true); - searchBar.method_46421(middleX - 100); + searchBar.setX(middleX - 100); setContentHeight(navigatorDisplayList.size() / 3 * 20); } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index b710db5909..1660f6f190 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -30,8 +30,8 @@ "depends": { "fabricloader": ">=0.14.18", - "fabric-api": ">=0.76.1", - "minecraft": "~1.20-alpha.23.12.a", + "fabric-api": ">=0.76.2", + "minecraft": "~1.20-alpha.23.13.a", "java": ">=17" }, "suggests": { From f5197413bf0733744d153c21bc264c8b2461496d Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sat, 1 Apr 2023 22:24:47 +0200 Subject: [PATCH 030/282] [Wurst-Bot] Update to 23w13a_or_b --- gradle.properties | 10 +++++----- src/main/java/net/wurstclient/WurstClient.java | 2 +- .../java/net/wurstclient/mixin/StatsScreenMixin.java | 2 +- .../java/net/wurstclient/mixin/TitleScreenMixin.java | 2 +- .../net/wurstclient/navigator/NavigatorMainScreen.java | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/gradle.properties b/gradle.properties index 502881c30e..ef4a4b5700 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,15 +4,15 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these at https://fabricmc.net/develop/ and # https://www.curseforge.com/minecraft/mc-mods/fabric-api -minecraft_version=23w13a -yarn_mappings=23w13a+build.1 -loader_version=0.14.18 +minecraft_version=23w13a_or_b +yarn_mappings=23w13a_or_b+build.2 +loader_version=0.14.19 #Fabric api -fabric_version=0.76.2+1.20 +fabric_version=0.76.3+23w13a_or_b # Mod Properties -mod_version = v7.32-MC23w13a +mod_version = v7.32-MC23w13a_or_b maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index e4043e6c43..390728b350 100644 --- a/src/main/java/net/wurstclient/WurstClient.java +++ b/src/main/java/net/wurstclient/WurstClient.java @@ -57,7 +57,7 @@ public enum WurstClient public static IMinecraftClient IMC; public static final String VERSION = "7.32"; - public static final String MC_VERSION = "23w13a"; + public static final String MC_VERSION = "23w13a_or_b"; private WurstAnalytics analytics; private EventManager eventManager; diff --git a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java index 187f0eeda4..5297484e74 100644 --- a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java @@ -55,7 +55,7 @@ private void onCreateButtons(CallbackInfo ci) .equals(I18n.translate("gui.done"))) continue; - button.setX(width / 2 + 2); + button.method_46421(width / 2 + 2); button.setWidth(150); } } diff --git a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java index 28488e077b..87f2248691 100644 --- a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java @@ -77,7 +77,7 @@ private void onTick(CallbackInfo ci) // adjust AltManager button if Realms button has been moved // happens when ModMenu is installed - altsButton.setY(realmsButton.getY()); + altsButton.method_46419(realmsButton.getY()); } /** diff --git a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java index aec6fd0567..0ebbbc4b05 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java @@ -73,7 +73,7 @@ protected void onResize() setFocused(searchBar); searchBar.setFocused(true); - searchBar.setX(middleX - 100); + searchBar.method_46421(middleX - 100); setContentHeight(navigatorDisplayList.size() / 3 * 20); } From a4b0ab03ce616231491380d07da78e971ec358f0 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sat, 1 Apr 2023 22:31:40 +0200 Subject: [PATCH 031/282] Update to 23w13a_or_b --- src/main/java/net/wurstclient/mixin/StatsScreenMixin.java | 2 +- src/main/java/net/wurstclient/mixin/TitleScreenMixin.java | 2 +- .../java/net/wurstclient/navigator/NavigatorMainScreen.java | 2 +- src/main/resources/fabric.mod.json | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java index 5297484e74..187f0eeda4 100644 --- a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java @@ -55,7 +55,7 @@ private void onCreateButtons(CallbackInfo ci) .equals(I18n.translate("gui.done"))) continue; - button.method_46421(width / 2 + 2); + button.setX(width / 2 + 2); button.setWidth(150); } } diff --git a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java index 87f2248691..28488e077b 100644 --- a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java @@ -77,7 +77,7 @@ private void onTick(CallbackInfo ci) // adjust AltManager button if Realms button has been moved // happens when ModMenu is installed - altsButton.method_46419(realmsButton.getY()); + altsButton.setY(realmsButton.getY()); } /** diff --git a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java index 0ebbbc4b05..aec6fd0567 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java @@ -73,7 +73,7 @@ protected void onResize() setFocused(searchBar); searchBar.setFocused(true); - searchBar.method_46421(middleX - 100); + searchBar.setX(middleX - 100); setContentHeight(navigatorDisplayList.size() / 3 * 20); } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 1660f6f190..5f63079e27 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -29,9 +29,9 @@ "accessWidener" : "wurst.accesswidener", "depends": { - "fabricloader": ">=0.14.18", - "fabric-api": ">=0.76.2", - "minecraft": "~1.20-alpha.23.13.a", + "fabricloader": ">=0.14.19", + "fabric-api": ">=0.76.3", + "minecraft": "~1.20-alpha.23.13.ab", "java": ">=17" }, "suggests": { From 36297be51721e51cafe21c878df180a7a01263c4 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sat, 1 Apr 2023 22:46:01 +0200 Subject: [PATCH 032/282] Add sus gravel to X-Ray's default list of ores --- src/main/java/net/wurstclient/hacks/XRayHack.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/XRayHack.java b/src/main/java/net/wurstclient/hacks/XRayHack.java index 0aa07bead1..117ab241e1 100644 --- a/src/main/java/net/wurstclient/hacks/XRayHack.java +++ b/src/main/java/net/wurstclient/hacks/XRayHack.java @@ -62,8 +62,9 @@ public final class XRayHack extends Hack implements UpdateListener, "minecraft:raw_copper_block", "minecraft:raw_gold_block", "minecraft:raw_iron_block", "minecraft:redstone_block", "minecraft:redstone_ore", "minecraft:repeating_command_block", - "minecraft:spawner", "minecraft:suspicious_sand", "minecraft:tnt", - "minecraft:torch", "minecraft:trapped_chest", "minecraft:water"); + "minecraft:spawner", "minecraft:suspicious_gravel", + "minecraft:suspicious_sand", "minecraft:tnt", "minecraft:torch", + "minecraft:trapped_chest", "minecraft:water"); private ArrayList oreNames; private final String warning; From 5e571aaa2db9d0ce6092876450fb10070425de96 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 2 Apr 2023 19:47:42 +0200 Subject: [PATCH 033/282] Refactor AutoComplate.onEnable() --- .../wurstclient/hacks/AutoCompleteHack.java | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java b/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java index c09e616c97..6a6000a5e4 100644 --- a/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java @@ -85,23 +85,19 @@ public AutoCompleteHack() @Override protected void onEnable() { - switch(apiProvider.getSelected()) + completer = switch(apiProvider.getSelected()) { - case OPENAI: - String apiKey = System.getenv("WURST_OPENAI_KEY"); - if(apiKey == null) - { - ChatUtils.error("API key not found. Please set the" - + " WURST_OPENAI_KEY environment variable and reboot."); - setEnabled(false); - return; - } - completer = new OpenAiMessageCompleter(modelSettings); - break; - - case OOBABOOGA: - completer = new OobaboogaMessageCompleter(modelSettings); - break; + case OPENAI -> new OpenAiMessageCompleter(modelSettings); + case OOBABOOGA -> new OobaboogaMessageCompleter(modelSettings); + }; + + if(completer instanceof OpenAiMessageCompleter + && System.getenv("WURST_OPENAI_KEY") == null) + { + ChatUtils.error("API key not found. Please set the" + + " WURST_OPENAI_KEY environment variable and reboot."); + setEnabled(false); + return; } EVENTS.add(ChatOutputListener.class, this); From f379c602a921a9d0a36cb39cd765eac7ac5f4dd9 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 2 Apr 2023 20:27:51 +0200 Subject: [PATCH 034/282] Move API provider setting to a separate class --- .../wurstclient/hacks/AutoCompleteHack.java | 34 +------------- .../autocomplete/ApiProviderSetting.java | 47 +++++++++++++++++++ 2 files changed, 49 insertions(+), 32 deletions(-) create mode 100644 src/main/java/net/wurstclient/hacks/autocomplete/ApiProviderSetting.java diff --git a/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java b/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java index 6a6000a5e4..32e7b30944 100644 --- a/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoCompleteHack.java @@ -17,12 +17,12 @@ import net.wurstclient.events.ChatOutputListener; import net.wurstclient.events.UpdateListener; import net.wurstclient.hack.Hack; +import net.wurstclient.hacks.autocomplete.ApiProviderSetting; import net.wurstclient.hacks.autocomplete.MessageCompleter; import net.wurstclient.hacks.autocomplete.ModelSettings; import net.wurstclient.hacks.autocomplete.OobaboogaMessageCompleter; import net.wurstclient.hacks.autocomplete.OpenAiMessageCompleter; import net.wurstclient.hacks.autocomplete.SuggestionHandler; -import net.wurstclient.settings.EnumSetting; import net.wurstclient.util.ChatUtils; @SearchTags({"auto complete", "Copilot", "ChatGPT", "chat GPT", "GPT-3", "GPT3", @@ -32,37 +32,7 @@ public final class AutoCompleteHack extends Hack { private final ModelSettings modelSettings = new ModelSettings(); private final SuggestionHandler suggestionHandler = new SuggestionHandler(); - - private final EnumSetting apiProvider = new EnumSetting<>( - "API provider", - "\u00a7lOpenAI\u00a7r lets you use models like GPT-3, but requires an" - + " account with API access, costs money to use and sends your chat" - + " history to their servers. The name is a lie - it's closed" - + " source.\n\n" - + "\u00a7loobabooga\u00a7r lets you use models like LLaMA and many" - + " others. It's a true open source alternative to OpenAI that you" - + " can run locally on your own computer. It's free to use and does" - + " not send your chat history to any servers.", - ApiProvider.values(), ApiProvider.OOBABOOGA); - - private enum ApiProvider - { - OPENAI("OpenAI"), - OOBABOOGA("oobabooga"); - - private final String name; - - private ApiProvider(String name) - { - this.name = name; - } - - @Override - public String toString() - { - return name; - } - } + private final ApiProviderSetting apiProvider = new ApiProviderSetting(); private MessageCompleter completer; private String draftMessage; diff --git a/src/main/java/net/wurstclient/hacks/autocomplete/ApiProviderSetting.java b/src/main/java/net/wurstclient/hacks/autocomplete/ApiProviderSetting.java new file mode 100644 index 0000000000..940629a2ce --- /dev/null +++ b/src/main/java/net/wurstclient/hacks/autocomplete/ApiProviderSetting.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.hacks.autocomplete; + +import net.wurstclient.settings.EnumSetting; + +public final class ApiProviderSetting + extends EnumSetting +{ + public ApiProviderSetting() + { + super("API provider", + "\u00a7lOpenAI\u00a7r lets you use models like GPT-3, but requires an" + + " account with API access, costs money to use and sends your chat" + + " history to their servers. The name is a lie - it's closed" + + " source.\n\n" + + "\u00a7loobabooga\u00a7r lets you use models like LLaMA and many" + + " others. It's a true open source alternative to OpenAI that you" + + " can run locally on your own computer. It's free to use and does" + + " not send your chat history to any servers.", + ApiProvider.values(), ApiProvider.OOBABOOGA); + } + + public enum ApiProvider + { + OPENAI("OpenAI"), + OOBABOOGA("oobabooga"); + + private final String name; + + private ApiProvider(String name) + { + this.name = name; + } + + @Override + public String toString() + { + return name; + } + } +} From 8fa57054207a38d042f18c51bd50b08b95632c1f Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 3 Apr 2023 21:28:21 +0200 Subject: [PATCH 035/282] Fix gray text on some Navigator screens --- .../java/net/wurstclient/navigator/NavigatorFeatureScreen.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/net/wurstclient/navigator/NavigatorFeatureScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorFeatureScreen.java index a6f9a6bf36..013c169e41 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorFeatureScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorFeatureScreen.java @@ -471,6 +471,7 @@ else if(mouseX >= x1 && mouseX <= x2 && mouseY >= y1 } // text + RenderSystem.setShaderColor(1, 1, 1, 1); int textY = bgy1 + scroll + 2; for(String line : text.split("\n")) { From 5f4645f9a7787d0be3fe751a5432abede3a007b9 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 3 Apr 2023 22:36:45 +0200 Subject: [PATCH 036/282] Add improved Freecam teleporting Inspired by https://www.reddit.com/r/WurstClient/comments/128ubvx/how_to_use_tp_more_effectively/ --- .../java/net/wurstclient/commands/TpCmd.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/wurstclient/commands/TpCmd.java b/src/main/java/net/wurstclient/commands/TpCmd.java index f84f31a81b..a99e7a72a3 100644 --- a/src/main/java/net/wurstclient/commands/TpCmd.java +++ b/src/main/java/net/wurstclient/commands/TpCmd.java @@ -10,22 +10,31 @@ import java.util.Comparator; import java.util.stream.StreamSupport; -import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.entity.LivingEntity; import net.minecraft.util.math.BlockPos; import net.wurstclient.command.CmdError; import net.wurstclient.command.CmdException; import net.wurstclient.command.CmdSyntaxError; import net.wurstclient.command.Command; +import net.wurstclient.settings.CheckboxSetting; import net.wurstclient.util.FakePlayerEntity; import net.wurstclient.util.MathUtils; public final class TpCmd extends Command { + private final CheckboxSetting disableFreecam = + new CheckboxSetting("Disable Freecam", + "Disables Freecam just before teleporting.\n\n" + + "This allows you to teleport your actual character to your" + + " Freecam position by typing \".tp ~ ~ ~\" while Freecam is" + + " enabled.", + true); + public TpCmd() { super("tp", "Teleports you up to 10 blocks away.", ".tp ", ".tp "); + addSetting(disableFreecam); } @Override @@ -33,8 +42,10 @@ public void call(String[] args) throws CmdException { BlockPos pos = argsToPos(args); - ClientPlayerEntity player = MC.player; - player.setPosition(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5); + if(disableFreecam.isChecked() && WURST.getHax().freecamHack.isEnabled()) + WURST.getHax().freecamHack.setEnabled(false); + + MC.player.setPosition(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5); } private BlockPos argsToPos(String... args) throws CmdException From f09d6e093426364899fa81ce773eea7c75cd0163 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Tue, 4 Apr 2023 18:12:47 +0200 Subject: [PATCH 037/282] Fix BlockComponents not rendering correctly --- .../wurstclient/clickgui/components/BlockComponent.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/main/java/net/wurstclient/clickgui/components/BlockComponent.java b/src/main/java/net/wurstclient/clickgui/components/BlockComponent.java index 65432bbbe6..60b20f45c2 100644 --- a/src/main/java/net/wurstclient/clickgui/components/BlockComponent.java +++ b/src/main/java/net/wurstclient/clickgui/components/BlockComponent.java @@ -25,7 +25,6 @@ import net.wurstclient.WurstClient; import net.wurstclient.clickgui.ClickGui; import net.wurstclient.clickgui.Component; -import net.wurstclient.clickgui.Window; import net.wurstclient.clickgui.screens.EditBlockScreen; import net.wurstclient.settings.BlockSetting; import net.wurstclient.util.RenderUtils; @@ -121,14 +120,7 @@ else if(hBlock) String text = setting.getName() + ":"; fr.draw(matrixStack, text, x1, y1 + 2, txtColor); - MatrixStack modelViewStack = RenderSystem.getModelViewStack(); - modelViewStack.push(); - Window parent = getParent(); - modelViewStack.translate(parent.getX(), - parent.getY() + 13 + parent.getScrollOffset(), 0); RenderUtils.drawItem(matrixStack, stack, x3, y1, true); - modelViewStack.pop(); - RenderSystem.applyModelViewMatrix(); GL11.glEnable(GL11.GL_BLEND); } From c27fb79d258f7801ca3a7e100e994b55b6bb6445 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Tue, 4 Apr 2023 20:40:41 +0200 Subject: [PATCH 038/282] Move OpenAI-specific methods to OpenAiMessageCompleter --- .../hacks/autocomplete/MessageCompleter.java | 57 ++-------------- .../autocomplete/OpenAiMessageCompleter.java | 65 +++++++++++++++++++ 2 files changed, 70 insertions(+), 52 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/autocomplete/MessageCompleter.java b/src/main/java/net/wurstclient/hacks/autocomplete/MessageCompleter.java index d0820427ba..9da3a4339f 100644 --- a/src/main/java/net/wurstclient/hacks/autocomplete/MessageCompleter.java +++ b/src/main/java/net/wurstclient/hacks/autocomplete/MessageCompleter.java @@ -8,9 +8,6 @@ package net.wurstclient.hacks.autocomplete; import java.io.IOException; -import java.io.OutputStream; -import java.net.HttpURLConnection; -import java.net.URL; import java.util.List; import com.google.gson.JsonObject; @@ -20,7 +17,6 @@ import net.wurstclient.WurstClient; import net.wurstclient.util.ChatUtils; import net.wurstclient.util.json.JsonException; -import net.wurstclient.util.json.JsonUtils; import net.wurstclient.util.json.WsonObject; public abstract class MessageCompleter @@ -92,54 +88,11 @@ protected String buildPrompt(String draftMessage) return prompt; } - protected JsonObject buildParams(String prompt) - { - JsonObject params = new JsonObject(); - params.addProperty("prompt", prompt); - params.addProperty("stop", "\n<"); - params.addProperty("model", "code-davinci-002"); - params.addProperty("max_tokens", modelSettings.maxTokens.getValueI()); - params.addProperty("temperature", modelSettings.temperature.getValue()); - params.addProperty("top_p", modelSettings.topP.getValue()); - params.addProperty("presence_penalty", - modelSettings.presencePenalty.getValue()); - params.addProperty("frequency_penalty", - modelSettings.frequencyPenalty.getValue()); - return params; - } + protected abstract JsonObject buildParams(String prompt); - protected WsonObject requestCompletion(JsonObject parameters) - throws IOException, JsonException - { - // set up the API request - URL url = new URL("https://api.openai.com/v1/completions"); - HttpURLConnection conn = (HttpURLConnection)url.openConnection(); - conn.setRequestMethod("POST"); - conn.setRequestProperty("Content-Type", "application/json"); - conn.setRequestProperty("Authorization", - "Bearer " + System.getenv("WURST_OPENAI_KEY")); - - // set the request body - conn.setDoOutput(true); - try(OutputStream os = conn.getOutputStream()) - { - os.write(JsonUtils.GSON.toJson(parameters).getBytes()); - os.flush(); - } - - // parse the response - return JsonUtils.parseConnectionToObject(conn); - } + protected abstract WsonObject requestCompletion(JsonObject parameters) + throws IOException, JsonException; - protected String extractCompletion(WsonObject response) throws JsonException - { - // extract completion from response - String completion = - response.getArray("choices").getObject(0).getString("text"); - - // remove newlines - completion = completion.replace("\n", " "); - - return completion; - } + protected abstract String extractCompletion(WsonObject response) + throws JsonException; } diff --git a/src/main/java/net/wurstclient/hacks/autocomplete/OpenAiMessageCompleter.java b/src/main/java/net/wurstclient/hacks/autocomplete/OpenAiMessageCompleter.java index 4c670d9d55..81178ca130 100644 --- a/src/main/java/net/wurstclient/hacks/autocomplete/OpenAiMessageCompleter.java +++ b/src/main/java/net/wurstclient/hacks/autocomplete/OpenAiMessageCompleter.java @@ -7,10 +7,75 @@ */ package net.wurstclient.hacks.autocomplete; +import java.io.IOException; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.URL; + +import com.google.gson.JsonObject; + +import net.wurstclient.util.json.JsonException; +import net.wurstclient.util.json.JsonUtils; +import net.wurstclient.util.json.WsonObject; + public final class OpenAiMessageCompleter extends MessageCompleter { public OpenAiMessageCompleter(ModelSettings modelSettings) { super(modelSettings); } + + @Override + protected JsonObject buildParams(String prompt) + { + JsonObject params = new JsonObject(); + params.addProperty("prompt", prompt); + params.addProperty("stop", "\n<"); + params.addProperty("model", "code-davinci-002"); + params.addProperty("max_tokens", modelSettings.maxTokens.getValueI()); + params.addProperty("temperature", modelSettings.temperature.getValue()); + params.addProperty("top_p", modelSettings.topP.getValue()); + params.addProperty("presence_penalty", + modelSettings.presencePenalty.getValue()); + params.addProperty("frequency_penalty", + modelSettings.frequencyPenalty.getValue()); + return params; + } + + @Override + protected WsonObject requestCompletion(JsonObject parameters) + throws IOException, JsonException + { + // set up the API request + URL url = new URL("https://api.openai.com/v1/completions"); + HttpURLConnection conn = (HttpURLConnection)url.openConnection(); + conn.setRequestMethod("POST"); + conn.setRequestProperty("Content-Type", "application/json"); + conn.setRequestProperty("Authorization", + "Bearer " + System.getenv("WURST_OPENAI_KEY")); + + // set the request body + conn.setDoOutput(true); + try(OutputStream os = conn.getOutputStream()) + { + os.write(JsonUtils.GSON.toJson(parameters).getBytes()); + os.flush(); + } + + // parse the response + return JsonUtils.parseConnectionToObject(conn); + } + + @Override + protected String extractCompletion(WsonObject response) throws JsonException + { + // extract completion from response + String completion = + response.getArray("choices").getObject(0).getString("text"); + + // remove newlines + completion = completion.replace("\n", " "); + + return completion; + } } From e5d4b6c234faaabd47f93cd11e5940396c11dc3c Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Thu, 6 Apr 2023 18:26:21 +0200 Subject: [PATCH 039/282] [Wurst-Bot] Update to 23w14a --- gradle.properties | 8 ++++---- src/main/java/net/wurstclient/WurstClient.java | 2 +- src/main/java/net/wurstclient/mixin/StatsScreenMixin.java | 2 +- src/main/java/net/wurstclient/mixin/TitleScreenMixin.java | 2 +- .../net/wurstclient/navigator/NavigatorMainScreen.java | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gradle.properties b/gradle.properties index ef4a4b5700..27b4962ac7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,15 +4,15 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these at https://fabricmc.net/develop/ and # https://www.curseforge.com/minecraft/mc-mods/fabric-api -minecraft_version=23w13a_or_b -yarn_mappings=23w13a_or_b+build.2 +minecraft_version=23w14a +yarn_mappings=23w14a+build.2 loader_version=0.14.19 #Fabric api -fabric_version=0.76.3+23w13a_or_b +fabric_version=0.77.2+1.20 # Mod Properties -mod_version = v7.32-MC23w13a_or_b +mod_version = v7.32-MC23w14a maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index 390728b350..2eab5632bb 100644 --- a/src/main/java/net/wurstclient/WurstClient.java +++ b/src/main/java/net/wurstclient/WurstClient.java @@ -57,7 +57,7 @@ public enum WurstClient public static IMinecraftClient IMC; public static final String VERSION = "7.32"; - public static final String MC_VERSION = "23w13a_or_b"; + public static final String MC_VERSION = "23w14a"; private WurstAnalytics analytics; private EventManager eventManager; diff --git a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java index 187f0eeda4..5297484e74 100644 --- a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java @@ -55,7 +55,7 @@ private void onCreateButtons(CallbackInfo ci) .equals(I18n.translate("gui.done"))) continue; - button.setX(width / 2 + 2); + button.method_46421(width / 2 + 2); button.setWidth(150); } } diff --git a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java index 28488e077b..87f2248691 100644 --- a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java @@ -77,7 +77,7 @@ private void onTick(CallbackInfo ci) // adjust AltManager button if Realms button has been moved // happens when ModMenu is installed - altsButton.setY(realmsButton.getY()); + altsButton.method_46419(realmsButton.getY()); } /** diff --git a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java index aec6fd0567..0ebbbc4b05 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java @@ -73,7 +73,7 @@ protected void onResize() setFocused(searchBar); searchBar.setFocused(true); - searchBar.setX(middleX - 100); + searchBar.method_46421(middleX - 100); setContentHeight(navigatorDisplayList.size() / 3 * 20); } From 5de649331e3c44cbac382c251278c496e9b129e6 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Thu, 6 Apr 2023 21:51:31 +0200 Subject: [PATCH 040/282] Update to 23w14a --- .../java/net/wurstclient/ai/PathFinder.java | 44 +++++++++---------- .../java/net/wurstclient/hacks/GlideHack.java | 7 ++- .../java/net/wurstclient/hacks/JesusHack.java | 10 +++-- .../net/wurstclient/hacks/NukerLegitHack.java | 4 +- .../net/wurstclient/hacks/SpeedNukerHack.java | 4 +- .../mixin/DisconnectedScreenMixin.java | 27 +++++++----- .../wurstclient/mixin/StatsScreenMixin.java | 2 +- .../wurstclient/mixin/TitleScreenMixin.java | 2 +- .../navigator/NavigatorMainScreen.java | 2 +- .../util/LastServerRememberer.java | 2 +- .../net/wurstclient/util/RenderUtils.java | 4 +- src/main/resources/fabric.mod.json | 4 +- 12 files changed, 57 insertions(+), 55 deletions(-) diff --git a/src/main/java/net/wurstclient/ai/PathFinder.java b/src/main/java/net/wurstclient/ai/PathFinder.java index 0e3769722f..a4799a28d6 100644 --- a/src/main/java/net/wurstclient/ai/PathFinder.java +++ b/src/main/java/net/wurstclient/ai/PathFinder.java @@ -19,6 +19,9 @@ import net.minecraft.block.*; import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.fluid.Fluid; +import net.minecraft.fluid.LavaFluid; +import net.minecraft.fluid.WaterFluid; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.wurstclient.WurstClient; @@ -197,15 +200,13 @@ private ArrayList getNeighbors(PathPos pos) && (flying || canClimbUpAt(pos) || goal.equals(up) || canSafelyStandOn(north) || canSafelyStandOn(east) || canSafelyStandOn(south) || canSafelyStandOn(west)) - && (divingAllowed || BlockUtils.getState(up.up()) - .getMaterial() != Material.WATER)) + && (divingAllowed || BlockUtils.getBlock(up.up()) != Blocks.WATER)) neighbors.add(new PathPos(up, onGround)); // down if(pos.getY() > WurstClient.MC.world.getBottomY() && canGoThrough(down) && canGoAbove(down.down()) && (flying || canFallBelow(pos)) - && (divingAllowed - || BlockUtils.getState(pos).getMaterial() != Material.WATER)) + && (divingAllowed || BlockUtils.getBlock(pos) != Blocks.WATER)) neighbors.add(new PathPos(down)); return neighbors; @@ -247,8 +248,7 @@ protected boolean isPassable(BlockPos pos) if(!canGoAbove(pos.down())) return false; - if(!divingAllowed - && BlockUtils.getState(up).getMaterial() == Material.WATER) + if(!divingAllowed && BlockUtils.getBlock(up) == Blocks.WATER) return false; return true; @@ -266,8 +266,7 @@ protected boolean isPassableWithoutMining(BlockPos pos) if(!canGoAbove(pos.down())) return false; - if(!divingAllowed - && BlockUtils.getState(up).getMaterial() == Material.WATER) + if(!divingAllowed && BlockUtils.getBlock(up) == Blocks.WATER) return false; return true; @@ -286,8 +285,8 @@ protected boolean canBeSolid(BlockPos pos) return material.blocksMovement() && !(block instanceof AbstractSignBlock) - || block instanceof LadderBlock || jesus - && (material == Material.WATER || material == Material.LAVA); + || block instanceof LadderBlock + || jesus && (block == Blocks.WATER || block == Blocks.LAVA); } @SuppressWarnings("deprecation") @@ -312,7 +311,7 @@ private boolean canGoThrough(BlockPos pos) // check if safe if(!invulnerable - && (material == Material.LAVA || material == Material.FIRE)) + && (block == Blocks.LAVA || block instanceof AbstractFireBlock)) return false; return true; @@ -332,13 +331,14 @@ private boolean canGoAbove(BlockPos pos) private boolean canSafelyStandOn(BlockPos pos) { // check if solid - Material material = BlockUtils.getState(pos).getMaterial(); if(!canBeSolid(pos)) return false; // check if safe - if(!invulnerable - && (material == Material.CACTUS || material == Material.LAVA)) + BlockState state = BlockUtils.getState(pos); + Fluid fluid = state.getFluidState().getFluid(); + if(!invulnerable && (state.getBlock() instanceof CactusBlock + || fluid instanceof LavaFluid)) return false; return true; @@ -381,7 +381,7 @@ private boolean canFallBelow(PathPos pos) // check if block resets fall damage Block prevBlock = BlockUtils.getBlock(prevPos); BlockState prevState = BlockUtils.getState(prevPos); - if(prevState.getMaterial() == Material.WATER + if(prevState.getFluidState().getFluid() instanceof WaterFluid || prevBlock instanceof LadderBlock || prevBlock instanceof VineBlock || prevBlock instanceof CobwebBlock) @@ -395,8 +395,8 @@ private boolean canFallBelow(PathPos pos) private boolean canFlyAt(BlockPos pos) { - return flying || !noWaterSlowdown - && BlockUtils.getState(pos).getMaterial() == Material.WATER; + return flying + || !noWaterSlowdown && BlockUtils.getBlock(pos) == Blocks.WATER; } private boolean canClimbUpAt(BlockPos pos) @@ -422,7 +422,7 @@ private boolean canMoveSidewaysInMidairAt(BlockPos pos) { // check feet Block blockFeet = BlockUtils.getBlock(pos); - if(BlockUtils.getState(pos).getMaterial().isLiquid() + if(BlockUtils.getBlock(pos) instanceof FluidBlock || blockFeet instanceof LadderBlock || blockFeet instanceof VineBlock || blockFeet instanceof CobwebBlock) @@ -430,7 +430,7 @@ private boolean canMoveSidewaysInMidairAt(BlockPos pos) // check head Block blockHead = BlockUtils.getBlock(pos.up()); - if(BlockUtils.getState(pos.up()).getMaterial().isLiquid() + if(BlockUtils.getBlock(pos.up()) instanceof FluidBlock || blockHead instanceof CobwebBlock) return true; @@ -445,12 +445,12 @@ private float getCost(BlockPos current, BlockPos next) for(int i = 0; i < positions.length; i++) { BlockPos pos = positions[i]; - Material material = BlockUtils.getState(pos).getMaterial(); + Block block = BlockUtils.getBlock(pos); // liquids - if(material == Material.WATER && !noWaterSlowdown) + if(block == Blocks.WATER && !noWaterSlowdown) costs[i] *= 1.3164437838225804F; - else if(material == Material.LAVA) + else if(block == Blocks.LAVA) costs[i] *= 4.539515393656079F; // soul sand diff --git a/src/main/java/net/wurstclient/hacks/GlideHack.java b/src/main/java/net/wurstclient/hacks/GlideHack.java index 0ad91c25ae..702bc641a3 100644 --- a/src/main/java/net/wurstclient/hacks/GlideHack.java +++ b/src/main/java/net/wurstclient/hacks/GlideHack.java @@ -10,8 +10,7 @@ import java.util.stream.Stream; import java.util.stream.StreamSupport; -import net.minecraft.block.BlockState; -import net.minecraft.block.Material; +import net.minecraft.block.FluidBlock; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; @@ -85,8 +84,8 @@ public void onUpdate() .stream(BlockUtils.getAllInBox(min, max).spliterator(), true); // manual collision check, since liquids don't have bounding boxes - if(stream.map(BlockUtils::getState).map(BlockState::getMaterial) - .anyMatch(Material::isLiquid)) + if(stream.map(BlockUtils::getBlock) + .anyMatch(b -> b instanceof FluidBlock)) return; } diff --git a/src/main/java/net/wurstclient/hacks/JesusHack.java b/src/main/java/net/wurstclient/hacks/JesusHack.java index ba2f53a5ff..69da3872db 100644 --- a/src/main/java/net/wurstclient/hacks/JesusHack.java +++ b/src/main/java/net/wurstclient/hacks/JesusHack.java @@ -10,7 +10,9 @@ import java.util.ArrayList; import java.util.stream.Collectors; -import net.minecraft.block.Material; +import net.minecraft.block.AirBlock; +import net.minecraft.block.Block; +import net.minecraft.block.FluidBlock; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.network.packet.Packet; import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; @@ -166,11 +168,11 @@ public boolean isOverLiquid() for(Box bb : blockCollisions) { BlockPos pos = BlockPos.ofFloored(bb.getCenter()); - Material material = BlockUtils.getState(pos).getMaterial(); + Block block = BlockUtils.getBlock(pos); - if(material == Material.WATER || material == Material.LAVA) + if(block instanceof FluidBlock) foundLiquid = true; - else if(material != Material.AIR) + else if(!(block instanceof AirBlock)) foundSolid = true; } diff --git a/src/main/java/net/wurstclient/hacks/NukerLegitHack.java b/src/main/java/net/wurstclient/hacks/NukerLegitHack.java index 85a1e0a52f..e75412036e 100644 --- a/src/main/java/net/wurstclient/hacks/NukerLegitHack.java +++ b/src/main/java/net/wurstclient/hacks/NukerLegitHack.java @@ -20,7 +20,6 @@ import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; -import net.minecraft.block.Material; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.hit.BlockHitResult; @@ -150,8 +149,7 @@ public void onLeftClick(LeftClickEvent event) // check pos BlockPos pos = ((BlockHitResult)MC.crosshairTarget).getBlockPos(); - if(pos == null - || BlockUtils.getState(pos).getMaterial() == Material.AIR) + if(pos == null || BlockUtils.getBlock(pos) == Blocks.AIR) return; // set id diff --git a/src/main/java/net/wurstclient/hacks/SpeedNukerHack.java b/src/main/java/net/wurstclient/hacks/SpeedNukerHack.java index cee1eee7ce..b92de14a01 100644 --- a/src/main/java/net/wurstclient/hacks/SpeedNukerHack.java +++ b/src/main/java/net/wurstclient/hacks/SpeedNukerHack.java @@ -16,7 +16,6 @@ import java.util.stream.Collectors; import net.minecraft.block.Blocks; -import net.minecraft.block.Material; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; @@ -174,8 +173,7 @@ public void onLeftClick(LeftClickEvent event) // check pos BlockPos pos = ((BlockHitResult)MC.crosshairTarget).getBlockPos(); - if(pos == null - || BlockUtils.getState(pos).getMaterial() == Material.AIR) + if(pos == null || BlockUtils.getBlock(pos) == Blocks.AIR) return; // set id diff --git a/src/main/java/net/wurstclient/mixin/DisconnectedScreenMixin.java b/src/main/java/net/wurstclient/mixin/DisconnectedScreenMixin.java index 1c831acf2d..5095f35ced 100644 --- a/src/main/java/net/wurstclient/mixin/DisconnectedScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/DisconnectedScreenMixin.java @@ -7,6 +7,8 @@ */ package net.wurstclient.mixin; +import java.util.stream.Stream; + import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -17,6 +19,7 @@ import net.minecraft.client.gui.screen.DisconnectedScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; +import net.minecraft.client.gui.widget.GridWidget; import net.minecraft.text.Text; import net.wurstclient.WurstClient; import net.wurstclient.hacks.AutoReconnectHack; @@ -37,7 +40,8 @@ public class DisconnectedScreenMixin extends Screen @Final private Screen parent; @Shadow - private int reasonHeight; + @Final + private final GridWidget field_44552 = new GridWidget(); private DisconnectedScreenMixin(WurstClient wurst, Text title) { @@ -69,18 +73,19 @@ private void onInit(CallbackInfo ci) private void addReconnectButtons() { - int backButtonX = width / 2 - 100; - int backButtonY = - Math.min(height / 2 + reasonHeight / 2 + 9, height - 30); + ButtonWidget reconnectButton = field_44552.add( + ButtonWidget.builder(Text.literal("Reconnect"), + b -> LastServerRememberer.reconnect(parent)).build(), + 3, 0, 1, 1, field_44552.copyPositioner().margin(2).marginTop(-6)); - addDrawableChild(ButtonWidget - .builder(Text.literal("Reconnect"), - b -> LastServerRememberer.reconnect(parent)) - .dimensions(backButtonX, backButtonY + 24, 200, 20).build()); + autoReconnectButton = field_44552.add( + ButtonWidget.builder(Text.literal("AutoReconnect"), + b -> pressAutoReconnect()).build(), + 4, 0, 1, 1, field_44552.copyPositioner().margin(2)); - autoReconnectButton = addDrawableChild(ButtonWidget - .builder(Text.literal("AutoReconnect"), b -> pressAutoReconnect()) - .dimensions(backButtonX, backButtonY + 48, 200, 20).build()); + field_44552.refreshPositions(); + Stream.of(reconnectButton, autoReconnectButton) + .forEach(this::addDrawableChild); AutoReconnectHack autoReconnect = WurstClient.INSTANCE.getHax().autoReconnectHack; diff --git a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java index 5297484e74..187f0eeda4 100644 --- a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java @@ -55,7 +55,7 @@ private void onCreateButtons(CallbackInfo ci) .equals(I18n.translate("gui.done"))) continue; - button.method_46421(width / 2 + 2); + button.setX(width / 2 + 2); button.setWidth(150); } } diff --git a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java index 87f2248691..28488e077b 100644 --- a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java @@ -77,7 +77,7 @@ private void onTick(CallbackInfo ci) // adjust AltManager button if Realms button has been moved // happens when ModMenu is installed - altsButton.method_46419(realmsButton.getY()); + altsButton.setY(realmsButton.getY()); } /** diff --git a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java index 0ebbbc4b05..aec6fd0567 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java @@ -73,7 +73,7 @@ protected void onResize() setFocused(searchBar); searchBar.setFocused(true); - searchBar.method_46421(middleX - 100); + searchBar.setX(middleX - 100); setContentHeight(navigatorDisplayList.size() / 3 * 20); } diff --git a/src/main/java/net/wurstclient/util/LastServerRememberer.java b/src/main/java/net/wurstclient/util/LastServerRememberer.java index bc9bd7cfe6..2ac7eedef7 100644 --- a/src/main/java/net/wurstclient/util/LastServerRememberer.java +++ b/src/main/java/net/wurstclient/util/LastServerRememberer.java @@ -49,6 +49,6 @@ public static void reconnect(Screen prevScreen) return; ConnectScreen.connect(prevScreen, WurstClient.MC, - ServerAddress.parse(lastServer.address), lastServer); + ServerAddress.parse(lastServer.address), lastServer, false); } } diff --git a/src/main/java/net/wurstclient/util/RenderUtils.java b/src/main/java/net/wurstclient/util/RenderUtils.java index 06674d9715..b144bfd141 100644 --- a/src/main/java/net/wurstclient/util/RenderUtils.java +++ b/src/main/java/net/wurstclient/util/RenderUtils.java @@ -873,8 +873,8 @@ public static void drawItem(MatrixStack matrixStack, ItemStack stack, int x, else matrixStack.scale(0.75F, 0.75F, 0.75F); - ItemStack renderStack = - stack.isEmpty() ? new ItemStack(Blocks.GRASS_BLOCK) : stack; + ItemStack renderStack = stack.isEmpty() || stack.getItem() == null + ? new ItemStack(Blocks.GRASS_BLOCK) : stack; DiffuseLighting.enableGuiDepthLighting(); WurstClient.MC.getItemRenderer().renderInGuiWithOverrides(matrixStack, diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 5f63079e27..cc0b64a0f9 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -30,8 +30,8 @@ "depends": { "fabricloader": ">=0.14.19", - "fabric-api": ">=0.76.3", - "minecraft": "~1.20-alpha.23.13.ab", + "fabric-api": ">=0.77.2", + "minecraft": "~1.20-alpha.23.14.a", "java": ">=17" }, "suggests": { From 0478aa4578a613fb912c1f463795d6d08e90d7c9 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Tue, 11 Apr 2023 18:15:15 +0200 Subject: [PATCH 041/282] Add oobabooga's repetition penalties --- .../hacks/autocomplete/ModelSettings.java | 28 +++++++++++++++---- .../OobaboogaMessageCompleter.java | 4 +++ 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java b/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java index 897a50509b..39a5200c2a 100644 --- a/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java +++ b/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java @@ -47,7 +47,8 @@ public final class ModelSettings + " history.\n\n" + "Positive values encourage the model to use synonyms and" + " talk about different topics. Negative values encourage the" - + " model to repeat the same word over and over again.", + + " model to repeat the same word over and over again.\n\n" + + "Only works with OpenAI models.", 0, -2, 2, 0.01, ValueDisplay.DECIMAL); public final SliderSetting frequencyPenalty = @@ -56,12 +57,29 @@ public final class ModelSettings + " appears in the chat history.\n\n" + "Positive values encourage the model to use synonyms and" + " talk about different topics. Negative values encourage the" - + " model to repeat existing chat messages.", + + " model to repeat existing chat messages.\n\n" + + "Only works with OpenAI models.", 0.6, -2, 2, 0.01, ValueDisplay.DECIMAL); - private final List settings = - Collections.unmodifiableList(Arrays.asList(maxTokens, temperature, topP, - presencePenalty, frequencyPenalty)); + public final SliderSetting repetitionPenalty = + new SliderSetting("Repetition penalty", + "Similar to presence penalty, but uses a different algorithm.\n\n" + + "1.0 means no penalty, negative values are not possible and" + + " 1.5 is the maximum value.\n\n" + + "Only works with the oobabooga web UI.", + 1, 1, 1.5, 0.01, ValueDisplay.DECIMAL); + + public final SliderSetting encoderRepetitionPenalty = + new SliderSetting("Encoder repetition penalty", + "Similar to frequency penalty, but uses a different algorithm.\n\n" + + "1.0 means no penalty, 0.8 behaves like a negative value and" + + " 1.5 is the maximum value.\n\n" + + "Only works with the oobabooga web UI.", + 1, 0.8, 1.5, 0.01, ValueDisplay.DECIMAL); + + private final List settings = Collections.unmodifiableList( + Arrays.asList(maxTokens, temperature, topP, presencePenalty, + frequencyPenalty, repetitionPenalty, encoderRepetitionPenalty)); public void forEach(Consumer action) { diff --git a/src/main/java/net/wurstclient/hacks/autocomplete/OobaboogaMessageCompleter.java b/src/main/java/net/wurstclient/hacks/autocomplete/OobaboogaMessageCompleter.java index 03e7d4b5a8..1608cc9f19 100644 --- a/src/main/java/net/wurstclient/hacks/autocomplete/OobaboogaMessageCompleter.java +++ b/src/main/java/net/wurstclient/hacks/autocomplete/OobaboogaMessageCompleter.java @@ -33,6 +33,10 @@ protected JsonObject buildParams(String prompt) params.addProperty("max_length", modelSettings.maxTokens.getValueI()); params.addProperty("temperature", modelSettings.temperature.getValue()); params.addProperty("top_p", modelSettings.topP.getValue()); + params.addProperty("repetition_penalty", + modelSettings.repetitionPenalty.getValue()); + params.addProperty("encoder_repetition_penalty", + modelSettings.encoderRepetitionPenalty.getValue()); return params; } From 8d23f6c6b11b5f17d524d7f08983d7424d3ae264 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Tue, 11 Apr 2023 21:36:00 +0200 Subject: [PATCH 042/282] Add a setting to choose different OpenAI models --- .../hacks/autocomplete/ModelSettings.java | 50 +++++++++++++++++-- .../autocomplete/OpenAiMessageCompleter.java | 35 +++++++++++-- 2 files changed, 77 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java b/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java index 39a5200c2a..f79ce64baf 100644 --- a/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java +++ b/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java @@ -12,12 +12,55 @@ import java.util.List; import java.util.function.Consumer; +import net.wurstclient.settings.EnumSetting; import net.wurstclient.settings.Setting; import net.wurstclient.settings.SliderSetting; import net.wurstclient.settings.SliderSetting.ValueDisplay; public final class ModelSettings { + public final EnumSetting openAiModel = new EnumSetting<>( + "OpenAI model", + "The model to use for OpenAI API calls.\n\n" + + "\u00a7lText-Davinci-003\u00a7r (better known as GPT-3) is an" + + " older model that's less censored than ChatGPT, but it's also" + + " 10x more expensive to use.\n\n" + + "\u00a7lGPT-3.5-Turbo\u00a7r (better known as ChatGPT) is" + + " recommended for most use cases, as it's relatively cheap and" + + " powerful.\n\n" + + "\u00a7lGPT-4\u00a7r is more powerful, but only works if OpenAI" + + " has chosen you to be a beta tester. It can be anywhere from" + + " 15x to 60x more expensive than ChatGPT. Probably not worth it.", + OpenAiModel.values(), OpenAiModel.GPT_3_5_TURBO); + + public enum OpenAiModel + { + TEXT_DAVINCI_003("text-davinci-003", false), + GPT_3_5_TURBO("gpt-3.5-turbo", true), + GPT_4("gpt-4", true), + GPT_4_32K("gpt-4-32k", true); + + private final String name; + private final boolean chat; + + private OpenAiModel(String name, boolean chat) + { + this.name = name; + this.chat = chat; + } + + @Override + public String toString() + { + return name; + } + + public boolean isChatModel() + { + return chat; + } + } + public final SliderSetting maxTokens = new SliderSetting("Max tokens", "The maximum number of tokens that the model can generate.\n\n" + "Higher values allow the model to predict longer chat messages," @@ -77,9 +120,10 @@ public final class ModelSettings + "Only works with the oobabooga web UI.", 1, 0.8, 1.5, 0.01, ValueDisplay.DECIMAL); - private final List settings = Collections.unmodifiableList( - Arrays.asList(maxTokens, temperature, topP, presencePenalty, - frequencyPenalty, repetitionPenalty, encoderRepetitionPenalty)); + private final List settings = + Collections.unmodifiableList(Arrays.asList(openAiModel, maxTokens, + temperature, topP, presencePenalty, frequencyPenalty, + repetitionPenalty, encoderRepetitionPenalty)); public void forEach(Consumer action) { diff --git a/src/main/java/net/wurstclient/hacks/autocomplete/OpenAiMessageCompleter.java b/src/main/java/net/wurstclient/hacks/autocomplete/OpenAiMessageCompleter.java index 81178ca130..28f1dec26c 100644 --- a/src/main/java/net/wurstclient/hacks/autocomplete/OpenAiMessageCompleter.java +++ b/src/main/java/net/wurstclient/hacks/autocomplete/OpenAiMessageCompleter.java @@ -12,6 +12,7 @@ import java.net.HttpURLConnection; import java.net.URL; +import com.google.gson.JsonArray; import com.google.gson.JsonObject; import net.wurstclient.util.json.JsonException; @@ -28,10 +29,11 @@ public OpenAiMessageCompleter(ModelSettings modelSettings) @Override protected JsonObject buildParams(String prompt) { + // build the request parameters JsonObject params = new JsonObject(); - params.addProperty("prompt", prompt); params.addProperty("stop", "\n<"); - params.addProperty("model", "code-davinci-002"); + params.addProperty("model", + "" + modelSettings.openAiModel.getSelected()); params.addProperty("max_tokens", modelSettings.maxTokens.getValueI()); params.addProperty("temperature", modelSettings.temperature.getValue()); params.addProperty("top_p", modelSettings.topP.getValue()); @@ -39,6 +41,20 @@ protected JsonObject buildParams(String prompt) modelSettings.presencePenalty.getValue()); params.addProperty("frequency_penalty", modelSettings.frequencyPenalty.getValue()); + + // add the prompt, depending on the model + if(modelSettings.openAiModel.getSelected().isChatModel()) + { + JsonArray messages = new JsonArray(); + JsonObject promptMessage = new JsonObject(); + promptMessage.addProperty("role", "user"); + promptMessage.addProperty("content", prompt); + messages.add(promptMessage); + params.add("messages", messages); + + }else + params.addProperty("prompt", prompt); + return params; } @@ -46,8 +62,12 @@ protected JsonObject buildParams(String prompt) protected WsonObject requestCompletion(JsonObject parameters) throws IOException, JsonException { + // get the API URL + URL url = modelSettings.openAiModel.getSelected().isChatModel() + ? new URL("https://api.openai.com/v1/chat/completions") + : new URL("https://api.openai.com/v1/completions"); + // set up the API request - URL url = new URL("https://api.openai.com/v1/completions"); HttpURLConnection conn = (HttpURLConnection)url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); @@ -70,8 +90,13 @@ protected WsonObject requestCompletion(JsonObject parameters) protected String extractCompletion(WsonObject response) throws JsonException { // extract completion from response - String completion = - response.getArray("choices").getObject(0).getString("text"); + String completion; + if(modelSettings.openAiModel.getSelected().isChatModel()) + completion = response.getArray("choices").getObject(0) + .getObject("message").getString("content"); + else + completion = + response.getArray("choices").getObject(0).getString("text"); // remove newlines completion = completion.replace("\n", " "); From 3822722d8e8ae6d8df65fae4f3b97685b178d991 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 12 Apr 2023 01:26:00 +0200 Subject: [PATCH 043/282] Change default stop sequence to line break & add an option to change it back --- .../hacks/autocomplete/ModelSettings.java | 42 ++++++++++++++++++- .../OobaboogaMessageCompleter.java | 7 +++- .../autocomplete/OpenAiMessageCompleter.java | 3 +- 3 files changed, 48 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java b/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java index f79ce64baf..a02fe60479 100644 --- a/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java +++ b/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java @@ -120,10 +120,50 @@ public boolean isChatModel() + "Only works with the oobabooga web UI.", 1, 0.8, 1.5, 0.01, ValueDisplay.DECIMAL); + public final EnumSetting stopSequence = new EnumSetting<>( + "Stop sequence", + "Controls how AutoComplete detects the end of a chat message.\n\n" + + "\u00a7lLine Break\u00a7r is the default value and is recommended" + + " for most language models.\n\n" + + "\u00a7lNext Message\u00a7r works better with certain" + + " code-optimized language models, which have a tendency to insert" + + " line breaks in the middle of a chat message.\n\n" + + "\u00a7lNOTE:\u00a7r Due to a limitation in the oobabooga API, the" + + " stop sequence doesn't properly stop locally installed models." + + " Instead, it waits for the model to finish and then cuts off" + + " the rest of the text.", + StopSequence.values(), StopSequence.LINE_BREAK); + + public enum StopSequence + { + LINE_BREAK("Line Break", "\n"), + NEXT_MESSAGE("Next Message", "\n<"); + + private final String name; + private final String sequence; + + private StopSequence(String name, String sequence) + { + this.name = name; + this.sequence = sequence; + } + + public String getSequence() + { + return sequence; + } + + @Override + public String toString() + { + return name; + } + } + private final List settings = Collections.unmodifiableList(Arrays.asList(openAiModel, maxTokens, temperature, topP, presencePenalty, frequencyPenalty, - repetitionPenalty, encoderRepetitionPenalty)); + repetitionPenalty, encoderRepetitionPenalty, stopSequence)); public void forEach(Consumer action) { diff --git a/src/main/java/net/wurstclient/hacks/autocomplete/OobaboogaMessageCompleter.java b/src/main/java/net/wurstclient/hacks/autocomplete/OobaboogaMessageCompleter.java index 1608cc9f19..e871a73c04 100644 --- a/src/main/java/net/wurstclient/hacks/autocomplete/OobaboogaMessageCompleter.java +++ b/src/main/java/net/wurstclient/hacks/autocomplete/OobaboogaMessageCompleter.java @@ -74,8 +74,11 @@ protected String extractCompletion(WsonObject response) throws JsonException completion = completion.substring(1); // remove the next message - if(completion.contains("\n<")) - completion = completion.substring(0, completion.indexOf("\n<")); + String stopSequence = + modelSettings.stopSequence.getSelected().getSequence(); + if(completion.contains(stopSequence)) + completion = + completion.substring(0, completion.indexOf(stopSequence)); // remove newlines completion = completion.replace("\n", " "); diff --git a/src/main/java/net/wurstclient/hacks/autocomplete/OpenAiMessageCompleter.java b/src/main/java/net/wurstclient/hacks/autocomplete/OpenAiMessageCompleter.java index 28f1dec26c..30aadd874c 100644 --- a/src/main/java/net/wurstclient/hacks/autocomplete/OpenAiMessageCompleter.java +++ b/src/main/java/net/wurstclient/hacks/autocomplete/OpenAiMessageCompleter.java @@ -31,7 +31,8 @@ protected JsonObject buildParams(String prompt) { // build the request parameters JsonObject params = new JsonObject(); - params.addProperty("stop", "\n<"); + params.addProperty("stop", + modelSettings.stopSequence.getSelected().getSequence()); params.addProperty("model", "" + modelSettings.openAiModel.getSelected()); params.addProperty("max_tokens", modelSettings.maxTokens.getValueI()); From 12ce7086eda817990c1f0d4a885b0997524111a7 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sat, 15 Apr 2023 02:14:00 +0200 Subject: [PATCH 044/282] Prevent windows from going completely out of bounds This change doesn't prevent you from moving windows slightly out of bounds, as long as at least one pixel of the title bar is still on the screen. That way, you can always grab the title bar and use it to drag the window somewhere else. Also, I've made sure that temporarily resizing the window or changing the GUI scale doesn't ruin your ClickGUI layout. The windows only move permanently to their new position if you drag them around, otherwise they move back to their original position once the window is big enough again. --- .../net/wurstclient/clickgui/ClickGui.java | 4 +- .../java/net/wurstclient/clickgui/Window.java | 48 ++++++++++++++++++- 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/wurstclient/clickgui/ClickGui.java b/src/main/java/net/wurstclient/clickgui/ClickGui.java index 0b8dff24e9..ca5c82bcc2 100644 --- a/src/main/java/net/wurstclient/clickgui/ClickGui.java +++ b/src/main/java/net/wurstclient/clickgui/ClickGui.java @@ -179,8 +179,8 @@ private void saveWindows() continue; JsonObject jsonWindow = new JsonObject(); - jsonWindow.addProperty("x", window.getX()); - jsonWindow.addProperty("y", window.getY()); + jsonWindow.addProperty("x", window.getActualX()); + jsonWindow.addProperty("y", window.getActualY()); jsonWindow.addProperty("minimized", window.isMinimized()); jsonWindow.addProperty("pinned", window.isPinned()); json.add(window.getTitle(), jsonWindow); diff --git a/src/main/java/net/wurstclient/clickgui/Window.java b/src/main/java/net/wurstclient/clickgui/Window.java index b05d0a3679..99f499ee33 100644 --- a/src/main/java/net/wurstclient/clickgui/Window.java +++ b/src/main/java/net/wurstclient/clickgui/Window.java @@ -62,7 +62,29 @@ public final void setTitle(String title) this.title = title; } + /** + * Returns the X position of the window, adjusted to fit inside the screen. + */ public final int getX() + { + // prevent window from going off the right side of the screen + net.minecraft.client.util.Window mcWindow = WurstClient.MC.getWindow(); + if(x > mcWindow.getScaledWidth() - 1) + return mcWindow.getScaledWidth() - 1; + + // prevent window from going off the left side of the screen + if(x <= -width) + return -width + 1; + + return x; + } + + /** + * Returns the actual X position of the window, without any adjustments. + * This should only be used for saving the window's position to the config + * file. + */ + public final int getActualX() { return x; } @@ -72,7 +94,29 @@ public final void setX(int x) this.x = x; } + /** + * Returns the Y position of the window, adjusted to fit inside the screen. + */ public final int getY() + { + // prevent window from going off the bottom of the screen + net.minecraft.client.util.Window mcWindow = WurstClient.MC.getWindow(); + if(y > mcWindow.getScaledHeight() - 1) + return mcWindow.getScaledHeight() - 1; + + // prevent window from going off the top of the screen + if(y <= -12) + return -12; + + return y; + } + + /** + * Returns the actual Y position of the window, without any adjustments. + * This should only be used for saving the window's position to the config + * file. + */ + public final int getActualY() { return y; } @@ -226,8 +270,8 @@ public final boolean isDragging() public final void startDragging(int mouseX, int mouseY) { dragging = true; - dragOffsetX = x - mouseX; - dragOffsetY = y - mouseY; + dragOffsetX = getX() - mouseX; + dragOffsetY = getY() - mouseY; } public final void dragTo(int mouseX, int mouseY) From 34617d70e51ab136ca604c7bfe9f4892c041a9d1 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Fri, 21 Apr 2023 12:44:30 +0200 Subject: [PATCH 045/282] [Wurst-Bot] Update to 23w16a --- gradle.properties | 8 ++++---- src/main/java/net/wurstclient/WurstClient.java | 2 +- src/main/java/net/wurstclient/mixin/StatsScreenMixin.java | 2 +- src/main/java/net/wurstclient/mixin/TitleScreenMixin.java | 2 +- .../net/wurstclient/navigator/NavigatorMainScreen.java | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gradle.properties b/gradle.properties index 27b4962ac7..b42ee0bfd7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,15 +4,15 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these at https://fabricmc.net/develop/ and # https://www.curseforge.com/minecraft/mc-mods/fabric-api -minecraft_version=23w14a -yarn_mappings=23w14a+build.2 +minecraft_version=23w16a +yarn_mappings=23w16a+build.4 loader_version=0.14.19 #Fabric api -fabric_version=0.77.2+1.20 +fabric_version=0.78.1+1.20 # Mod Properties -mod_version = v7.32-MC23w14a +mod_version = v7.32-MC23w16a maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index 2eab5632bb..4ab279e375 100644 --- a/src/main/java/net/wurstclient/WurstClient.java +++ b/src/main/java/net/wurstclient/WurstClient.java @@ -57,7 +57,7 @@ public enum WurstClient public static IMinecraftClient IMC; public static final String VERSION = "7.32"; - public static final String MC_VERSION = "23w14a"; + public static final String MC_VERSION = "23w16a"; private WurstAnalytics analytics; private EventManager eventManager; diff --git a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java index 187f0eeda4..5297484e74 100644 --- a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java @@ -55,7 +55,7 @@ private void onCreateButtons(CallbackInfo ci) .equals(I18n.translate("gui.done"))) continue; - button.setX(width / 2 + 2); + button.method_46421(width / 2 + 2); button.setWidth(150); } } diff --git a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java index 28488e077b..87f2248691 100644 --- a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java @@ -77,7 +77,7 @@ private void onTick(CallbackInfo ci) // adjust AltManager button if Realms button has been moved // happens when ModMenu is installed - altsButton.setY(realmsButton.getY()); + altsButton.method_46419(realmsButton.getY()); } /** diff --git a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java index aec6fd0567..0ebbbc4b05 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java @@ -73,7 +73,7 @@ protected void onResize() setFocused(searchBar); searchBar.setFocused(true); - searchBar.setX(middleX - 100); + searchBar.method_46421(middleX - 100); setContentHeight(navigatorDisplayList.size() / 3 * 20); } From 69c1cc3a1468be45b4a617c049cd806d9fa92b4f Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sat, 22 Apr 2023 00:13:11 +0200 Subject: [PATCH 046/282] Fix 23w16a breaking all kinds of things --- .../java/net/wurstclient/ai/PathFinder.java | 11 +-- .../wurstclient/altmanager/AltRenderer.java | 93 +++++++++++++------ .../altmanager/screens/AltEditorScreen.java | 30 +++--- .../altmanager/screens/AltManagerScreen.java | 54 ++++++----- .../net/wurstclient/clickgui/ClickGui.java | 34 ++++--- .../wurstclient/clickgui/ComboBoxPopup.java | 11 ++- .../net/wurstclient/clickgui/Component.java | 4 +- .../java/net/wurstclient/clickgui/Popup.java | 5 +- .../components/AbstractListEditButton.java | 10 +- .../clickgui/components/BlockComponent.java | 10 +- .../components/CheckboxComponent.java | 10 +- .../clickgui/components/ColorComponent.java | 13 +-- .../components/ComboBoxComponent.java | 13 +-- .../clickgui/components/FeatureButton.java | 10 +- .../clickgui/components/FileComponent.java | 14 +-- .../clickgui/components/RadarComponent.java | 4 +- .../clickgui/components/SliderComponent.java | 15 +-- .../clickgui/screens/AddBookOfferScreen.java | 36 +++---- .../clickgui/screens/ClickGuiScreen.java | 8 +- .../clickgui/screens/EditBlockListScreen.java | 51 +++++----- .../clickgui/screens/EditBlockScreen.java | 36 +++---- .../clickgui/screens/EditBookOfferScreen.java | 32 ++++--- .../screens/EditBookOffersScreen.java | 24 +++-- .../clickgui/screens/EditColorScreen.java | 43 ++++----- .../clickgui/screens/EditItemListScreen.java | 51 +++++----- .../clickgui/screens/EditSliderScreen.java | 14 +-- .../clickgui/screens/SelectFileScreen.java | 25 ++--- .../net/wurstclient/commands/TacoCmd.java | 6 +- .../wurstclient/events/GUIRenderListener.java | 12 +-- .../net/wurstclient/hacks/AnchorAuraHack.java | 4 +- .../net/wurstclient/hacks/AutoBuildHack.java | 8 +- .../net/wurstclient/hacks/AutoFarmHack.java | 3 +- .../net/wurstclient/hacks/BowAimbotHack.java | 6 +- .../wurstclient/hacks/BuildRandomHack.java | 2 +- .../wurstclient/hacks/CrystalAuraHack.java | 4 +- .../net/wurstclient/hacks/ExcavatorHack.java | 6 +- .../wurstclient/hacks/InstantBunkerHack.java | 2 +- .../net/wurstclient/hacks/InvWalkHack.java | 3 +- .../wurstclient/hacks/MobSpawnEspHack.java | 3 +- .../wurstclient/hacks/ScaffoldWalkHack.java | 2 +- .../net/wurstclient/hacks/TunnellerHack.java | 4 +- .../java/net/wurstclient/hud/HackListHUD.java | 31 ++++--- .../java/net/wurstclient/hud/IngameHUD.java | 12 +-- src/main/java/net/wurstclient/hud/TabGui.java | 12 ++- .../java/net/wurstclient/hud/WurstLogo.java | 8 +- .../net/wurstclient/mixin/ChatHudMixin.java | 3 +- .../mixin/DisconnectedScreenMixin.java | 12 +-- .../mixin/GameMenuScreenMixin.java | 14 ++- .../net/wurstclient/mixin/IngameHudMixin.java | 19 ++-- .../net/wurstclient/mixin/ScreenMixin.java | 9 +- .../wurstclient/mixin/StatsScreenMixin.java | 2 +- .../wurstclient/mixin/TitleScreenMixin.java | 2 +- .../navigator/NavigatorFeatureScreen.java | 24 ++--- .../navigator/NavigatorMainScreen.java | 31 ++++--- .../navigator/NavigatorNewKeybindScreen.java | 19 ++-- .../NavigatorRemoveKeybindScreen.java | 19 ++-- .../navigator/NavigatorScreen.java | 9 +- .../ForcedChatReportsScreen.java | 13 ++- .../nochatreports/NcrModRequiredScreen.java | 13 ++- .../options/EnterProfileNameScreen.java | 12 +-- .../options/KeybindEditorScreen.java | 18 ++-- .../options/KeybindManagerScreen.java | 25 ++--- .../options/KeybindProfilesScreen.java | 28 +++--- .../wurstclient/options/PressAKeyScreen.java | 10 +- .../options/WurstOptionsScreen.java | 30 +++--- .../options/ZoomManagerScreen.java | 12 +-- .../serverfinder/CleanUpScreen.java | 20 ++-- .../serverfinder/ServerFinderScreen.java | 30 +++--- .../net/wurstclient/util/BlockPlacer.java | 4 +- .../java/net/wurstclient/util/ListWidget.java | 19 ++-- .../net/wurstclient/util/RenderUtils.java | 15 +-- src/main/resources/fabric.mod.json | 4 +- 72 files changed, 651 insertions(+), 554 deletions(-) diff --git a/src/main/java/net/wurstclient/ai/PathFinder.java b/src/main/java/net/wurstclient/ai/PathFinder.java index a4799a28d6..0e8b9db50a 100644 --- a/src/main/java/net/wurstclient/ai/PathFinder.java +++ b/src/main/java/net/wurstclient/ai/PathFinder.java @@ -277,14 +277,13 @@ protected boolean isMineable(BlockPos pos) return false; } + @SuppressWarnings("deprecation") protected boolean canBeSolid(BlockPos pos) { BlockState state = BlockUtils.getState(pos); - Material material = state.getMaterial(); Block block = state.getBlock(); - return material.blocksMovement() - && !(block instanceof AbstractSignBlock) + return state.method_51366() && !(block instanceof AbstractSignBlock) || block instanceof LadderBlock || jesus && (block == Blocks.WATER || block == Blocks.LAVA); } @@ -299,9 +298,9 @@ private boolean canGoThrough(BlockPos pos) return false; // check if solid - Material material = BlockUtils.getState(pos).getMaterial(); - Block block = BlockUtils.getBlock(pos); - if(material.blocksMovement() && !(block instanceof AbstractSignBlock)) + BlockState state = BlockUtils.getState(pos); + Block block = state.getBlock(); + if(state.method_51366() && !(block instanceof AbstractSignBlock)) return false; // check if trapped diff --git a/src/main/java/net/wurstclient/altmanager/AltRenderer.java b/src/main/java/net/wurstclient/altmanager/AltRenderer.java index a479d38f89..a263de58d9 100644 --- a/src/main/java/net/wurstclient/altmanager/AltRenderer.java +++ b/src/main/java/net/wurstclient/altmanager/AltRenderer.java @@ -10,6 +10,7 @@ import java.util.HashMap; import java.util.UUID; +import org.joml.Matrix4f; import org.lwjgl.opengl.GL11; import com.mojang.authlib.GameProfile; @@ -17,6 +18,12 @@ import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.network.PlayerListEntry; +import net.minecraft.client.render.BufferBuilder; +import net.minecraft.client.render.BufferRenderer; +import net.minecraft.client.render.GameRenderer; +import net.minecraft.client.render.Tessellator; +import net.minecraft.client.render.VertexFormat; +import net.minecraft.client.render.VertexFormats; import net.minecraft.client.util.DefaultSkinHelper; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.Identifier; @@ -46,7 +53,35 @@ private static void bindSkinTexture(String name) RenderSystem.setShaderTexture(0, loadedSkins.get(name)); } - public static void drawAltFace(MatrixStack matrixStack, String name, int x, + private static void drawTexture(DrawableHelper helper, int x, int y, + float u, float v, int w, int h, int fw, int fh) + { + int x2 = x + w; + int y2 = y + h; + int z = 0; + float uOverFw = u / fw; + float uPlusWOverFw = (u + w) / fw; + float vOverFh = v / fh; + float vPlusHOverFh = (v + h) / fh; + + RenderSystem.setShader(GameRenderer::getPositionTexProgram); + MatrixStack matrixStack = helper.method_51448(); + Matrix4f matrix4f = matrixStack.peek().getPositionMatrix(); + BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer(); + bufferBuilder.begin(VertexFormat.DrawMode.QUADS, + VertexFormats.POSITION_TEXTURE); + bufferBuilder.vertex(matrix4f, x, y, z).texture(uOverFw, vOverFh) + .next(); + bufferBuilder.vertex(matrix4f, x, y2, z).texture(uOverFw, vPlusHOverFh) + .next(); + bufferBuilder.vertex(matrix4f, x2, y2, z) + .texture(uPlusWOverFw, vPlusHOverFh).next(); + bufferBuilder.vertex(matrix4f, x2, y, z).texture(uPlusWOverFw, vOverFh) + .next(); + BufferRenderer.drawWithGlobalProgram(bufferBuilder.end()); + } + + public static void drawAltFace(DrawableHelper helper, String name, int x, int y, int w, int h, boolean selected) { try @@ -64,14 +99,14 @@ public static void drawAltFace(MatrixStack matrixStack, String name, int x, int fh = 192; float u = 24; float v = 24; - DrawableHelper.drawTexture(matrixStack, x, y, u, v, w, h, fw, fh); + drawTexture(helper, x, y, u, v, w, h, fw, fh); // Hat fw = 192; fh = 192; u = 120; v = 24; - DrawableHelper.drawTexture(matrixStack, x, y, u, v, w, h, fw, fh); + drawTexture(helper, x, y, u, v, w, h, fw, fh); GL11.glDisable(GL11.GL_BLEND); @@ -81,7 +116,7 @@ public static void drawAltFace(MatrixStack matrixStack, String name, int x, } } - public static void drawAltBody(MatrixStack matrixStack, String name, int x, + public static void drawAltBody(DrawableHelper helper, String name, int x, int y, int width, int height) { try @@ -103,7 +138,7 @@ public static void drawAltBody(MatrixStack matrixStack, String name, int x, int fh = height * 2; float u = height / 4; float v = height / 4; - DrawableHelper.drawTexture(matrixStack, x, y, u, v, w, h, fw, fh); + drawTexture(helper, x, y, u, v, w, h, fw, fh); // Hat x = x + 0; @@ -112,7 +147,7 @@ public static void drawAltBody(MatrixStack matrixStack, String name, int x, h = height / 4; u = height / 4 * 5; v = height / 4; - DrawableHelper.drawTexture(matrixStack, x, y, u, v, w, h, fw, fh); + drawTexture(helper, x, y, u, v, w, h, fw, fh); // Chest x = x + 0; @@ -121,7 +156,7 @@ public static void drawAltBody(MatrixStack matrixStack, String name, int x, h = height / 8 * 3; u = height / 4 * 2.5F; v = height / 4 * 2.5F; - DrawableHelper.drawTexture(matrixStack, x, y, u, v, w, h, fw, fh); + drawTexture(helper, x, y, u, v, w, h, fw, fh); // Jacket x = x + 0; @@ -130,7 +165,7 @@ public static void drawAltBody(MatrixStack matrixStack, String name, int x, h = height / 8 * 3; u = height / 4 * 2.5F; v = height / 4 * 4.5F; - DrawableHelper.drawTexture(matrixStack, x, y, u, v, w, h, fw, fh); + drawTexture(helper, x, y, u, v, w, h, fw, fh); // Left Arm x = x - width / 16 * (slim ? 3 : 4); @@ -139,7 +174,7 @@ public static void drawAltBody(MatrixStack matrixStack, String name, int x, h = height / 8 * 3; u = height / 4 * 5.5F; v = height / 4 * 2.5F; - DrawableHelper.drawTexture(matrixStack, x, y, u, v, w, h, fw, fh); + drawTexture(helper, x, y, u, v, w, h, fw, fh); // Left Sleeve x = x + 0; @@ -148,7 +183,7 @@ public static void drawAltBody(MatrixStack matrixStack, String name, int x, h = height / 8 * 3; u = height / 4 * 5.5F; v = height / 4 * 4.5F; - DrawableHelper.drawTexture(matrixStack, x, y, u, v, w, h, fw, fh); + drawTexture(helper, x, y, u, v, w, h, fw, fh); // Right Arm x = x + width / 16 * (slim ? 11 : 12); @@ -157,7 +192,7 @@ public static void drawAltBody(MatrixStack matrixStack, String name, int x, h = height / 8 * 3; u = height / 4 * 5.5F; v = height / 4 * 2.5F; - DrawableHelper.drawTexture(matrixStack, x, y, u, v, w, h, fw, fh); + drawTexture(helper, x, y, u, v, w, h, fw, fh); // Right Sleeve x = x + 0; @@ -166,7 +201,7 @@ public static void drawAltBody(MatrixStack matrixStack, String name, int x, h = height / 8 * 3; u = height / 4 * 5.5F; v = height / 4 * 4.5F; - DrawableHelper.drawTexture(matrixStack, x, y, u, v, w, h, fw, fh); + drawTexture(helper, x, y, u, v, w, h, fw, fh); // Left Leg x = x - width / 2; @@ -175,7 +210,7 @@ public static void drawAltBody(MatrixStack matrixStack, String name, int x, h = height / 8 * 3; u = height / 4 * 0.5F; v = height / 4 * 2.5F; - DrawableHelper.drawTexture(matrixStack, x, y, u, v, w, h, fw, fh); + drawTexture(helper, x, y, u, v, w, h, fw, fh); // Left Pants x = x + 0; @@ -184,7 +219,7 @@ public static void drawAltBody(MatrixStack matrixStack, String name, int x, h = height / 8 * 3; u = height / 4 * 0.5F; v = height / 4 * 4.5F; - DrawableHelper.drawTexture(matrixStack, x, y, u, v, w, h, fw, fh); + drawTexture(helper, x, y, u, v, w, h, fw, fh); // Right Leg x = x + width / 4; @@ -193,7 +228,7 @@ public static void drawAltBody(MatrixStack matrixStack, String name, int x, h = height / 8 * 3; u = height / 4 * 0.5F; v = height / 4 * 2.5F; - DrawableHelper.drawTexture(matrixStack, x, y, u, v, w, h, fw, fh); + drawTexture(helper, x, y, u, v, w, h, fw, fh); // Right Pants x = x + 0; @@ -202,7 +237,7 @@ public static void drawAltBody(MatrixStack matrixStack, String name, int x, h = height / 8 * 3; u = height / 4 * 0.5F; v = height / 4 * 4.5F; - DrawableHelper.drawTexture(matrixStack, x, y, u, v, w, h, fw, fh); + drawTexture(helper, x, y, u, v, w, h, fw, fh); GL11.glDisable(GL11.GL_BLEND); @@ -212,7 +247,7 @@ public static void drawAltBody(MatrixStack matrixStack, String name, int x, } } - public static void drawAltBack(MatrixStack matrixStack, String name, int x, + public static void drawAltBack(DrawableHelper helper, String name, int x, int y, int width, int height) { try @@ -234,7 +269,7 @@ public static void drawAltBack(MatrixStack matrixStack, String name, int x, int fh = height * 2; float u = height / 4 * 3; float v = height / 4; - DrawableHelper.drawTexture(matrixStack, x, y, u, v, w, h, fw, fh); + drawTexture(helper, x, y, u, v, w, h, fw, fh); // Hat x = x + 0; @@ -243,7 +278,7 @@ public static void drawAltBack(MatrixStack matrixStack, String name, int x, h = height / 4; u = height / 4 * 7; v = height / 4; - DrawableHelper.drawTexture(matrixStack, x, y, u, v, w, h, fw, fh); + drawTexture(helper, x, y, u, v, w, h, fw, fh); // Chest x = x + 0; @@ -252,7 +287,7 @@ public static void drawAltBack(MatrixStack matrixStack, String name, int x, h = height / 8 * 3; u = height / 4 * 4; v = height / 4 * 2.5F; - DrawableHelper.drawTexture(matrixStack, x, y, u, v, w, h, fw, fh); + drawTexture(helper, x, y, u, v, w, h, fw, fh); // Jacket x = x + 0; @@ -261,7 +296,7 @@ public static void drawAltBack(MatrixStack matrixStack, String name, int x, h = height / 8 * 3; u = height / 4 * 4; v = height / 4 * 4.5F; - DrawableHelper.drawTexture(matrixStack, x, y, u, v, w, h, fw, fh); + drawTexture(helper, x, y, u, v, w, h, fw, fh); // Left Arm x = x - width / 16 * (slim ? 3 : 4); @@ -270,7 +305,7 @@ public static void drawAltBack(MatrixStack matrixStack, String name, int x, h = height / 8 * 3; u = height / 4 * (slim ? 6.375F : 6.5F); v = height / 4 * 2.5F; - DrawableHelper.drawTexture(matrixStack, x, y, u, v, w, h, fw, fh); + drawTexture(helper, x, y, u, v, w, h, fw, fh); // Left Sleeve x = x + 0; @@ -279,7 +314,7 @@ public static void drawAltBack(MatrixStack matrixStack, String name, int x, h = height / 8 * 3; u = height / 4 * (slim ? 6.375F : 6.5F); v = height / 4 * 4.5F; - DrawableHelper.drawTexture(matrixStack, x, y, u, v, w, h, fw, fh); + drawTexture(helper, x, y, u, v, w, h, fw, fh); // Right Arm x = x + width / 16 * (slim ? 11 : 12); @@ -288,7 +323,7 @@ public static void drawAltBack(MatrixStack matrixStack, String name, int x, h = height / 8 * 3; u = height / 4 * (slim ? 6.375F : 6.5F); v = height / 4 * 2.5F; - DrawableHelper.drawTexture(matrixStack, x, y, u, v, w, h, fw, fh); + drawTexture(helper, x, y, u, v, w, h, fw, fh); // Right Sleeve x = x + 0; @@ -297,7 +332,7 @@ public static void drawAltBack(MatrixStack matrixStack, String name, int x, h = height / 8 * 3; u = height / 4 * (slim ? 6.375F : 6.5F); v = height / 4 * 4.5F; - DrawableHelper.drawTexture(matrixStack, x, y, u, v, w, h, fw, fh); + drawTexture(helper, x, y, u, v, w, h, fw, fh); // Left Leg x = x - width / 2; @@ -306,7 +341,7 @@ public static void drawAltBack(MatrixStack matrixStack, String name, int x, h = height / 8 * 3; u = height / 4 * 1.5F; v = height / 4 * 2.5F; - DrawableHelper.drawTexture(matrixStack, x, y, u, v, w, h, fw, fh); + drawTexture(helper, x, y, u, v, w, h, fw, fh); // Left Pants x = x + 0; @@ -315,7 +350,7 @@ public static void drawAltBack(MatrixStack matrixStack, String name, int x, h = height / 8 * 3; u = height / 4 * 1.5F; v = height / 4 * 4.5F; - DrawableHelper.drawTexture(matrixStack, x, y, u, v, w, h, fw, fh); + drawTexture(helper, x, y, u, v, w, h, fw, fh); // Right Leg x = x + width / 4; @@ -324,7 +359,7 @@ public static void drawAltBack(MatrixStack matrixStack, String name, int x, h = height / 8 * 3; u = height / 4 * 1.5F; v = height / 4 * 2.5F; - DrawableHelper.drawTexture(matrixStack, x, y, u, v, w, h, fw, fh); + drawTexture(helper, x, y, u, v, w, h, fw, fh); // Right Pants x = x + 0; @@ -333,7 +368,7 @@ public static void drawAltBack(MatrixStack matrixStack, String name, int x, h = height / 8 * 3; u = height / 4 * 1.5F; v = height / 4 * 4.5F; - DrawableHelper.drawTexture(matrixStack, x, y, u, v, w, h, fw, fh); + drawTexture(helper, x, y, u, v, w, h, fw, fh); GL11.glDisable(GL11.GL_BLEND); diff --git a/src/main/java/net/wurstclient/altmanager/screens/AltEditorScreen.java b/src/main/java/net/wurstclient/altmanager/screens/AltEditorScreen.java index ac539966f0..474b95cd59 100644 --- a/src/main/java/net/wurstclient/altmanager/screens/AltEditorScreen.java +++ b/src/main/java/net/wurstclient/altmanager/screens/AltEditorScreen.java @@ -28,6 +28,7 @@ import com.google.gson.JsonObject; import com.mojang.blaze3d.systems.RenderSystem; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -342,39 +343,40 @@ public boolean mouseClicked(double x, double y, int button) } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { - renderBackground(matrixStack); + renderBackground(helper); + MatrixStack matrixStack = helper.method_51448(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); RenderSystem.setShader(GameRenderer::getPositionProgram); // skin preview - AltRenderer.drawAltBack(matrixStack, nameOrEmailBox.getText(), + AltRenderer.drawAltBack(helper, nameOrEmailBox.getText(), (width / 2 - 100) / 2 - 64, height / 2 - 128, 128, 256); - AltRenderer.drawAltBody(matrixStack, nameOrEmailBox.getText(), + AltRenderer.drawAltBody(helper, nameOrEmailBox.getText(), width - (width / 2 - 100) / 2 - 64, height / 2 - 128, 128, 256); // text - drawTextWithShadow(matrixStack, textRenderer, - "Name (for cracked alts), or", width / 2 - 100, 37, 10526880); - drawTextWithShadow(matrixStack, textRenderer, - "E-Mail (for premium alts)", width / 2 - 100, 47, 10526880); - drawTextWithShadow(matrixStack, textRenderer, + helper.drawTextWithShadow(textRenderer, "Name (for cracked alts), or", + width / 2 - 100, 37, 10526880); + helper.drawTextWithShadow(textRenderer, "E-Mail (for premium alts)", + width / 2 - 100, 47, 10526880); + helper.drawTextWithShadow(textRenderer, "Password (leave blank for cracked alts)", width / 2 - 100, 87, 10526880); String[] lines = message.split("\n"); for(int i = 0; i < lines.length; i++) - drawCenteredTextWithShadow(matrixStack, textRenderer, lines[i], - width / 2, 142 + 10 * i, 16777215); + helper.drawCenteredTextWithShadow(textRenderer, lines[i], width / 2, + 142 + 10 * i, 16777215); // text boxes - nameOrEmailBox.render(matrixStack, mouseX, mouseY, partialTicks); - passwordBox.render(matrixStack, mouseX, mouseY, partialTicks); + nameOrEmailBox.render(helper, mouseX, mouseY, partialTicks); + passwordBox.render(helper, mouseX, mouseY, partialTicks); // red flash for errors if(errorTimer > 0) @@ -397,7 +399,7 @@ public void render(MatrixStack matrixStack, int mouseX, int mouseY, errorTimer--; } - super.render(matrixStack, mouseX, mouseY, partialTicks); + super.render(helper, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/altmanager/screens/AltManagerScreen.java b/src/main/java/net/wurstclient/altmanager/screens/AltManagerScreen.java index c70b08aeac..2a36f541b0 100644 --- a/src/main/java/net/wurstclient/altmanager/screens/AltManagerScreen.java +++ b/src/main/java/net/wurstclient/altmanager/screens/AltManagerScreen.java @@ -30,6 +30,7 @@ import it.unimi.dsi.fastutil.booleans.BooleanConsumer; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.Drawable; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.ConfirmScreen; import net.minecraft.client.gui.screen.NoticeScreen; import net.minecraft.client.gui.screen.Screen; @@ -408,12 +409,13 @@ private void confirmRemove(boolean confirmed) } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { - renderBackground(matrixStack); - listGui.render(matrixStack, mouseX, mouseY, partialTicks); + renderBackground(helper); + listGui.render(helper, mouseX, mouseY, partialTicks); + MatrixStack matrixStack = helper.method_51448(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); @@ -427,20 +429,20 @@ public void render(MatrixStack matrixStack, int mouseX, int mouseY, if(alt == null) return; - AltRenderer.drawAltBack(matrixStack, alt.getName(), + AltRenderer.drawAltBack(helper, alt.getName(), (width / 2 - 125) / 2 - 32, height / 2 - 64 - 9, 64, 128); - AltRenderer.drawAltBody(matrixStack, alt.getName(), + AltRenderer.drawAltBody(helper, alt.getName(), width - (width / 2 - 140) / 2 - 32, height / 2 - 64 - 9, 64, 128); } // title text - drawCenteredTextWithShadow(matrixStack, textRenderer, "Alt Manager", + helper.drawCenteredTextWithShadow(textRenderer, "Alt Manager", width / 2, 4, 16777215); - drawCenteredTextWithShadow(matrixStack, textRenderer, + helper.drawCenteredTextWithShadow(textRenderer, "Alts: " + altManager.getList().size(), width / 2, 14, 10526880); - drawCenteredTextWithShadow( - matrixStack, textRenderer, "premium: " + altManager.getNumPremium() + helper.drawCenteredTextWithShadow( + textRenderer, "premium: " + altManager.getNumPremium() + ", cracked: " + altManager.getNumCracked(), width / 2, 24, 10526880); @@ -466,13 +468,12 @@ public void render(MatrixStack matrixStack, int mouseX, int mouseY, errorTimer--; } - super.render(matrixStack, mouseX, mouseY, partialTicks); - renderButtonTooltip(matrixStack, mouseX, mouseY); - renderAltTooltip(matrixStack, mouseX, mouseY); + super.render(helper, mouseX, mouseY, partialTicks); + renderButtonTooltip(helper, mouseX, mouseY); + renderAltTooltip(helper, mouseX, mouseY); } - private void renderAltTooltip(MatrixStack matrixStack, int mouseX, - int mouseY) + private void renderAltTooltip(DrawableHelper helper, int mouseX, int mouseY) { if(!listGui.isMouseInList(mouseX, mouseY)) return; @@ -514,10 +515,10 @@ private void renderAltTooltip(MatrixStack matrixStack, int mouseX, if(alt.isFavorite()) addTooltip(tooltip, "favorite"); - renderTooltip(matrixStack, tooltip, mouseX, mouseY); + helper.method_51434(textRenderer, tooltip, mouseX, mouseY); } - private void renderButtonTooltip(MatrixStack matrixStack, int mouseX, + private void renderButtonTooltip(DrawableHelper helper, int mouseX, int mouseY) { for(Drawable d : ((IScreen)(Object)this).getButtons()) @@ -541,7 +542,7 @@ private void renderButtonTooltip(MatrixStack matrixStack, int mouseX, else addTooltip(tooltip, "window_freeze"); - renderTooltip(matrixStack, tooltip, mouseX, mouseY); + helper.method_51434(textRenderer, tooltip, mouseX, mouseY); break; } } @@ -636,11 +637,12 @@ protected void renderBackground() } @Override - protected void renderItem(MatrixStack matrixStack, int id, int x, int y, + protected void renderItem(DrawableHelper helper, int id, int x, int y, int var4, int var5, int var6, float partialTicks) { Alt alt = list.get(id); + MatrixStack matrixStack = helper.method_51448(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); @@ -671,16 +673,20 @@ protected void renderItem(MatrixStack matrixStack, int id, int x, int y, } // face - AltRenderer.drawAltFace(matrixStack, alt.getName(), x + 1, y + 1, - 24, 24, isSelectedItem(id)); + AltRenderer.drawAltFace(helper, alt.getName(), x + 1, y + 1, 24, 24, + isSelectedItem(id)); // name / email - client.textRenderer.draw(matrixStack, - "Name: " + alt.getDisplayName(), x + 31, y + 3, 10526880); + helper.method_51433(client.textRenderer, + "Name: " + alt.getDisplayName(), x + 31, y + 3, 10526880, + false); + helper.method_51433(client.textRenderer, + "Name: " + alt.getDisplayName(), x + 31, y + 3, 10526880, + false); String bottomText = getBottomText(alt); - client.textRenderer.draw(matrixStack, bottomText, x + 31, y + 15, - 10526880); + helper.method_51433(client.textRenderer, bottomText, x + 31, y + 15, + 10526880, false); } public String getBottomText(Alt alt) diff --git a/src/main/java/net/wurstclient/clickgui/ClickGui.java b/src/main/java/net/wurstclient/clickgui/ClickGui.java index 0b8dff24e9..75b5eb795d 100644 --- a/src/main/java/net/wurstclient/clickgui/ClickGui.java +++ b/src/main/java/net/wurstclient/clickgui/ClickGui.java @@ -28,6 +28,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.render.Tessellator; @@ -459,7 +460,7 @@ private void handleComponentMouseClick(Window window, double mouseX, } } - public void render(MatrixStack matrixStack, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { updateColors(); @@ -493,18 +494,19 @@ public void render(MatrixStack matrixStack, int mouseX, int mouseY, else window.stopDraggingScrollbar(); - renderWindow(matrixStack, window, mouseX, mouseY, partialTicks); + renderWindow(helper, window, mouseX, mouseY, partialTicks); } - renderPopups(matrixStack, mouseX, mouseY); - renderTooltip(matrixStack, mouseX, mouseY); + renderPopups(helper, mouseX, mouseY); + renderTooltip(helper, mouseX, mouseY); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); } - public void renderPopups(MatrixStack matrixStack, int mouseX, int mouseY) + public void renderPopups(DrawableHelper helper, int mouseX, int mouseY) { + MatrixStack matrixStack = helper.method_51448(); for(Popup popup : popups) { Component owner = popup.getOwner(); @@ -519,14 +521,15 @@ public void renderPopups(MatrixStack matrixStack, int mouseX, int mouseY) int cMouseX = mouseX - x1; int cMouseY = mouseY - y1; - popup.render(matrixStack, cMouseX, cMouseY); + popup.render(helper, cMouseX, cMouseY); matrixStack.pop(); } } - public void renderTooltip(MatrixStack matrixStack, int mouseX, int mouseY) + public void renderTooltip(DrawableHelper helper, int mouseX, int mouseY) { + MatrixStack matrixStack = helper.method_51448(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); @@ -583,14 +586,14 @@ public void renderTooltip(MatrixStack matrixStack, int mouseX, int mouseY) // text RenderSystem.setShaderColor(1, 1, 1, 1); for(int i = 0; i < lines.length; i++) - fr.draw(matrixStack, lines[i], xt1 + 2, yt1 + 2 + i * fr.fontHeight, - txtColor); + helper.method_51433(fr, lines[i], xt1 + 2, + yt1 + 2 + i * fr.fontHeight, txtColor, false); GL11.glEnable(GL11.GL_BLEND); matrixStack.pop(); } - public void renderPinnedWindows(MatrixStack matrixStack, float partialTicks) + public void renderPinnedWindows(DrawableHelper helper, float partialTicks) { GL11.glDisable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_BLEND); @@ -599,7 +602,7 @@ public void renderPinnedWindows(MatrixStack matrixStack, float partialTicks) for(Window window : windows) if(window.isPinned() && !window.isInvisible()) - renderWindow(matrixStack, window, Integer.MIN_VALUE, + renderWindow(helper, window, Integer.MIN_VALUE, Integer.MIN_VALUE, partialTicks); GL11.glEnable(GL11.GL_CULL_FACE); @@ -623,8 +626,8 @@ public void updateColors() acColor = clickGui.getAccentColor(); } - private void renderWindow(MatrixStack matrixStack, Window window, - int mouseX, int mouseY, float partialTicks) + private void renderWindow(DrawableHelper helper, Window window, int mouseX, + int mouseY, float partialTicks) { int x1 = window.getX(); int y1 = window.getY(); @@ -632,6 +635,7 @@ private void renderWindow(MatrixStack matrixStack, Window window, int y2 = y1 + window.getHeight(); int y3 = y1 + 13; + MatrixStack matrixStack = helper.method_51448(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); @@ -792,7 +796,7 @@ private void renderWindow(MatrixStack matrixStack, Window window, int cMouseX = mouseX - x1; int cMouseY = mouseY - y4; for(int i = 0; i < window.countChildren(); i++) - window.getChild(i).render(matrixStack, cMouseX, cMouseY, + window.getChild(i).render(helper, cMouseX, cMouseY, partialTicks); matrixStack.pop(); @@ -888,7 +892,7 @@ private void renderWindow(MatrixStack matrixStack, Window window, TextRenderer fr = MC.textRenderer; String title = fr.trimToWidth(Text.literal(window.getTitle()), x3 - x1) .getString(); - fr.draw(matrixStack, title, x1 + 2, y1 + 3, txtColor); + helper.method_51433(fr, title, x1 + 2, y1 + 3, txtColor, false); GL11.glEnable(GL11.GL_BLEND); } diff --git a/src/main/java/net/wurstclient/clickgui/ComboBoxPopup.java b/src/main/java/net/wurstclient/clickgui/ComboBoxPopup.java index 4a9a2d0127..f3b634c6b4 100644 --- a/src/main/java/net/wurstclient/clickgui/ComboBoxPopup.java +++ b/src/main/java/net/wurstclient/clickgui/ComboBoxPopup.java @@ -13,6 +13,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.render.Tessellator; @@ -69,8 +70,9 @@ public void handleMouseClick(int mouseX, int mouseY, int mouseButton) } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY) + public void render(DrawableHelper helper, int mouseX, int mouseY) { + MatrixStack matrixStack = helper.method_51448(); int x1 = getX(); int x2 = x1 + getWidth(); int y1 = getY(); @@ -97,7 +99,7 @@ public void render(MatrixStack matrixStack, int mouseX, int mouseY) boolean hValue = hovering && mouseY >= yi1 && mouseY < yi2; drawValueBackground(matrixStack, x1, x2, yi1, yi2, hValue); - drawValueName(matrixStack, x1, yi1, value); + drawValueName(helper, x1, yi1, value); } } @@ -148,14 +150,15 @@ private void drawValueBackground(MatrixStack matrixStack, int x1, int x2, tessellator.draw(); } - private void drawValueName(MatrixStack matrixStack, int x1, int yi1, + private void drawValueName(DrawableHelper helper, int x1, int yi1, Enum value) { ClickGui gui = WurstClient.INSTANCE.getGui(); int txtColor = gui.getTxtColor(); RenderSystem.setShaderColor(1, 1, 1, 1); - tr.draw(matrixStack, value.toString(), x1 + 2, yi1 + 2, txtColor); + helper.method_51433(tr, value.toString(), x1 + 2, yi1 + 2, txtColor, + false); GL11.glEnable(GL11.GL_BLEND); } diff --git a/src/main/java/net/wurstclient/clickgui/Component.java b/src/main/java/net/wurstclient/clickgui/Component.java index f64d522d8b..b2fb13e8a3 100644 --- a/src/main/java/net/wurstclient/clickgui/Component.java +++ b/src/main/java/net/wurstclient/clickgui/Component.java @@ -7,7 +7,7 @@ */ package net.wurstclient.clickgui; -import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.client.gui.DrawableHelper; public abstract class Component { @@ -23,7 +23,7 @@ public void handleMouseClick(double mouseX, double mouseY, int mouseButton) } - public abstract void render(MatrixStack matrixStack, int mouseX, int mouseY, + public abstract void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks); public abstract int getDefaultWidth(); diff --git a/src/main/java/net/wurstclient/clickgui/Popup.java b/src/main/java/net/wurstclient/clickgui/Popup.java index 5ac8a65701..b77f62f557 100644 --- a/src/main/java/net/wurstclient/clickgui/Popup.java +++ b/src/main/java/net/wurstclient/clickgui/Popup.java @@ -7,7 +7,7 @@ */ package net.wurstclient.clickgui; -import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.client.gui.DrawableHelper; public abstract class Popup { @@ -27,8 +27,7 @@ public Popup(Component owner) public abstract void handleMouseClick(int mouseX, int mouseY, int mouseButton); - public abstract void render(MatrixStack matrixStack, int mouseX, - int mouseY); + public abstract void render(DrawableHelper helper, int mouseX, int mouseY); public abstract int getDefaultWidth(); diff --git a/src/main/java/net/wurstclient/clickgui/components/AbstractListEditButton.java b/src/main/java/net/wurstclient/clickgui/components/AbstractListEditButton.java index 6673927b9c..ed5597a989 100644 --- a/src/main/java/net/wurstclient/clickgui/components/AbstractListEditButton.java +++ b/src/main/java/net/wurstclient/clickgui/components/AbstractListEditButton.java @@ -14,6 +14,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.render.Tessellator; @@ -56,7 +57,7 @@ public void handleMouseClick(double mouseX, double mouseY, int mouseButton) } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { ClickGui gui = WurstClient.INSTANCE.getGui(); @@ -79,6 +80,7 @@ public void render(MatrixStack matrixStack, int mouseX, int mouseY, boolean hText = hovering && mouseX < x3; boolean hBox = hovering && mouseX >= x3; + MatrixStack matrixStack = helper.method_51448(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); @@ -121,9 +123,9 @@ public void render(MatrixStack matrixStack, int mouseX, int mouseY, // setting name RenderSystem.setShaderColor(1, 1, 1, 1); - TextRenderer fr = MC.textRenderer; - fr.draw(matrixStack, getText(), x1, y1 + 2, txtColor); - fr.draw(matrixStack, buttonText, x3 + 2, y1 + 2, txtColor); + TextRenderer tr = MC.textRenderer; + helper.method_51433(tr, getText(), x1, y1 + 2, txtColor, false); + helper.method_51433(tr, buttonText, x3 + 2, y1 + 2, txtColor, false); GL11.glEnable(GL11.GL_BLEND); } diff --git a/src/main/java/net/wurstclient/clickgui/components/BlockComponent.java b/src/main/java/net/wurstclient/clickgui/components/BlockComponent.java index 65432bbbe6..1a97eef3f1 100644 --- a/src/main/java/net/wurstclient/clickgui/components/BlockComponent.java +++ b/src/main/java/net/wurstclient/clickgui/components/BlockComponent.java @@ -14,6 +14,7 @@ import net.minecraft.block.Block; import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; @@ -61,7 +62,7 @@ public void handleMouseClick(double mouseX, double mouseY, int mouseButton) } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { ClickGui gui = WurstClient.INSTANCE.getGui(); @@ -85,6 +86,7 @@ public void render(MatrixStack matrixStack, int mouseX, int mouseY, ItemStack stack = new ItemStack(setting.getBlock()); + MatrixStack matrixStack = helper.method_51448(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); @@ -117,16 +119,16 @@ else if(hBlock) // setting name RenderSystem.setShaderColor(1, 1, 1, 1); - TextRenderer fr = WurstClient.MC.textRenderer; + TextRenderer tr = WurstClient.MC.textRenderer; String text = setting.getName() + ":"; - fr.draw(matrixStack, text, x1, y1 + 2, txtColor); + helper.method_51433(tr, text, x1, y1 + 2, txtColor, false); MatrixStack modelViewStack = RenderSystem.getModelViewStack(); modelViewStack.push(); Window parent = getParent(); modelViewStack.translate(parent.getX(), parent.getY() + 13 + parent.getScrollOffset(), 0); - RenderUtils.drawItem(matrixStack, stack, x3, y1, true); + RenderUtils.drawItem(helper, stack, x3, y1, true); modelViewStack.pop(); RenderSystem.applyModelViewMatrix(); diff --git a/src/main/java/net/wurstclient/clickgui/components/CheckboxComponent.java b/src/main/java/net/wurstclient/clickgui/components/CheckboxComponent.java index 3fc6cbda10..007fb867a8 100644 --- a/src/main/java/net/wurstclient/clickgui/components/CheckboxComponent.java +++ b/src/main/java/net/wurstclient/clickgui/components/CheckboxComponent.java @@ -13,6 +13,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.render.Tessellator; @@ -55,9 +56,10 @@ public void handleMouseClick(double mouseX, double mouseY, int mouseButton) } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { + MatrixStack matrixStack = helper.method_51448(); int x1 = getX(); int x2 = x1 + getWidth(); int x3 = x1 + 11; @@ -80,7 +82,7 @@ public void render(MatrixStack matrixStack, int mouseX, int mouseY, if(setting.isChecked()) drawCheck(matrixStack, x1, y1, hovering); - drawName(matrixStack, x3, y1); + drawName(helper, x3, y1); } private boolean isHovering(int mouseX, int mouseY, int x1, int x2, int y1, @@ -209,7 +211,7 @@ private void drawCheck(MatrixStack matrixStack, int x1, int y1, tessellator.draw(); } - private void drawName(MatrixStack matrixStack, int x3, int y1) + private void drawName(DrawableHelper helper, int x3, int y1) { ClickGui gui = WurstClient.INSTANCE.getGui(); int txtColor = gui.getTxtColor(); @@ -219,7 +221,7 @@ private void drawName(MatrixStack matrixStack, int x3, int y1) String name = setting.getName(); int tx = x3 + 2; int ty = y1 + 2; - MC.textRenderer.draw(matrixStack, name, tx, ty, txtColor); + helper.method_51433(MC.textRenderer, name, tx, ty, txtColor, false); GL11.glEnable(GL11.GL_BLEND); } diff --git a/src/main/java/net/wurstclient/clickgui/components/ColorComponent.java b/src/main/java/net/wurstclient/clickgui/components/ColorComponent.java index c055710531..3bb8138f32 100644 --- a/src/main/java/net/wurstclient/clickgui/components/ColorComponent.java +++ b/src/main/java/net/wurstclient/clickgui/components/ColorComponent.java @@ -14,6 +14,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.render.Tessellator; @@ -55,9 +56,10 @@ else if(mouseButton == 1) } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { + MatrixStack matrixStack = helper.method_51448(); int x1 = getX(); int x2 = x1 + getWidth(); int y1 = getY(); @@ -84,7 +86,7 @@ public void render(MatrixStack matrixStack, int mouseX, int mouseY, drawBackground(matrixStack, x1, x2, y1, y3); drawBox(matrixStack, x1, x2, y2, y3, hovering && mouseY >= y3); - drawNameAndValue(matrixStack, x1, x2, y1 + 2); + drawNameAndValue(helper, x1, x2, y1 + 2); } private boolean isHovering(int mouseX, int mouseY, int x1, int x2, int y1, @@ -155,8 +157,7 @@ private void drawBox(MatrixStack matrixStack, int x1, int x2, int y2, tessellator.draw(); } - private void drawNameAndValue(MatrixStack matrixStack, int x1, int x2, - int y1) + private void drawNameAndValue(DrawableHelper helper, int x1, int x2, int y1) { ClickGui gui = WurstClient.INSTANCE.getGui(); int txtColor = gui.getTxtColor(); @@ -164,11 +165,11 @@ private void drawNameAndValue(MatrixStack matrixStack, int x1, int x2, RenderSystem.setShaderColor(1, 1, 1, 1); TextRenderer tr = MC.textRenderer; - tr.draw(matrixStack, setting.getName(), x1, y1, txtColor); + helper.method_51433(tr, setting.getName(), x1, y1, txtColor, false); String value = ColorUtils.toHex(setting.getColor()); int valueWidth = tr.getWidth(value); - tr.draw(matrixStack, value, x2 - valueWidth, y1, txtColor); + helper.method_51433(tr, value, x2 - valueWidth, y1, txtColor, false); GL11.glEnable(GL11.GL_BLEND); } diff --git a/src/main/java/net/wurstclient/clickgui/components/ComboBoxComponent.java b/src/main/java/net/wurstclient/clickgui/components/ComboBoxComponent.java index e353cfcd0d..ac22c446c6 100644 --- a/src/main/java/net/wurstclient/clickgui/components/ComboBoxComponent.java +++ b/src/main/java/net/wurstclient/clickgui/components/ComboBoxComponent.java @@ -17,6 +17,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.render.Tessellator; @@ -102,9 +103,10 @@ private boolean isPopupOpen() } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { + MatrixStack matrixStack = helper.method_51448(); int x1 = getX(); int x2 = x1 + getWidth(); int x3 = x2 - 11; @@ -128,7 +130,7 @@ public void render(MatrixStack matrixStack, int mouseX, int mouseY, drawSeparator(matrixStack, x3, y1, y2); drawArrow(matrixStack, x2, x3, y1, y2, hBox); - drawNameAndValue(matrixStack, x1, x4, y1); + drawNameAndValue(helper, x1, x4, y1); } private boolean isHovering(int mouseX, int mouseY, int x1, int x2, int y1, @@ -257,8 +259,7 @@ private void drawArrow(MatrixStack matrixStack, int x2, int x3, int y1, tessellator.draw(); } - private void drawNameAndValue(MatrixStack matrixStack, int x1, int x4, - int y1) + private void drawNameAndValue(DrawableHelper helper, int x1, int x4, int y1) { ClickGui gui = WurstClient.INSTANCE.getGui(); int txtColor = gui.getTxtColor(); @@ -268,8 +269,8 @@ private void drawNameAndValue(MatrixStack matrixStack, int x1, int x4, String name = setting.getName(); String value = "" + setting.getSelected(); - tr.draw(matrixStack, name, x1, y1 + 2, txtColor); - tr.draw(matrixStack, value, x4 + 2, y1 + 2, txtColor); + helper.method_51433(tr, name, x1, y1 + 2, txtColor, false); + helper.method_51433(tr, value, x4 + 2, y1 + 2, txtColor, false); GL11.glEnable(GL11.GL_BLEND); } diff --git a/src/main/java/net/wurstclient/clickgui/components/FeatureButton.java b/src/main/java/net/wurstclient/clickgui/components/FeatureButton.java index 5b029a0c3c..2a0eb73742 100644 --- a/src/main/java/net/wurstclient/clickgui/components/FeatureButton.java +++ b/src/main/java/net/wurstclient/clickgui/components/FeatureButton.java @@ -16,6 +16,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.render.Tessellator; @@ -95,9 +96,10 @@ private void closeSettingsWindow() } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { + MatrixStack matrixStack = helper.method_51448(); int x1 = getX(); int x2 = x1 + getWidth(); int x3 = hasSettings ? x2 - 11 : x2; @@ -126,7 +128,7 @@ public void render(MatrixStack matrixStack, int mouseX, int mouseY, drawSettingsArrow(matrixStack, x2, x3, y1, y2, hSettings); } - drawName(matrixStack, x1, x3, y1); + drawName(helper, x1, x3, y1); } private boolean isHovering(int mouseX, int mouseY, int x1, int x2, int y1, @@ -288,7 +290,7 @@ private void drawSettingsArrow(MatrixStack matrixStack, int x2, int x3, tessellator.draw(); } - private void drawName(MatrixStack matrixStack, int x1, int x3, int y1) + private void drawName(DrawableHelper helper, int x1, int x3, int y1) { ClickGui gui = WurstClient.INSTANCE.getGui(); int txtColor = gui.getTxtColor(); @@ -301,7 +303,7 @@ private void drawName(MatrixStack matrixStack, int x1, int x3, int y1) int tx = x1 + (x3 - x1 - nameWidth) / 2; int ty = y1 + 2; - tr.draw(matrixStack, name, tx, ty, txtColor); + helper.method_51433(tr, name, tx, ty, txtColor, false); GL11.glEnable(GL11.GL_BLEND); } diff --git a/src/main/java/net/wurstclient/clickgui/components/FileComponent.java b/src/main/java/net/wurstclient/clickgui/components/FileComponent.java index ab38ad6d3f..02504a78b0 100644 --- a/src/main/java/net/wurstclient/clickgui/components/FileComponent.java +++ b/src/main/java/net/wurstclient/clickgui/components/FileComponent.java @@ -13,6 +13,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.render.Tessellator; @@ -54,7 +55,7 @@ public void handleMouseClick(double mouseX, double mouseY, int mouseButton) } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { ClickGui gui = WurstClient.INSTANCE.getGui(); @@ -63,8 +64,8 @@ public void render(MatrixStack matrixStack, int mouseX, int mouseY, int txtColor = gui.getTxtColor(); float opacity = gui.getOpacity(); - TextRenderer fr = WurstClient.MC.textRenderer; - int buttonWidth = fr.getWidth(setting.getSelectedFileName()); + TextRenderer tr = WurstClient.MC.textRenderer; + int buttonWidth = tr.getWidth(setting.getSelectedFileName()); int x1 = getX(); int x2 = x1 + getWidth(); @@ -80,6 +81,7 @@ public void render(MatrixStack matrixStack, int mouseX, int mouseY, boolean hText = hovering && mouseX < x3; boolean hBox = hovering && mouseX >= x3; + MatrixStack matrixStack = helper.method_51448(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); @@ -128,9 +130,9 @@ else if(hBox) // setting name RenderSystem.setShaderColor(1, 1, 1, 1); String text = setting.getName() + ": "; - fr.draw(matrixStack, text, x1, y1 + 2, txtColor); - fr.draw(matrixStack, setting.getSelectedFileName(), x3 + 2, y1 + 2, - txtColor); + helper.method_51433(tr, text, x1, y1 + 2, txtColor, false); + helper.method_51433(tr, setting.getSelectedFileName(), x3 + 2, y1 + 2, + txtColor, false); GL11.glEnable(GL11.GL_BLEND); } diff --git a/src/main/java/net/wurstclient/clickgui/components/RadarComponent.java b/src/main/java/net/wurstclient/clickgui/components/RadarComponent.java index 086d533281..2c337f3ff1 100644 --- a/src/main/java/net/wurstclient/clickgui/components/RadarComponent.java +++ b/src/main/java/net/wurstclient/clickgui/components/RadarComponent.java @@ -12,6 +12,7 @@ import com.mojang.blaze3d.systems.RenderSystem; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; @@ -43,7 +44,7 @@ public RadarComponent(RadarHack hack) } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { ClickGui gui = WurstClient.INSTANCE.getGui(); @@ -62,6 +63,7 @@ public void render(MatrixStack matrixStack, int mouseX, int mouseY, && mouseY < y2 && mouseY >= -scroll && mouseY < getParent().getHeight() - 13 - scroll; + MatrixStack matrixStack = helper.method_51448(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); diff --git a/src/main/java/net/wurstclient/clickgui/components/SliderComponent.java b/src/main/java/net/wurstclient/clickgui/components/SliderComponent.java index 8250373710..93122af35f 100644 --- a/src/main/java/net/wurstclient/clickgui/components/SliderComponent.java +++ b/src/main/java/net/wurstclient/clickgui/components/SliderComponent.java @@ -14,6 +14,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; @@ -75,9 +76,10 @@ private void handleRightClick() } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { + MatrixStack matrixStack = helper.method_51448(); int x1 = getX(); int x2 = x1 + getWidth(); int x3 = x1 + 2; @@ -112,7 +114,7 @@ else if(hSlider && !dragging) drawBackground(matrixStack, x1, x2, x3, x4, y1, y2, y4, y5); drawRail(matrixStack, x3, x4, y4, y5, hSlider, renderAsDisabled); drawKnob(matrixStack, x1, x2, y2, y3, hSlider, renderAsDisabled); - drawNameAndValue(matrixStack, x1, x2, y1, renderAsDisabled); + drawNameAndValue(helper, x1, x2, y1, renderAsDisabled); } private void handleDragging(int mouseX, int x3, int x4) @@ -300,8 +302,8 @@ private void drawKnob(MatrixStack matrixStack, int x1, int x2, int y2, tessellator.draw(); } - private void drawNameAndValue(MatrixStack matrixStack, int x1, int x2, - int y1, boolean renderAsDisabled) + private void drawNameAndValue(DrawableHelper helper, int x1, int x2, int y1, + boolean renderAsDisabled) { ClickGui gui = WurstClient.INSTANCE.getGui(); int txtColor = gui.getTxtColor(); @@ -312,8 +314,9 @@ private void drawNameAndValue(MatrixStack matrixStack, int x1, int x2, String name = setting.getName(); String value = setting.getValueString(); int valueWidth = tr.getWidth(value); - tr.draw(matrixStack, name, x1, y1 + 2, txtColor); - tr.draw(matrixStack, value, x2 - valueWidth, y1 + 2, txtColor); + helper.method_51433(tr, name, x1, y1 + 2, txtColor, false); + helper.method_51433(tr, value, x2 - valueWidth, y1 + 2, txtColor, + false); GL11.glEnable(GL11.GL_BLEND); } diff --git a/src/main/java/net/wurstclient/clickgui/screens/AddBookOfferScreen.java b/src/main/java/net/wurstclient/clickgui/screens/AddBookOfferScreen.java index 9338371368..6fa8c5ff05 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/AddBookOfferScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/AddBookOfferScreen.java @@ -14,6 +14,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -286,40 +287,39 @@ public void tick() } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { - listGui.render(matrixStack, mouseX, mouseY, partialTicks); + MatrixStack matrixStack = helper.method_51448(); + listGui.render(helper, mouseX, mouseY, partialTicks); matrixStack.push(); matrixStack.translate(0, 0, 300); TextRenderer tr = client.textRenderer; String titleText = "Available Books (" + listGui.getItemCount() + ")"; - drawCenteredTextWithShadow(matrixStack, tr, titleText, width / 2, 12, + helper.drawCenteredTextWithShadow(tr, titleText, width / 2, 12, 0xffffff); - levelField.render(matrixStack, mouseX, mouseY, partialTicks); - priceField.render(matrixStack, mouseX, mouseY, partialTicks); - super.render(matrixStack, mouseX, mouseY, partialTicks); + levelField.render(helper, mouseX, mouseY, partialTicks); + priceField.render(helper, mouseX, mouseY, partialTicks); + super.render(helper, mouseX, mouseY, partialTicks); matrixStack.translate(width / 2 - 100, 0, 0); - drawTextWithShadow(matrixStack, tr, "Level:", 0, height - 72, 0xf0f0f0); - drawTextWithShadow(matrixStack, tr, "Max price:", 0, height - 56, - 0xf0f0f0); + helper.drawTextWithShadow(tr, "Level:", 0, height - 72, 0xf0f0f0); + helper.drawTextWithShadow(tr, "Max price:", 0, height - 56, 0xf0f0f0); if(alreadyAdded && offerToAdd != null) { String errorText = offerToAdd.getEnchantmentNameWithLevel() + " is already on your list!"; - drawTextWithShadow(matrixStack, tr, errorText, 0, height - 40, - 0xff5555); + helper.drawTextWithShadow(tr, errorText, 0, height - 40, 0xff5555); } matrixStack.pop(); - RenderUtils.drawItem(matrixStack, new ItemStack(Items.EMERALD), + RenderUtils.drawItem(helper, new ItemStack(Items.EMERALD), width / 2 - 16, height - 58, false); } @@ -393,15 +393,16 @@ protected void renderBackground() } @Override - protected void renderItem(MatrixStack matrixStack, int index, int x, + protected void renderItem(DrawableHelper helper, int index, int x, int y, int var4, int mouseX, int mouseY, float partialTicks) { + MatrixStack matrixStack = helper.method_51448(); if(isSelectedItem(index)) drawSelectionOutline(matrixStack, x, y); Item item = Registries.ITEM.get(new Identifier("enchanted_book")); ItemStack stack = new ItemStack(item); - RenderUtils.drawItem(matrixStack, stack, x + 1, y + 1, true); + RenderUtils.drawItem(helper, stack, x + 1, y + 1, true); TextRenderer tr = mc.textRenderer; BookOffer bookOffer = list.get(index); @@ -409,13 +410,14 @@ protected void renderItem(MatrixStack matrixStack, int index, int x, String name = bookOffer.getEnchantmentName(); int nameColor = enchantment.isCursed() ? 0xff5555 : 0xf0f0f0; - tr.draw(matrixStack, name, x + 28, y, nameColor); + helper.method_51433(tr, name, x + 28, y, nameColor, false); - tr.draw(matrixStack, bookOffer.id(), x + 28, y + 9, 0xa0a0a0); + helper.method_51433(tr, bookOffer.id(), x + 28, y + 9, 0xa0a0a0, + false); int maxLevel = enchantment.getMaxLevel(); String levels = maxLevel + (maxLevel == 1 ? " level" : " levels"); - tr.draw(matrixStack, levels, x + 28, y + 18, 0xa0a0a0); + helper.method_51433(tr, levels, x + 28, y + 18, 0xa0a0a0, false); } } } diff --git a/src/main/java/net/wurstclient/clickgui/screens/ClickGuiScreen.java b/src/main/java/net/wurstclient/clickgui/screens/ClickGuiScreen.java index 65e9256f71..ef04023993 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/ClickGuiScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/ClickGuiScreen.java @@ -7,8 +7,8 @@ */ package net.wurstclient.clickgui.screens; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.Text; import net.wurstclient.clickgui.ClickGui; @@ -50,10 +50,10 @@ public boolean mouseScrolled(double mouseX, double mouseY, double delta) } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { - super.render(matrixStack, mouseX, mouseY, partialTicks); - gui.render(matrixStack, mouseX, mouseY, partialTicks); + super.render(helper, mouseX, mouseY, partialTicks); + gui.render(helper, mouseX, mouseY, partialTicks); } } diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditBlockListScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditBlockListScreen.java index df7bb84a32..3db8f5c36c 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditBlockListScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditBlockListScreen.java @@ -14,6 +14,7 @@ import net.minecraft.block.Block; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.ConfirmScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; @@ -160,43 +161,45 @@ public void tick() } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { - listGui.render(matrixStack, mouseX, mouseY, partialTicks); + MatrixStack matrixStack = helper.method_51448(); + listGui.render(helper, mouseX, mouseY, partialTicks); - drawCenteredTextWithShadow(matrixStack, client.textRenderer, + helper.drawCenteredTextWithShadow(client.textRenderer, blockList.getName() + " (" + listGui.getItemCount() + ")", width / 2, 12, 0xffffff); matrixStack.push(); matrixStack.translate(0, 0, 300); - blockNameField.render(matrixStack, mouseX, mouseY, partialTicks); - super.render(matrixStack, mouseX, mouseY, partialTicks); + blockNameField.render(helper, mouseX, mouseY, partialTicks); + super.render(helper, mouseX, mouseY, partialTicks); matrixStack.translate(-64 + width / 2 - 152, 0, 0); if(blockNameField.getText().isEmpty() && !blockNameField.isFocused()) - drawTextWithShadow(matrixStack, client.textRenderer, - "block name or ID", 68, height - 50, 0x808080); + helper.drawTextWithShadow(client.textRenderer, "block name or ID", + 68, height - 50, 0x808080); int border = blockNameField.isFocused() ? 0xffffffff : 0xffa0a0a0; int black = 0xff000000; - fill(matrixStack, 48, height - 56, 64, height - 36, border); - fill(matrixStack, 49, height - 55, 64, height - 37, black); - fill(matrixStack, 214, height - 56, 244, height - 55, border); - fill(matrixStack, 214, height - 37, 244, height - 36, border); - fill(matrixStack, 244, height - 56, 246, height - 36, border); - fill(matrixStack, 214, height - 55, 243, height - 52, black); - fill(matrixStack, 214, height - 40, 243, height - 37, black); - fill(matrixStack, 214, height - 55, 216, height - 37, black); - fill(matrixStack, 242, height - 55, 245, height - 37, black); + helper.fill(48, height - 56, 64, height - 36, border); + helper.fill(49, height - 55, 64, height - 37, black); + helper.fill(214, height - 56, 244, height - 55, border); + helper.fill(214, height - 37, 244, height - 36, border); + helper.fill(244, height - 56, 246, height - 36, border); + helper.fill(214, height - 55, 243, height - 52, black); + helper.fill(214, height - 40, 243, height - 37, black); + helper.fill(214, height - 55, 216, height - 37, black); + helper.fill(242, height - 55, 245, height - 37, black); matrixStack.pop(); - RenderUtils.drawItem(matrixStack, new ItemStack(blockToAdd), + RenderUtils.drawItem(helper, + blockToAdd == null ? ItemStack.EMPTY : new ItemStack(blockToAdd), width / 2 - 164, height - 52, false); } @@ -255,22 +258,22 @@ protected void renderBackground() } @Override - protected void renderItem(MatrixStack matrixStack, int index, int x, + protected void renderItem(DrawableHelper helper, int index, int x, int y, int var4, int var5, int var6, float partialTicks) { String name = list.get(index); Block block = BlockUtils.getBlockFromName(name); ItemStack stack = new ItemStack(block); - TextRenderer fr = mc.textRenderer; + TextRenderer tr = mc.textRenderer; - RenderUtils.drawItem(matrixStack, stack, x + 1, y + 1, true); + RenderUtils.drawItem(helper, stack, x + 1, y + 1, true); String displayName = stack.isEmpty() ? "\u00a7ounknown block\u00a7r" : stack.getName().getString(); - fr.draw(matrixStack, displayName, x + 28, y, 0xf0f0f0); - fr.draw(matrixStack, name, x + 28, y + 9, 0xa0a0a0); - fr.draw(matrixStack, + helper.method_51433(tr, displayName, x + 28, y, 0xf0f0f0, false); + helper.method_51433(tr, name, x + 28, y + 9, 0xa0a0a0, false); + helper.method_51433(tr, "ID: " + Block.getRawIdFromState(block.getDefaultState()), - x + 28, y + 18, 0xa0a0a0); + x + 28, y + 18, 0xa0a0a0, false); } } } diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditBlockScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditBlockScreen.java index 2a63c8170b..3ab6b61620 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditBlockScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditBlockScreen.java @@ -12,6 +12,7 @@ import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -96,17 +97,18 @@ public void tick() } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { + MatrixStack matrixStack = helper.method_51448(); TextRenderer tr = client.textRenderer; - renderBackground(matrixStack); - drawCenteredTextWithShadow(matrixStack, tr, setting.getName(), - width / 2, 20, 0xFFFFFF); + renderBackground(helper); + helper.drawCenteredTextWithShadow(tr, setting.getName(), width / 2, 20, + 0xFFFFFF); - blockField.render(matrixStack, mouseX, mouseY, partialTicks); - super.render(matrixStack, mouseX, mouseY, partialTicks); + blockField.render(helper, mouseX, mouseY, partialTicks); + super.render(helper, mouseX, mouseY, partialTicks); matrixStack.push(); matrixStack.translate(-64 + width / 2 - 100, 115, 0); @@ -118,20 +120,20 @@ public void render(MatrixStack matrixStack, int mouseX, int mouseY, int lblX = lblAbove ? 50 : 68; int lblY = lblAbove ? -66 : -50; int lblColor = lblAbove ? 0xF0F0F0 : 0x808080; - drawTextWithShadow(matrixStack, tr, lblText, lblX, lblY, lblColor); + helper.drawTextWithShadow(tr, lblText, lblX, lblY, lblColor); int border = blockField.isFocused() ? 0xffffffff : 0xffa0a0a0; int black = 0xff000000; - fill(matrixStack, 48, -56, 64, -36, border); - fill(matrixStack, 49, -55, 64, -37, black); - fill(matrixStack, 214, -56, 244, -55, border); - fill(matrixStack, 214, -37, 244, -36, border); - fill(matrixStack, 244, -56, 246, -36, border); - fill(matrixStack, 214, -55, 243, -52, black); - fill(matrixStack, 214, -40, 243, -37, black); - fill(matrixStack, 215, -55, 216, -37, black); - fill(matrixStack, 242, -55, 245, -37, black); + helper.fill(48, -56, 64, -36, border); + helper.fill(49, -55, 64, -37, black); + helper.fill(214, -56, 244, -55, border); + helper.fill(214, -37, 244, -36, border); + helper.fill(244, -56, 246, -36, border); + helper.fill(214, -55, 243, -52, black); + helper.fill(214, -40, 243, -37, black); + helper.fill(215, -55, 216, -37, black); + helper.fill(242, -55, 245, -37, black); matrixStack.pop(); @@ -141,7 +143,7 @@ public void render(MatrixStack matrixStack, int mouseX, int mouseY, if(blockToAdd == null) blockToAdd = Blocks.AIR; - RenderUtils.drawItem(matrixStack, new ItemStack(blockToAdd), + RenderUtils.drawItem(helper, new ItemStack(blockToAdd), -64 + width / 2 - 100 + 52, 115 - 52, false); } diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditBookOfferScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditBookOfferScreen.java index bfa0bcb53b..4660b830fc 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditBookOfferScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditBookOfferScreen.java @@ -10,6 +10,7 @@ import org.lwjgl.glfw.GLFW; import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -251,17 +252,18 @@ public void tick() } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { - renderBackgroundTexture(matrixStack); + MatrixStack matrixStack = helper.method_51448(); + renderBackgroundTexture(helper); matrixStack.push(); matrixStack.translate(0, 0, 300); TextRenderer tr = client.textRenderer; String titleText = "Edit Book Offer"; - drawCenteredTextWithShadow(matrixStack, tr, titleText, width / 2, 12, + helper.drawCenteredTextWithShadow(tr, titleText, width / 2, 12, 0xffffff); int x = width / 2 - 100; @@ -269,16 +271,16 @@ public void render(MatrixStack matrixStack, int mouseX, int mouseY, Item item = Registries.ITEM.get(new Identifier("enchanted_book")); ItemStack stack = new ItemStack(item); - RenderUtils.drawItem(matrixStack, stack, x + 1, y + 1, true); + RenderUtils.drawItem(helper, stack, x + 1, y + 1, true); BookOffer bookOffer = offerToSave; String name = bookOffer.getEnchantmentNameWithLevel(); Enchantment enchantment = bookOffer.getEnchantment(); int nameColor = enchantment.isCursed() ? 0xff5555 : 0xffffff; - tr.drawWithShadow(matrixStack, name, x + 28, y, nameColor); + helper.drawTextWithShadow(tr, name, x + 28, y, nameColor); - tr.draw(matrixStack, bookOffer.id(), x + 28, y + 9, 0xa0a0a0); + helper.method_51433(tr, bookOffer.id(), x + 28, y + 9, 0xa0a0a0, false); String price; if(bookOffer.price() >= 64) @@ -286,31 +288,31 @@ public void render(MatrixStack matrixStack, int mouseX, int mouseY, else { price = "max " + bookOffer.price(); - RenderUtils.drawItem(matrixStack, new ItemStack(Items.EMERALD), + RenderUtils.drawItem(helper, new ItemStack(Items.EMERALD), x + 28 + tr.getWidth(price), y + 16, false); } - tr.draw(matrixStack, price, x + 28, y + 18, 0xa0a0a0); + helper.method_51433(tr, price, x + 28, y + 18, 0xa0a0a0, false); - levelField.render(matrixStack, mouseX, mouseY, partialTicks); - priceField.render(matrixStack, mouseX, mouseY, partialTicks); - super.render(matrixStack, mouseX, mouseY, partialTicks); + levelField.render(helper, mouseX, mouseY, partialTicks); + priceField.render(helper, mouseX, mouseY, partialTicks); + super.render(helper, mouseX, mouseY, partialTicks); matrixStack.translate(width / 2 - 100, 112, 0); - drawTextWithShadow(matrixStack, tr, "Level:", 0, 0, 0xf0f0f0); - drawTextWithShadow(matrixStack, tr, "Max price:", 0, 16, 0xf0f0f0); + helper.drawTextWithShadow(tr, "Level:", 0, 0, 0xf0f0f0); + helper.drawTextWithShadow(tr, "Max price:", 0, 16, 0xf0f0f0); if(alreadyAdded && offerToSave != null) { String errorText = offerToSave.getEnchantmentNameWithLevel() + " is already on your list!"; - drawTextWithShadow(matrixStack, tr, errorText, 0, 32, 0xff5555); + helper.drawTextWithShadow(tr, errorText, 0, 32, 0xff5555); } matrixStack.pop(); - RenderUtils.drawItem(matrixStack, new ItemStack(Items.EMERALD), + RenderUtils.drawItem(helper, new ItemStack(Items.EMERALD), width / 2 - 16, 126, false); } diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditBookOffersScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditBookOffersScreen.java index cc455a1b17..2af5011a71 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditBookOffersScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditBookOffersScreen.java @@ -13,6 +13,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.ConfirmScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; @@ -176,19 +177,20 @@ public void tick() } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { - listGui.render(matrixStack, mouseX, mouseY, partialTicks); + MatrixStack matrixStack = helper.method_51448(); + listGui.render(helper, mouseX, mouseY, partialTicks); matrixStack.push(); matrixStack.translate(0, 0, 300); - drawCenteredTextWithShadow(matrixStack, client.textRenderer, + helper.drawCenteredTextWithShadow(client.textRenderer, bookOffers.getName() + " (" + listGui.getItemCount() + ")", width / 2, 12, 0xffffff); - super.render(matrixStack, mouseX, mouseY, partialTicks); + super.render(helper, mouseX, mouseY, partialTicks); matrixStack.pop(); } @@ -248,15 +250,16 @@ protected void renderBackground() } @Override - protected void renderItem(MatrixStack matrixStack, int index, int x, + protected void renderItem(DrawableHelper helper, int index, int x, int y, int var4, int var5, int var6, float partialTicks) { + MatrixStack matrixStack = helper.method_51448(); if(isSelectedItem(index)) drawSelectionOutline(matrixStack, x, y); Item item = Registries.ITEM.get(new Identifier("enchanted_book")); ItemStack stack = new ItemStack(item); - RenderUtils.drawItem(matrixStack, stack, x + 1, y + 1, true); + RenderUtils.drawItem(helper, stack, x + 1, y + 1, true); TextRenderer tr = mc.textRenderer; BookOffer bookOffer = list.get(index); @@ -264,9 +267,10 @@ protected void renderItem(MatrixStack matrixStack, int index, int x, Enchantment enchantment = bookOffer.getEnchantment(); int nameColor = enchantment.isCursed() ? 0xff5555 : 0xf0f0f0; - tr.draw(matrixStack, name, x + 28, y, nameColor); + helper.method_51433(tr, name, x + 28, y, nameColor, false); - tr.draw(matrixStack, bookOffer.id(), x + 28, y + 9, 0xa0a0a0); + helper.method_51433(tr, bookOffer.id(), x + 28, y + 9, 0xa0a0a0, + false); String price; if(bookOffer.price() >= 64) @@ -274,11 +278,11 @@ protected void renderItem(MatrixStack matrixStack, int index, int x, else { price = "max " + bookOffer.price(); - RenderUtils.drawItem(matrixStack, new ItemStack(Items.EMERALD), + RenderUtils.drawItem(helper, new ItemStack(Items.EMERALD), x + 28 + tr.getWidth(price), y + 16, false); } - tr.draw(matrixStack, price, x + 28, y + 18, 0xa0a0a0); + helper.method_51433(tr, price, x + 28, y + 18, 0xa0a0a0, false); } } } diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditColorScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditColorScreen.java index e9d98897f3..40d4028dfd 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditColorScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditColorScreen.java @@ -16,14 +16,12 @@ import org.lwjgl.glfw.GLFW; -import com.mojang.blaze3d.systems.RenderSystem; - import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.Text; import net.minecraft.util.Identifier; import net.wurstclient.settings.ColorSetting; @@ -167,17 +165,16 @@ public void tick() } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { TextRenderer tr = client.textRenderer; - renderBackground(matrixStack); - drawCenteredTextWithShadow(matrixStack, client.textRenderer, + renderBackground(helper); + helper.drawCenteredTextWithShadow(client.textRenderer, colorSetting.getName(), width / 2, 16, 0xF0F0F0); // Draw palette - RenderSystem.setShaderTexture(0, paletteIdentifier); int x = paletteX; int y = paletteY; int w = paletteWidth; @@ -186,22 +183,22 @@ public void render(MatrixStack matrixStack, int mouseX, int mouseY, int fh = paletteHeight; float u = 0; float v = 0; - drawTexture(matrixStack, x, y, u, v, w, h, fw, fh); + helper.drawTexture(paletteIdentifier, x, y, u, v, w, h, fw, fh); // RGB letters - tr.draw(matrixStack, "#", fieldsX - 3 - tr.getWidth("#"), fieldsY + 6, - 0xF0F0F0); - tr.draw(matrixStack, "R:", fieldsX - 3 - tr.getWidth("R:"), - fieldsY + 6 + 35, 0xFF0000); - tr.draw(matrixStack, "G:", fieldsX + 75 - 3 - tr.getWidth("G:"), - fieldsY + 6 + 35, 0x00FF00); - tr.draw(matrixStack, "B:", fieldsX + 150 - 3 - tr.getWidth("B:"), - fieldsY + 6 + 35, 0x0000FF); + helper.method_51433(tr, "#", fieldsX - 3 - tr.getWidth("#"), + fieldsY + 6, 0xF0F0F0, false); + helper.method_51433(tr, "R:", fieldsX - 3 - tr.getWidth("R:"), + fieldsY + 6 + 35, 0xFF0000, false); + helper.method_51433(tr, "G:", fieldsX + 75 - 3 - tr.getWidth("G:"), + fieldsY + 6 + 35, 0x00FF00, false); + helper.method_51433(tr, "B:", fieldsX + 150 - 3 - tr.getWidth("B:"), + fieldsY + 6 + 35, 0x0000FF, false); - hexValueField.render(matrixStack, mouseX, mouseY, partialTicks); - redValueField.render(matrixStack, mouseX, mouseY, partialTicks); - greenValueField.render(matrixStack, mouseX, mouseY, partialTicks); - blueValueField.render(matrixStack, mouseX, mouseY, partialTicks); + hexValueField.render(helper, mouseX, mouseY, partialTicks); + redValueField.render(helper, mouseX, mouseY, partialTicks); + greenValueField.render(helper, mouseX, mouseY, partialTicks); + blueValueField.render(helper, mouseX, mouseY, partialTicks); // Color preview @@ -212,15 +209,15 @@ public void render(MatrixStack matrixStack, int mouseX, int mouseY, int boxY = fieldsY; // Border - fill(matrixStack, boxX - borderSize, boxY - borderSize, + helper.fill(boxX - borderSize, boxY - borderSize, boxX + boxWidth + borderSize, boxY + boxHeight + borderSize, 0xFFAAAAAA); // Color box - fill(matrixStack, boxX, boxY, boxX + boxWidth, boxY + boxHeight, + helper.fill(boxX, boxY, boxX + boxWidth, boxY + boxHeight, color.getRGB()); - super.render(matrixStack, mouseX, mouseY, partialTicks); + super.render(helper, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditItemListScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditItemListScreen.java index d25cdb5032..6de474821a 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditItemListScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditItemListScreen.java @@ -13,6 +13,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.ConfirmScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; @@ -162,20 +163,21 @@ public void tick() } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { - listGui.render(matrixStack, mouseX, mouseY, partialTicks); + MatrixStack matrixStack = helper.method_51448(); + listGui.render(helper, mouseX, mouseY, partialTicks); - drawCenteredTextWithShadow(matrixStack, client.textRenderer, + helper.drawCenteredTextWithShadow(client.textRenderer, itemList.getName() + " (" + listGui.getItemCount() + ")", width / 2, 12, 0xffffff); matrixStack.push(); matrixStack.translate(0, 0, 300); - itemNameField.render(matrixStack, mouseX, mouseY, partialTicks); - super.render(matrixStack, mouseX, mouseY, partialTicks); + itemNameField.render(helper, mouseX, mouseY, partialTicks); + super.render(helper, mouseX, mouseY, partialTicks); matrixStack.translate(-64 + width / 2 - 152, 0, 0); @@ -183,27 +185,28 @@ public void render(MatrixStack matrixStack, int mouseX, int mouseY, { matrixStack.push(); matrixStack.translate(0, 0, 300); - drawTextWithShadow(matrixStack, client.textRenderer, - "item name or ID", 68, height - 50, 0x808080); + helper.drawTextWithShadow(client.textRenderer, "item name or ID", + 68, height - 50, 0x808080); matrixStack.pop(); } int border = itemNameField.isFocused() ? 0xffffffff : 0xffa0a0a0; int black = 0xff000000; - fill(matrixStack, 48, height - 56, 64, height - 36, border); - fill(matrixStack, 49, height - 55, 64, height - 37, black); - fill(matrixStack, 214, height - 56, 244, height - 55, border); - fill(matrixStack, 214, height - 37, 244, height - 36, border); - fill(matrixStack, 244, height - 56, 246, height - 36, border); - fill(matrixStack, 214, height - 55, 243, height - 52, black); - fill(matrixStack, 214, height - 40, 243, height - 37, black); - fill(matrixStack, 215, height - 55, 216, height - 37, black); - fill(matrixStack, 242, height - 55, 245, height - 37, black); + helper.fill(48, height - 56, 64, height - 36, border); + helper.fill(49, height - 55, 64, height - 37, black); + helper.fill(214, height - 56, 244, height - 55, border); + helper.fill(214, height - 37, 244, height - 36, border); + helper.fill(244, height - 56, 246, height - 36, border); + helper.fill(214, height - 55, 243, height - 52, black); + helper.fill(214, height - 40, 243, height - 37, black); + helper.fill(215, height - 55, 216, height - 37, black); + helper.fill(242, height - 55, 245, height - 37, black); matrixStack.pop(); - RenderUtils.drawItem(matrixStack, new ItemStack(itemToAdd), + RenderUtils.drawItem(helper, + itemToAdd == null ? ItemStack.EMPTY : new ItemStack(itemToAdd), width / 2 - 164, height - 52, false); } @@ -262,21 +265,21 @@ protected void renderBackground() } @Override - protected void renderItem(MatrixStack matrixStack, int index, int x, + protected void renderItem(DrawableHelper helper, int index, int x, int y, int var4, int var5, int var6, float partialTicks) { String name = list.get(index); Item item = Registries.ITEM.get(new Identifier(name)); ItemStack stack = new ItemStack(item); - TextRenderer fr = mc.textRenderer; + TextRenderer tr = mc.textRenderer; - RenderUtils.drawItem(matrixStack, stack, x + 1, y + 1, true); + RenderUtils.drawItem(helper, stack, x + 1, y + 1, true); String displayName = stack.isEmpty() ? "\u00a7ounknown item\u00a7r" : stack.getName().getString(); - fr.draw(matrixStack, displayName, x + 28, y, 0xf0f0f0); - fr.draw(matrixStack, name, x + 28, y + 9, 0xa0a0a0); - fr.draw(matrixStack, "ID: " + Registries.ITEM.getRawId(item), - x + 28, y + 18, 0xa0a0a0); + helper.method_51433(tr, displayName, x + 28, y, 0xf0f0f0, false); + helper.method_51433(tr, name, x + 28, y + 9, 0xa0a0a0, false); + helper.method_51433(tr, "ID: " + Registries.ITEM.getRawId(item), + x + 28, y + 18, 0xa0a0a0, false); } } } diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditSliderScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditSliderScreen.java index 70cf8fbc75..47bf7d62c4 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditSliderScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditSliderScreen.java @@ -10,10 +10,10 @@ import org.lwjgl.glfw.GLFW; import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.Text; import net.wurstclient.settings.SliderSetting; import net.wurstclient.settings.SliderSetting.ValueDisplay; @@ -92,15 +92,15 @@ public void tick() } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { - renderBackground(matrixStack); - drawCenteredTextWithShadow(matrixStack, client.textRenderer, - slider.getName(), width / 2, 20, 0xFFFFFF); + renderBackground(helper); + helper.drawCenteredTextWithShadow(client.textRenderer, slider.getName(), + width / 2, 20, 0xFFFFFF); - valueField.render(matrixStack, mouseX, mouseY, partialTicks); - super.render(matrixStack, mouseX, mouseY, partialTicks); + valueField.render(helper, mouseX, mouseY, partialTicks); + super.render(helper, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/clickgui/screens/SelectFileScreen.java b/src/main/java/net/wurstclient/clickgui/screens/SelectFileScreen.java index bc372d87b0..9592653244 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/SelectFileScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/SelectFileScreen.java @@ -16,10 +16,10 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.ConfirmScreen; 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; import net.wurstclient.settings.FileSetting; @@ -162,19 +162,19 @@ public void tick() } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { - renderBackground(matrixStack); - listGui.render(matrixStack, mouseX, mouseY, partialTicks); + renderBackground(helper); + listGui.render(helper, mouseX, mouseY, partialTicks); - drawCenteredTextWithShadow(matrixStack, client.textRenderer, + helper.drawCenteredTextWithShadow(client.textRenderer, setting.getName(), width / 2, 12, 0xffffff); - super.render(matrixStack, mouseX, mouseY, partialTicks); + super.render(helper, mouseX, mouseY, partialTicks); if(doneButton.isSelected() && !doneButton.active) - renderTooltip(matrixStack, + helper.method_51434(textRenderer, Arrays.asList(Text.literal("You must first select a file.")), mouseX, mouseY); } @@ -234,16 +234,17 @@ protected void renderBackground() } @Override - protected void renderItem(MatrixStack matrixStack, int index, int x, + protected void renderItem(DrawableHelper helper, int index, int x, int y, int var4, int var5, int var6, float partialTicks) { - TextRenderer fr = mc.textRenderer; + TextRenderer tr = mc.textRenderer; Path path = list.get(index); - fr.draw(matrixStack, "" + path.getFileName(), x + 28, y, 0xf0f0f0); - fr.draw(matrixStack, + helper.method_51433(tr, "" + path.getFileName(), x + 28, y, + 0xf0f0f0, false); + helper.method_51433(tr, "" + client.runDirectory.toPath().relativize(path), x + 28, - y + 9, 0xa0a0a0); + y + 9, 0xa0a0a0, false); } } } diff --git a/src/main/java/net/wurstclient/commands/TacoCmd.java b/src/main/java/net/wurstclient/commands/TacoCmd.java index 314bcb9770..7ec114c032 100644 --- a/src/main/java/net/wurstclient/commands/TacoCmd.java +++ b/src/main/java/net/wurstclient/commands/TacoCmd.java @@ -13,7 +13,6 @@ import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.util.Window; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.Identifier; import net.wurstclient.Category; import net.wurstclient.command.CmdException; @@ -83,7 +82,7 @@ public void onUpdate() } @Override - public void onRenderGUI(MatrixStack matrixStack, float partialTicks) + public void onRenderGUI(DrawableHelper helper, float partialTicks) { GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_CULL_FACE); @@ -97,13 +96,12 @@ public void onRenderGUI(MatrixStack matrixStack, float partialTicks) }else RenderSystem.setShaderColor(1, 1, 1, 1); - RenderSystem.setShaderTexture(0, tacos[ticks / 8]); Window sr = MC.getWindow(); int x = sr.getScaledWidth() / 2 - 32 + 76; int y = sr.getScaledHeight() - 32 - 19; int w = 64; int h = 32; - DrawableHelper.drawTexture(matrixStack, x, y, 0, 0, w, h, w, h); + helper.drawTexture(tacos[ticks / 8], x, y, 0, 0, w, h, w, h); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); diff --git a/src/main/java/net/wurstclient/events/GUIRenderListener.java b/src/main/java/net/wurstclient/events/GUIRenderListener.java index 9d784ba4a0..f695992282 100644 --- a/src/main/java/net/wurstclient/events/GUIRenderListener.java +++ b/src/main/java/net/wurstclient/events/GUIRenderListener.java @@ -9,22 +9,22 @@ import java.util.ArrayList; -import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.client.gui.DrawableHelper; import net.wurstclient.event.Event; import net.wurstclient.event.Listener; public interface GUIRenderListener extends Listener { - public void onRenderGUI(MatrixStack matrixStack, float partialTicks); + public void onRenderGUI(DrawableHelper helper, float partialTicks); public static class GUIRenderEvent extends Event { private final float partialTicks; - private final MatrixStack matrixStack; + private final DrawableHelper helper; - public GUIRenderEvent(MatrixStack matrixStack, float partialTicks) + public GUIRenderEvent(DrawableHelper helper, float partialTicks) { - this.matrixStack = matrixStack; + this.helper = helper; this.partialTicks = partialTicks; } @@ -32,7 +32,7 @@ public GUIRenderEvent(MatrixStack matrixStack, float partialTicks) public void fire(ArrayList listeners) { for(GUIRenderListener listener : listeners) - listener.onRenderGUI(matrixStack, partialTicks); + listener.onRenderGUI(helper, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java b/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java index 66ee780fca..4828baf5ac 100644 --- a/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java +++ b/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java @@ -427,7 +427,7 @@ Comparator. comparingDouble( private boolean isReplaceable(BlockPos pos) { - return BlockUtils.getState(pos).getMaterial().isReplaceable(); + return BlockUtils.getState(pos).isReplaceable(); } private boolean hasClickableNeighbor(BlockPos pos) @@ -442,7 +442,7 @@ private boolean hasClickableNeighbor(BlockPos pos) private boolean isClickableNeighbor(BlockPos pos) { return BlockUtils.canBeClicked(pos) - && !BlockUtils.getState(pos).getMaterial().isReplaceable(); + && !BlockUtils.getState(pos).isReplaceable(); } private boolean isChargedAnchor(BlockPos pos) diff --git a/src/main/java/net/wurstclient/hacks/AutoBuildHack.java b/src/main/java/net/wurstclient/hacks/AutoBuildHack.java index 8b9d0dcb99..644a507401 100644 --- a/src/main/java/net/wurstclient/hacks/AutoBuildHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoBuildHack.java @@ -211,7 +211,7 @@ private void updateRemainingBlocks() BlockPos pos = itr.next(); BlockState state = BlockUtils.getState(pos); - if(!state.getMaterial().isReplaceable()) + if(!state.isReplaceable()) itr.remove(); } } @@ -237,7 +237,7 @@ private boolean tryToPlace(BlockPos pos, Vec3d eyesPos, double rangeSq) // check if neighbor can be right clicked if(!BlockUtils.canBeClicked(neighbor) - || BlockUtils.getState(neighbor).getMaterial().isReplaceable()) + || BlockUtils.getState(neighbor).isReplaceable()) continue; Vec3d dirVec = Vec3d.of(side.getVector()); @@ -313,7 +313,7 @@ private void buildInstantly() for(BlockPos pos : remainingBlocks) { - if(!BlockUtils.getState(pos).getMaterial().isReplaceable()) + if(!BlockUtils.getState(pos).isReplaceable()) continue; Vec3d posVec = Vec3d.ofCenter(pos); @@ -374,7 +374,7 @@ public void onRender(MatrixStack matrixStack, float partialTicks) && blocksDrawn < 1024;) { BlockPos pos = itr.next(); - if(!BlockUtils.getState(pos).getMaterial().isReplaceable()) + if(!BlockUtils.getState(pos).isReplaceable()) continue; matrixStack.push(); diff --git a/src/main/java/net/wurstclient/hacks/AutoFarmHack.java b/src/main/java/net/wurstclient/hacks/AutoFarmHack.java index cd29061e3c..9fe956e044 100644 --- a/src/main/java/net/wurstclient/hacks/AutoFarmHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoFarmHack.java @@ -175,8 +175,7 @@ private List getBlocksToReplant(Vec3d eyesVec, BlockPos eyesBlock, { return getBlockStream(eyesBlock, blockRange) .filter(pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos)) <= rangeSq) - .filter( - pos -> BlockUtils.getState(pos).getMaterial().isReplaceable()) + .filter(pos -> BlockUtils.getState(pos).isReplaceable()) .filter(pos -> plants.containsKey(pos)).filter(this::canBeReplanted) .sorted(Comparator.comparingDouble( pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos)))) diff --git a/src/main/java/net/wurstclient/hacks/BowAimbotHack.java b/src/main/java/net/wurstclient/hacks/BowAimbotHack.java index 55b76bbbad..bdec313c63 100644 --- a/src/main/java/net/wurstclient/hacks/BowAimbotHack.java +++ b/src/main/java/net/wurstclient/hacks/BowAimbotHack.java @@ -18,6 +18,7 @@ import com.mojang.blaze3d.systems.RenderSystem; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; @@ -242,8 +243,9 @@ public void onRender(MatrixStack matrixStack, float partialTicks) } @Override - public void onRenderGUI(MatrixStack matrixStack, float partialTicks) + public void onRenderGUI(DrawableHelper helper, float partialTicks) { + MatrixStack matrixStack = helper.method_51448(); if(target == null) return; @@ -281,7 +283,7 @@ public void onRenderGUI(MatrixStack matrixStack, float partialTicks) tessellator.draw(); // text - MC.textRenderer.draw(matrixStack, message, 2, 1, 0xffffffff); + helper.method_51433(MC.textRenderer, message, 2, 1, 0xffffffff, false); matrixStack.pop(); diff --git a/src/main/java/net/wurstclient/hacks/BuildRandomHack.java b/src/main/java/net/wurstclient/hacks/BuildRandomHack.java index 18c371e1df..6b27f9ec11 100644 --- a/src/main/java/net/wurstclient/hacks/BuildRandomHack.java +++ b/src/main/java/net/wurstclient/hacks/BuildRandomHack.java @@ -171,7 +171,7 @@ public void onRender(MatrixStack matrixStack, float partialTicks) private boolean tryToPlaceBlock(boolean legitMode, BlockPos pos) { - if(!BlockUtils.getState(pos).getMaterial().isReplaceable()) + if(!BlockUtils.getState(pos).isReplaceable()) return false; if(legitMode) diff --git a/src/main/java/net/wurstclient/hacks/CrystalAuraHack.java b/src/main/java/net/wurstclient/hacks/CrystalAuraHack.java index c36be76146..3fffb32a3e 100644 --- a/src/main/java/net/wurstclient/hacks/CrystalAuraHack.java +++ b/src/main/java/net/wurstclient/hacks/CrystalAuraHack.java @@ -343,7 +343,7 @@ Comparator. comparingDouble( private boolean isReplaceable(BlockPos pos) { - return BlockUtils.getState(pos).getMaterial().isReplaceable(); + return BlockUtils.getState(pos).isReplaceable(); } private boolean hasCrystalBase(BlockPos pos) @@ -355,7 +355,7 @@ private boolean hasCrystalBase(BlockPos pos) private boolean isClickableNeighbor(BlockPos pos) { return BlockUtils.canBeClicked(pos) - && !BlockUtils.getState(pos).getMaterial().isReplaceable(); + && !BlockUtils.getState(pos).isReplaceable(); } private enum FaceBlocks diff --git a/src/main/java/net/wurstclient/hacks/ExcavatorHack.java b/src/main/java/net/wurstclient/hacks/ExcavatorHack.java index 973d7a95af..9154b01a68 100644 --- a/src/main/java/net/wurstclient/hacks/ExcavatorHack.java +++ b/src/main/java/net/wurstclient/hacks/ExcavatorHack.java @@ -21,6 +21,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.render.Tessellator; @@ -324,13 +325,14 @@ public void onRender(MatrixStack matrixStack, float partialTicks) } @Override - public void onRenderGUI(MatrixStack matrixStack, float partialTicks) + public void onRenderGUI(DrawableHelper helper, float partialTicks) { // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_CULL_FACE); + MatrixStack matrixStack = helper.method_51448(); matrixStack.push(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); @@ -363,7 +365,7 @@ public void onRenderGUI(MatrixStack matrixStack, float partialTicks) tessellator.draw(); // text - tr.draw(matrixStack, message, 2, 1, 0xffffffff); + helper.method_51433(tr, message, 2, 1, 0xffffffff, false); matrixStack.pop(); diff --git a/src/main/java/net/wurstclient/hacks/InstantBunkerHack.java b/src/main/java/net/wurstclient/hacks/InstantBunkerHack.java index a6fd89977a..0592e6c4b2 100644 --- a/src/main/java/net/wurstclient/hacks/InstantBunkerHack.java +++ b/src/main/java/net/wurstclient/hacks/InstantBunkerHack.java @@ -131,7 +131,7 @@ public void onUpdate() if(!building && startTimer <= 0) { for(BlockPos pos : positions) - if(BlockUtils.getState(pos).getMaterial().isReplaceable() + if(BlockUtils.getState(pos).isReplaceable() && !MC.player.getBoundingBox().intersects(new Box(pos))) placeBlockSimple(pos); MC.player.swingHand(Hand.MAIN_HAND); diff --git a/src/main/java/net/wurstclient/hacks/InvWalkHack.java b/src/main/java/net/wurstclient/hacks/InvWalkHack.java index 2113b67e6b..ebbafe43c7 100644 --- a/src/main/java/net/wurstclient/hacks/InvWalkHack.java +++ b/src/main/java/net/wurstclient/hacks/InvWalkHack.java @@ -117,7 +117,8 @@ private boolean isCreativeSearchBarOpen(Screen screen) if(!(screen instanceof CreativeInventoryScreen)) return false; - return CreativeInventoryScreen.selectedTab == ItemGroups.SEARCH; + return CreativeInventoryScreen.selectedTab == ItemGroups + .getSearchGroup(); } private boolean hasTextBox(Screen screen) diff --git a/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java b/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java index 6774286edc..64f9c42801 100644 --- a/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java +++ b/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java @@ -279,6 +279,7 @@ public ChunkScanner(Chunk chunk) this.chunk = chunk; } + @SuppressWarnings("deprecation") private void scan() { ClientWorld world = MC.world; @@ -298,7 +299,7 @@ private void scan() BlockPos pos = new BlockPos(x, y, z); BlockState state = world.getBlockState(pos); - if(state.getMaterial().blocksMovement()) + if(state.method_51366()) continue; if(!state.getFluidState().isEmpty()) continue; diff --git a/src/main/java/net/wurstclient/hacks/ScaffoldWalkHack.java b/src/main/java/net/wurstclient/hacks/ScaffoldWalkHack.java index c363038a7d..098bbd345c 100644 --- a/src/main/java/net/wurstclient/hacks/ScaffoldWalkHack.java +++ b/src/main/java/net/wurstclient/hacks/ScaffoldWalkHack.java @@ -56,7 +56,7 @@ public void onUpdate() BlockPos belowPlayer = BlockPos.ofFloored(MC.player.getPos()).down(); // check if block is already placed - if(!BlockUtils.getState(belowPlayer).getMaterial().isReplaceable()) + if(!BlockUtils.getState(belowPlayer).isReplaceable()) return; // search blocks in hotbar diff --git a/src/main/java/net/wurstclient/hacks/TunnellerHack.java b/src/main/java/net/wurstclient/hacks/TunnellerHack.java index 1889edb90f..fea7d0b0ee 100644 --- a/src/main/java/net/wurstclient/hacks/TunnellerHack.java +++ b/src/main/java/net/wurstclient/hacks/TunnellerHack.java @@ -557,7 +557,7 @@ Comparator. comparingDouble( return; } - if(BlockUtils.getState(pos).getMaterial().isReplaceable()) + if(BlockUtils.getState(pos).isReplaceable()) placeBlockSimple(pos); else { @@ -764,7 +764,7 @@ public boolean canRun() return false; BlockState state = BlockUtils.getState(nextTorch); - if(!state.getMaterial().isReplaceable()) + if(!state.isReplaceable()) return false; // Can't see why canPlaceAt() is deprecated. Still seems to be diff --git a/src/main/java/net/wurstclient/hud/HackListHUD.java b/src/main/java/net/wurstclient/hud/HackListHUD.java index 2b50db49ff..01b4016331 100644 --- a/src/main/java/net/wurstclient/hud/HackListHUD.java +++ b/src/main/java/net/wurstclient/hud/HackListHUD.java @@ -13,8 +13,8 @@ import java.util.Iterator; import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.util.Window; -import net.minecraft.client.util.math.MatrixStack; import net.wurstclient.WurstClient; import net.wurstclient.events.UpdateListener; import net.wurstclient.hack.Hack; @@ -34,7 +34,7 @@ public HackListHUD() WurstClient.INSTANCE.getEventManager().add(UpdateListener.class, this); } - public void render(MatrixStack matrixStack, float partialTicks) + public void render(DrawableHelper helper, float partialTicks) { if(otf.getMode() == Mode.HIDDEN) return; @@ -59,26 +59,26 @@ public void render(MatrixStack matrixStack, float partialTicks) Window sr = WurstClient.MC.getWindow(); if(otf.getMode() == Mode.COUNT || height > sr.getScaledHeight()) - drawCounter(matrixStack); + drawCounter(helper); else - drawHackList(matrixStack, partialTicks); + drawHackList(helper, partialTicks); } - private void drawCounter(MatrixStack matrixStack) + private void drawCounter(DrawableHelper helper) { long size = activeHax.stream().filter(e -> e.hack.isEnabled()).count(); String s = size + " hack" + (size != 1 ? "s" : "") + " active"; - drawString(matrixStack, s); + drawString(helper, s); } - private void drawHackList(MatrixStack matrixStack, float partialTicks) + private void drawHackList(DrawableHelper helper, float partialTicks) { if(otf.isAnimations()) for(HackListEntry e : activeHax) - drawWithOffset(matrixStack, e, partialTicks); + drawWithOffset(helper, e, partialTicks); else for(HackListEntry e : activeHax) - drawString(matrixStack, e.hack.getRenderName()); + drawString(helper, e.hack.getRenderName()); } public void updateState(Hack hack) @@ -129,7 +129,7 @@ else if(!enabled && e.offset >= 4) } } - private void drawString(MatrixStack matrixStack, String s) + private void drawString(DrawableHelper helper, String s) { TextRenderer tr = WurstClient.MC.textRenderer; int posX; @@ -144,13 +144,13 @@ private void drawString(MatrixStack matrixStack, String s) posX = screenWidth - stringWidth - 2; } - tr.draw(matrixStack, s, posX + 1, posY + 1, 0xff000000); - tr.draw(matrixStack, s, posX, posY, textColor | 0xff000000); + helper.method_51433(tr, s, posX + 1, posY + 1, 0xff000000, false); + helper.method_51433(tr, s, posX, posY, textColor | 0xff000000, false); posY += 9; } - private void drawWithOffset(MatrixStack matrixStack, HackListEntry e, + private void drawWithOffset(DrawableHelper helper, HackListEntry e, float partialTicks) { TextRenderer tr = WurstClient.MC.textRenderer; @@ -171,8 +171,9 @@ private void drawWithOffset(MatrixStack matrixStack, HackListEntry e, } int alpha = (int)(255 * (1 - offset / 4)) << 24; - tr.draw(matrixStack, s, posX + 1, posY + 1, 0x04000000 | alpha); - tr.draw(matrixStack, s, posX, posY, textColor | alpha); + helper.method_51433(tr, s, (int)posX + 1, posY + 1, 0x04000000 | alpha, + false); + helper.method_51433(tr, s, (int)posX, posY, textColor | alpha, false); posY += 9; } diff --git a/src/main/java/net/wurstclient/hud/IngameHUD.java b/src/main/java/net/wurstclient/hud/IngameHUD.java index 8677218b37..cd96e069bd 100644 --- a/src/main/java/net/wurstclient/hud/IngameHUD.java +++ b/src/main/java/net/wurstclient/hud/IngameHUD.java @@ -11,7 +11,7 @@ import com.mojang.blaze3d.systems.RenderSystem; -import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.client.gui.DrawableHelper; import net.wurstclient.WurstClient; import net.wurstclient.clickgui.ClickGui; import net.wurstclient.clickgui.screens.ClickGuiScreen; @@ -24,7 +24,7 @@ public final class IngameHUD implements GUIRenderListener private TabGui tabGui; @Override - public void onRenderGUI(MatrixStack matrixStack, float partialTicks) + public void onRenderGUI(DrawableHelper helper, float partialTicks) { if(!WurstClient.INSTANCE.isEnabled()) return; @@ -40,13 +40,13 @@ public void onRenderGUI(MatrixStack matrixStack, float partialTicks) clickGui.updateColors(); - wurstLogo.render(matrixStack); - hackList.render(matrixStack, partialTicks); - tabGui.render(matrixStack, partialTicks); + wurstLogo.render(helper); + hackList.render(helper, partialTicks); + tabGui.render(helper, partialTicks); // pinned windows if(!(WurstClient.MC.currentScreen instanceof ClickGuiScreen)) - clickGui.renderPinnedWindows(matrixStack, partialTicks); + clickGui.renderPinnedWindows(helper, partialTicks); // GL resets GL11.glEnable(GL11.GL_DEPTH_TEST); diff --git a/src/main/java/net/wurstclient/hud/TabGui.java b/src/main/java/net/wurstclient/hud/TabGui.java index a0c1324d56..06b0c645c5 100644 --- a/src/main/java/net/wurstclient/hud/TabGui.java +++ b/src/main/java/net/wurstclient/hud/TabGui.java @@ -16,6 +16,7 @@ import com.mojang.blaze3d.systems.RenderSystem; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.render.Tessellator; @@ -121,8 +122,9 @@ public void onKeyPress(KeyPressEvent event) } } - public void render(MatrixStack matrixStack, float partialTicks) + public void render(DrawableHelper helper, float partialTicks) { + MatrixStack matrixStack = helper.method_51448(); if(tabGuiOtf.isHidden()) return; @@ -156,8 +158,8 @@ public void render(MatrixStack matrixStack, float partialTicks) if(i == selected) tabName = (tabOpened ? "<" : ">") + tabName; - WurstClient.MC.textRenderer.draw(matrixStack, tabName, 2, textY, - txtColor); + helper.method_51433(WurstClient.MC.textRenderer, tabName, 2, textY, + txtColor, false); textY += 10; } GL11.glEnable(GL11.GL_BLEND); @@ -191,8 +193,8 @@ public void render(MatrixStack matrixStack, float partialTicks) if(i == tab.selected) fName = ">" + fName; - WurstClient.MC.textRenderer.draw(matrixStack, fName, 2, - tabTextY, txtColor); + helper.method_51433(WurstClient.MC.textRenderer, fName, 2, + tabTextY, txtColor, false); tabTextY += 10; } GL11.glEnable(GL11.GL_BLEND); diff --git a/src/main/java/net/wurstclient/hud/WurstLogo.java b/src/main/java/net/wurstclient/hud/WurstLogo.java index 30c3d3d413..d94885301b 100644 --- a/src/main/java/net/wurstclient/hud/WurstLogo.java +++ b/src/main/java/net/wurstclient/hud/WurstLogo.java @@ -29,8 +29,9 @@ public final class WurstLogo private static final Identifier texture = new Identifier("wurst", "wurst_128.png"); - public void render(MatrixStack matrixStack) + public void render(DrawableHelper helper) { + MatrixStack matrixStack = helper.method_51448(); WurstLogoOtf otf = WurstClient.INSTANCE.getOtfs().wurstLogoOtf; if(!otf.isVisible()) return; @@ -54,13 +55,12 @@ public void render(MatrixStack matrixStack) // draw version string GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_DEPTH_TEST); - tr.draw(matrixStack, version, 74, 8, otf.getTextColor()); + helper.method_51433(tr, version, 74, 8, otf.getTextColor(), false); // draw Wurst logo RenderSystem.setShaderColor(1, 1, 1, 1); GL11.glEnable(GL11.GL_BLEND); - RenderSystem.setShaderTexture(0, texture); - DrawableHelper.drawTexture(matrixStack, 0, 3, 0, 0, 72, 18, 72, 18); + helper.drawTexture(texture, 0, 3, 0, 0, 72, 18, 72, 18); } private String getVersionString() diff --git a/src/main/java/net/wurstclient/mixin/ChatHudMixin.java b/src/main/java/net/wurstclient/mixin/ChatHudMixin.java index 7e14770606..c67ee2590a 100644 --- a/src/main/java/net/wurstclient/mixin/ChatHudMixin.java +++ b/src/main/java/net/wurstclient/mixin/ChatHudMixin.java @@ -17,7 +17,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.hud.ChatHud; import net.minecraft.client.gui.hud.ChatHudLine; import net.minecraft.client.gui.hud.MessageIndicator; @@ -28,7 +27,7 @@ import net.wurstclient.events.ChatInputListener.ChatInputEvent; @Mixin(ChatHud.class) -public class ChatHudMixin extends DrawableHelper +public class ChatHudMixin { @Shadow private List visibleMessages; diff --git a/src/main/java/net/wurstclient/mixin/DisconnectedScreenMixin.java b/src/main/java/net/wurstclient/mixin/DisconnectedScreenMixin.java index 5095f35ced..6783df717a 100644 --- a/src/main/java/net/wurstclient/mixin/DisconnectedScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/DisconnectedScreenMixin.java @@ -41,7 +41,7 @@ public class DisconnectedScreenMixin extends Screen private Screen parent; @Shadow @Final - private final GridWidget field_44552 = new GridWidget(); + private final GridWidget grid = new GridWidget(); private DisconnectedScreenMixin(WurstClient wurst, Text title) { @@ -73,17 +73,17 @@ private void onInit(CallbackInfo ci) private void addReconnectButtons() { - ButtonWidget reconnectButton = field_44552.add( + ButtonWidget reconnectButton = grid.add( ButtonWidget.builder(Text.literal("Reconnect"), b -> LastServerRememberer.reconnect(parent)).build(), - 3, 0, 1, 1, field_44552.copyPositioner().margin(2).marginTop(-6)); + 3, 0, 1, 1, grid.copyPositioner().margin(2).marginTop(-6)); - autoReconnectButton = field_44552.add( + autoReconnectButton = grid.add( ButtonWidget.builder(Text.literal("AutoReconnect"), b -> pressAutoReconnect()).build(), - 4, 0, 1, 1, field_44552.copyPositioner().margin(2)); + 4, 0, 1, 1, grid.copyPositioner().margin(2)); - field_44552.refreshPositions(); + grid.refreshPositions(); Stream.of(reconnectButton, autoReconnectButton) .forEach(this::addDrawableChild); diff --git a/src/main/java/net/wurstclient/mixin/GameMenuScreenMixin.java b/src/main/java/net/wurstclient/mixin/GameMenuScreenMixin.java index 1fb745db3e..54f152b2bf 100644 --- a/src/main/java/net/wurstclient/mixin/GameMenuScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/GameMenuScreenMixin.java @@ -18,12 +18,12 @@ import com.mojang.blaze3d.systems.RenderSystem; import net.fabricmc.fabric.api.client.screen.v1.Screens; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.GameMenuScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.ClickableWidget; import net.minecraft.client.resource.language.I18n; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.Text; import net.minecraft.util.Identifier; import net.minecraft.util.crash.CrashException; @@ -44,7 +44,7 @@ private GameMenuScreenMixin(WurstClient wurst, Text text_1) super(text_1); } - @Inject(at = {@At("TAIL")}, method = {"initWidgets()V"}) + @Inject(at = @At("TAIL"), method = "initWidgets()V") private void onInitWidgets(CallbackInfo ci) { if(!WurstClient.INSTANCE.isEnabled()) @@ -110,9 +110,9 @@ private void openWurstOptions() client.setScreen(new WurstOptionsScreen(this)); } - @Inject(at = {@At("TAIL")}, - method = {"render(Lnet/minecraft/client/util/math/MatrixStack;IIF)V"}) - private void onRender(MatrixStack matrixStack, int mouseX, int mouseY, + @Inject(at = @At("TAIL"), + method = "render(Lnet/minecraft/client/gui/DrawableHelper;IIF)V") + private void onRender(DrawableHelper helper, int mouseX, int mouseY, float partialTicks, CallbackInfo ci) { if(!WurstClient.INSTANCE.isEnabled() || wurstOptionsButton == null) @@ -125,8 +125,6 @@ private void onRender(MatrixStack matrixStack, int mouseX, int mouseY, GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); RenderSystem.setShaderColor(1, 1, 1, 1); - RenderSystem.setShaderTexture(0, wurstTexture); - int x = wurstOptionsButton.getX() + 34; int y = wurstOptionsButton.getY() + 2; int w = 63; @@ -135,6 +133,6 @@ private void onRender(MatrixStack matrixStack, int mouseX, int mouseY, int fh = 16; float u = 0; float v = 0; - drawTexture(matrixStack, x, y, u, v, w, h, fw, fh); + helper.drawTexture(wurstTexture, x, y, u, v, w, h, fw, fh); } } diff --git a/src/main/java/net/wurstclient/mixin/IngameHudMixin.java b/src/main/java/net/wurstclient/mixin/IngameHudMixin.java index 5f43072f95..417e8eafe7 100644 --- a/src/main/java/net/wurstclient/mixin/IngameHudMixin.java +++ b/src/main/java/net/wurstclient/mixin/IngameHudMixin.java @@ -14,41 +14,40 @@ import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.hud.InGameHud; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.Identifier; import net.wurstclient.WurstClient; import net.wurstclient.event.EventManager; import net.wurstclient.events.GUIRenderListener.GUIRenderEvent; @Mixin(InGameHud.class) -public class IngameHudMixin extends DrawableHelper +public class IngameHudMixin { @Inject( at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;enableBlend()V", remap = false, ordinal = 3), - method = "render(Lnet/minecraft/client/util/math/MatrixStack;F)V") - private void onRender(MatrixStack matrixStack, float partialTicks, + method = "render(Lnet/minecraft/client/gui/DrawableHelper;F)V") + private void onRender(DrawableHelper helper, float partialTicks, CallbackInfo ci) { if(WurstClient.MC.options.debugEnabled) return; - GUIRenderEvent event = new GUIRenderEvent(matrixStack, partialTicks); + GUIRenderEvent event = new GUIRenderEvent(helper, partialTicks); EventManager.fire(event); } @Inject(at = @At("HEAD"), - method = "renderOverlay(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/util/Identifier;F)V", + method = "renderOverlay(Lnet/minecraft/client/gui/DrawableHelper;Lnet/minecraft/util/Identifier;F)V", cancellable = true) - private void onRenderOverlay(MatrixStack matrixStack, Identifier identifier, - float f, CallbackInfo ci) + private void onRenderOverlay(DrawableHelper helper, Identifier texture, + float opacity, CallbackInfo ci) { - if(identifier == null || identifier.getPath() == null) + if(texture == null || texture.getPath() == null) return; - if(!identifier.getPath().equals("textures/misc/pumpkinblur.png")) + if(!texture.getPath().equals("textures/misc/pumpkinblur.png")) return; if(!WurstClient.INSTANCE.getHax().noPumpkinHack.isEnabled()) diff --git a/src/main/java/net/wurstclient/mixin/ScreenMixin.java b/src/main/java/net/wurstclient/mixin/ScreenMixin.java index 36fa5fc8cb..f0dbc1602c 100644 --- a/src/main/java/net/wurstclient/mixin/ScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/ScreenMixin.java @@ -18,8 +18,8 @@ import net.minecraft.client.gui.AbstractParentElement; import net.minecraft.client.gui.Drawable; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.util.math.MatrixStack; import net.wurstclient.WurstClient; import net.wurstclient.mixinterface.IScreen; @@ -31,11 +31,10 @@ public abstract class ScreenMixin extends AbstractParentElement @Final private List drawables; - @Inject(at = {@At("HEAD")}, - method = { - "renderBackground(Lnet/minecraft/client/util/math/MatrixStack;)V"}, + @Inject(at = @At("HEAD"), + method = "renderBackground(Lnet/minecraft/client/gui/DrawableHelper;)V", cancellable = true) - public void onRenderBackground(MatrixStack matrices, CallbackInfo ci) + public void onRenderBackground(DrawableHelper helper, CallbackInfo ci) { if(WurstClient.INSTANCE.getHax().noBackgroundHack .shouldCancelBackground((Screen)(Object)this)) diff --git a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java index 5297484e74..187f0eeda4 100644 --- a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java @@ -55,7 +55,7 @@ private void onCreateButtons(CallbackInfo ci) .equals(I18n.translate("gui.done"))) continue; - button.method_46421(width / 2 + 2); + button.setX(width / 2 + 2); button.setWidth(150); } } diff --git a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java index 87f2248691..28488e077b 100644 --- a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java @@ -77,7 +77,7 @@ private void onTick(CallbackInfo ci) // adjust AltManager button if Realms button has been moved // happens when ModMenu is installed - altsButton.method_46419(realmsButton.getY()); + altsButton.setY(realmsButton.getY()); } /** diff --git a/src/main/java/net/wurstclient/navigator/NavigatorFeatureScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorFeatureScreen.java index a6f9a6bf36..69cb48293b 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorFeatureScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorFeatureScreen.java @@ -22,6 +22,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.gui.Drawable; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.ClickableWidget; import net.minecraft.client.render.BufferBuilder; @@ -318,14 +319,15 @@ protected void onUpdate() } @Override - protected void onRender(MatrixStack matrixStack, int mouseX, int mouseY, + protected void onRender(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { + MatrixStack matrixStack = helper.method_51448(); ClickGui gui = WurstClient.INSTANCE.getGui(); int txtColor = gui.getTxtColor(); // title bar - drawCenteredTextWithShadow(matrixStack, client.textRenderer, + helper.drawCenteredTextWithShadow(client.textRenderer, feature.getName(), middleX, 32, txtColor); GL11.glEnable(GL11.GL_BLEND); @@ -431,8 +433,8 @@ protected void onRender(MatrixStack matrixStack, int mouseX, int mouseY, } for(int i = 0; i < window.countChildren(); i++) - window.getChild(i).render(matrixStack, mouseX - bgx1, - mouseY - windowY, partialTicks); + window.getChild(i).render(helper, mouseX - bgx1, mouseY - windowY, + partialTicks); matrixStack.pop(); // buttons @@ -463,7 +465,7 @@ else if(mouseX >= x1 && mouseX <= x2 && mouseY >= y1 drawBox(matrixStack, x1, y1, x2, y2); // text - drawCenteredTextWithShadow(matrixStack, client.textRenderer, + helper.drawCenteredTextWithShadow(client.textRenderer, buttonData.buttonText, (x1 + x2) / 2, y1 + (buttonData.height - 10) / 2 + 1, buttonData.isLocked() ? 0xaaaaaa : buttonData.textColor); @@ -474,8 +476,8 @@ else if(mouseX >= x1 && mouseX <= x2 && mouseY >= y1 int textY = bgy1 + scroll + 2; for(String line : text.split("\n")) { - client.textRenderer.draw(matrixStack, line, bgx1 + 2, textY, - txtColor); + helper.method_51433(client.textRenderer, line, bgx1 + 2, textY, + txtColor, false); textY += client.textRenderer.fontHeight; } GL11.glEnable(GL11.GL_BLEND); @@ -517,15 +519,15 @@ else if(hovering) // text String buttonText = button.getMessage().getString(); - client.textRenderer.draw(matrixStack, buttonText, + helper.method_51433(client.textRenderer, buttonText, (x1 + x2 - client.textRenderer.getWidth(buttonText)) / 2, - y1 + 5, txtColor); + y1 + 5, txtColor, false); GL11.glEnable(GL11.GL_BLEND); } // popups & tooltip - gui.renderPopups(matrixStack, mouseX, mouseY); - gui.renderTooltip(matrixStack, mouseX, mouseY); + gui.renderPopups(helper, mouseX, mouseY); + gui.renderTooltip(helper, mouseX, mouseY); // GL resets GL11.glEnable(GL11.GL_CULL_FACE); diff --git a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java index 0ebbbc4b05..ab6690b6fd 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java @@ -17,6 +17,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.TextFieldWidget; import net.minecraft.client.render.BufferBuilder; @@ -73,7 +74,7 @@ protected void onResize() setFocused(searchBar); searchBar.setFocused(true); - searchBar.method_46421(middleX - 100); + searchBar.setX(middleX - 100); setContentHeight(navigatorDisplayList.size() / 3 * 20); } @@ -227,9 +228,10 @@ public void mouseMoved(double mouseX, double mouseY) } @Override - protected void onRender(MatrixStack matrixStack, int mouseX, int mouseY, + protected void onRender(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { + MatrixStack matrixStack = helper.method_51448(); ClickGui gui = WurstClient.INSTANCE.getGui(); float[] bgColor = gui.getBgColor(); float[] acColor = gui.getAcColor(); @@ -242,9 +244,9 @@ protected void onRender(MatrixStack matrixStack, int mouseX, int mouseY, if(!clickTimerRunning) { RenderSystem.setShaderColor(1, 1, 1, 1); - WurstClient.MC.textRenderer.drawWithShadow(matrixStack, "Search: ", + helper.drawTextWithShadow(WurstClient.MC.textRenderer, "Search: ", middleX - 150, 32, txtColor); - searchBar.render(matrixStack, mouseX, mouseY, partialTicks); + searchBar.render(helper, mouseX, mouseY, partialTicks); GL11.glEnable(GL11.GL_BLEND); } @@ -267,8 +269,8 @@ protected void onRender(MatrixStack matrixStack, int mouseX, int mouseY, if(featureY > height - 40) break; - renderFeature(matrixStack, mouseX, mouseY, partialTicks, i, - featureX, featureY); + renderFeature(helper, mouseX, mouseY, partialTicks, i, featureX, + featureY); } GL11.glDisable(GL11.GL_SCISSOR_TEST); @@ -277,13 +279,13 @@ protected void onRender(MatrixStack matrixStack, int mouseX, int mouseY, if(tooltip != null) { String[] lines = tooltip.split("\n"); - TextRenderer fr = client.textRenderer; + TextRenderer tr = client.textRenderer; int tw = 0; - int th = lines.length * fr.fontHeight; + int th = lines.length * tr.fontHeight; for(String line : lines) { - int lw = fr.getWidth(line); + int lw = tr.getWidth(line); if(lw > tw) tw = lw; } @@ -327,14 +329,15 @@ protected void onRender(MatrixStack matrixStack, int mouseX, int mouseY, // text for(int i = 0; i < lines.length; i++) - fr.draw(matrixStack, lines[i], xt1 + 2, - yt1 + 2 + i * fr.fontHeight, txtColor); + helper.method_51433(tr, lines[i], xt1 + 2, + yt1 + 2 + i * tr.fontHeight, txtColor, false); } } - private void renderFeature(MatrixStack matrixStack, int mouseX, int mouseY, + private void renderFeature(DrawableHelper helper, int mouseX, int mouseY, float partialTicks, int i, int x, int y) { + MatrixStack matrixStack = helper.method_51448(); ClickGui gui = WurstClient.INSTANCE.getGui(); float[] bgColor = gui.getBgColor(); int txtColor = gui.getTxtColor(); @@ -472,8 +475,8 @@ else if(clickTimer == 0) RenderSystem.setShader(GameRenderer::getPositionProgram); RenderSystem.setShaderColor(1, 1, 1, 1); String buttonText = feature.getName(); - client.textRenderer.draw(matrixStack, buttonText, area.x + 4, - area.y + 4, txtColor); + helper.method_51433(client.textRenderer, buttonText, area.x + 4, + area.y + 4, txtColor, false); GL11.glEnable(GL11.GL_BLEND); } } diff --git a/src/main/java/net/wurstclient/navigator/NavigatorNewKeybindScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorNewKeybindScreen.java index 1518c7aa19..e98cb71f9a 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorNewKeybindScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorNewKeybindScreen.java @@ -16,6 +16,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.gui.Drawable; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.ClickableWidget; import net.minecraft.client.util.InputUtil; @@ -156,15 +157,16 @@ protected void onUpdate() } @Override - protected void onRender(MatrixStack matrixStack, int mouseX, int mouseY, + protected void onRender(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { + MatrixStack matrixStack = helper.method_51448(); ClickGui gui = WurstClient.INSTANCE.getGui(); int txtColor = gui.getTxtColor(); // title bar - drawCenteredTextWithShadow(matrixStack, client.textRenderer, - "New Keybind", middleX, 32, txtColor); + helper.drawCenteredTextWithShadow(client.textRenderer, "New Keybind", + middleX, 32, txtColor); GL11.glEnable(GL11.GL_BLEND); // background @@ -212,11 +214,10 @@ protected void onRender(MatrixStack matrixStack, int mouseX, int mouseY, drawBox(matrixStack, x1, y1, x2, y2); // text - drawTextWithShadow(matrixStack, client.textRenderer, + helper.drawTextWithShadow(client.textRenderer, pkb.getDescription(), x1 + 1, y1 + 1, txtColor); - drawTextWithShadow(matrixStack, client.textRenderer, - pkb.getCommand(), x1 + 1, - y1 + 1 + client.textRenderer.fontHeight, txtColor); + helper.drawTextWithShadow(client.textRenderer, pkb.getCommand(), + x1 + 1, y1 + 1 + client.textRenderer.fontHeight, txtColor); GL11.glEnable(GL11.GL_BLEND); } } @@ -225,7 +226,7 @@ protected void onRender(MatrixStack matrixStack, int mouseX, int mouseY, int textY = bgy1 + scroll + 2; for(String line : text.split("\n")) { - drawTextWithShadow(matrixStack, client.textRenderer, line, bgx1 + 2, + helper.drawTextWithShadow(client.textRenderer, line, bgx1 + 2, textY, txtColor); textY += client.textRenderer.fontHeight; } @@ -261,7 +262,7 @@ else if(mouseX >= x1 && mouseX <= x2 && mouseY >= y1 drawBox(matrixStack, x1, y1, x2, y2); // text - drawCenteredTextWithShadow(matrixStack, client.textRenderer, + helper.drawCenteredTextWithShadow(client.textRenderer, button.getMessage().getString(), (x1 + x2) / 2, y1 + 5, txtColor); GL11.glEnable(GL11.GL_BLEND); diff --git a/src/main/java/net/wurstclient/navigator/NavigatorRemoveKeybindScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorRemoveKeybindScreen.java index d8caf8d2c4..5b7d762e19 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorRemoveKeybindScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorRemoveKeybindScreen.java @@ -18,6 +18,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.gui.Drawable; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.ClickableWidget; import net.minecraft.client.util.math.MatrixStack; @@ -128,15 +129,16 @@ protected void onUpdate() } @Override - protected void onRender(MatrixStack matrixStack, int mouseX, int mouseY, + protected void onRender(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { + MatrixStack matrixStack = helper.method_51448(); ClickGui gui = WurstClient.INSTANCE.getGui(); int txtColor = gui.getTxtColor(); // title bar - drawCenteredTextWithShadow(matrixStack, client.textRenderer, - "Remove Keybind", middleX, 32, txtColor); + helper.drawCenteredTextWithShadow(client.textRenderer, "Remove Keybind", + middleX, 32, txtColor); GL11.glEnable(GL11.GL_BLEND); // background @@ -182,13 +184,12 @@ protected void onRender(MatrixStack matrixStack, int mouseX, int mouseY, drawBox(matrixStack, x1, y1, x2, y2); // text - drawTextWithShadow(matrixStack, client.textRenderer, + helper.drawTextWithShadow(client.textRenderer, key.replace("key.keyboard.", "") + ": " + keybind.getDescription(), x1 + 1, y1 + 1, txtColor); - drawTextWithShadow(matrixStack, client.textRenderer, - keybind.getCommand(), x1 + 1, - y1 + 1 + client.textRenderer.fontHeight, txtColor); + helper.drawTextWithShadow(client.textRenderer, keybind.getCommand(), + x1 + 1, y1 + 1 + client.textRenderer.fontHeight, txtColor); GL11.glEnable(GL11.GL_BLEND); } @@ -196,7 +197,7 @@ protected void onRender(MatrixStack matrixStack, int mouseX, int mouseY, int textY = bgy1 + scroll + 2; for(String line : text.split("\n")) { - drawTextWithShadow(matrixStack, client.textRenderer, line, bgx1 + 2, + helper.drawTextWithShadow(client.textRenderer, line, bgx1 + 2, textY, txtColor); textY += client.textRenderer.fontHeight; } @@ -232,7 +233,7 @@ else if(mouseX >= x1 && mouseX <= x2 && mouseY >= y1 drawBox(matrixStack, x1, y1, x2, y2); // text - drawCenteredTextWithShadow(matrixStack, client.textRenderer, + helper.drawCenteredTextWithShadow(client.textRenderer, button.getMessage().getString(), (x1 + x2) / 2, y1 + 5, txtColor); GL11.glEnable(GL11.GL_BLEND); diff --git a/src/main/java/net/wurstclient/navigator/NavigatorScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorScreen.java index 814a5eeae1..b08a07f862 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorScreen.java @@ -14,6 +14,7 @@ import com.mojang.blaze3d.systems.RenderSystem; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; @@ -142,9 +143,11 @@ public final void tick() } @Override - public final void render(MatrixStack matrixStack, int mouseX, int mouseY, + public final void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { + MatrixStack matrixStack = helper.method_51448(); + // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); @@ -180,7 +183,7 @@ public final void render(MatrixStack matrixStack, int mouseX, int mouseY, drawDownShadow(matrixStack, x1, y1, x2, y2); } - onRender(matrixStack, mouseX, mouseY, partialTicks); + onRender(helper, mouseX, mouseY, partialTicks); // GL resets GL11.glEnable(GL11.GL_CULL_FACE); @@ -206,7 +209,7 @@ protected abstract void onMouseDrag(double mouseX, double mouseY, protected abstract void onUpdate(); - protected abstract void onRender(MatrixStack matrixStack, int mouseX, + protected abstract void onRender(DrawableHelper helper, int mouseX, int mouseY, float partialTicks); protected final int getStringHeight(String s) diff --git a/src/main/java/net/wurstclient/nochatreports/ForcedChatReportsScreen.java b/src/main/java/net/wurstclient/nochatreports/ForcedChatReportsScreen.java index 1c7736ff08..9918364e24 100644 --- a/src/main/java/net/wurstclient/nochatreports/ForcedChatReportsScreen.java +++ b/src/main/java/net/wurstclient/nochatreports/ForcedChatReportsScreen.java @@ -15,7 +15,6 @@ import net.minecraft.client.gui.DrawableHelper; 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.LiteralTextContent; import net.minecraft.text.Text; import net.minecraft.text.TranslatableTextContent; @@ -102,20 +101,20 @@ private void toggleSignatures() } @Override - public void render(MatrixStack matrices, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float delta) { - renderBackground(matrices); + renderBackground(helper); int centerX = width / 2; int reasonY = (height - 68) / 2 - reasonHeight / 2; int titleY = reasonY - textRenderer.fontHeight * 2; - DrawableHelper.drawCenteredTextWithShadow(matrices, textRenderer, title, - centerX, titleY, 0xAAAAAA); - reasonFormatted.drawCenterWithShadow(matrices, centerX, reasonY); + helper.drawCenteredTextWithShadow(textRenderer, title, centerX, titleY, + 0xAAAAAA); + reasonFormatted.drawCenterWithShadow(helper, centerX, reasonY); - super.render(matrices, mouseX, mouseY, delta); + super.render(helper, mouseX, mouseY, delta); } @Override diff --git a/src/main/java/net/wurstclient/nochatreports/NcrModRequiredScreen.java b/src/main/java/net/wurstclient/nochatreports/NcrModRequiredScreen.java index 7b9e694228..695fa6ccaa 100644 --- a/src/main/java/net/wurstclient/nochatreports/NcrModRequiredScreen.java +++ b/src/main/java/net/wurstclient/nochatreports/NcrModRequiredScreen.java @@ -15,7 +15,6 @@ import net.minecraft.client.gui.DrawableHelper; 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.StringHelper; import net.wurstclient.WurstClient; @@ -118,20 +117,20 @@ private void toggleVanillaSpoof() } @Override - public void render(MatrixStack matrices, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float delta) { - renderBackground(matrices); + renderBackground(helper); int centerX = width / 2; int reasonY = (height - 68) / 2 - reasonHeight / 2; int titleY = reasonY - textRenderer.fontHeight * 2; - DrawableHelper.drawCenteredTextWithShadow(matrices, textRenderer, title, - centerX, titleY, 0xAAAAAA); - reasonFormatted.drawCenterWithShadow(matrices, centerX, reasonY); + helper.drawCenteredTextWithShadow(textRenderer, title, centerX, titleY, + 0xAAAAAA); + reasonFormatted.drawCenterWithShadow(helper, centerX, reasonY); - super.render(matrices, mouseX, mouseY, delta); + super.render(helper, mouseX, mouseY, delta); } @Override diff --git a/src/main/java/net/wurstclient/options/EnterProfileNameScreen.java b/src/main/java/net/wurstclient/options/EnterProfileNameScreen.java index 9ec3149232..7804ea79db 100644 --- a/src/main/java/net/wurstclient/options/EnterProfileNameScreen.java +++ b/src/main/java/net/wurstclient/options/EnterProfileNameScreen.java @@ -12,10 +12,10 @@ import org.lwjgl.glfw.GLFW; import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.Text; public final class EnterProfileNameScreen extends Screen @@ -88,15 +88,15 @@ public void tick() } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { - renderBackground(matrixStack); - drawCenteredTextWithShadow(matrixStack, client.textRenderer, + renderBackground(helper); + helper.drawCenteredTextWithShadow(client.textRenderer, "Name your new profile", width / 2, 20, 0xFFFFFF); - valueField.render(matrixStack, mouseX, mouseY, partialTicks); - super.render(matrixStack, mouseX, mouseY, partialTicks); + valueField.render(helper, mouseX, mouseY, partialTicks); + super.render(helper, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/options/KeybindEditorScreen.java b/src/main/java/net/wurstclient/options/KeybindEditorScreen.java index f87246da6d..0be5f364a0 100644 --- a/src/main/java/net/wurstclient/options/KeybindEditorScreen.java +++ b/src/main/java/net/wurstclient/options/KeybindEditorScreen.java @@ -7,10 +7,10 @@ */ package net.wurstclient.options; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.Text; import net.wurstclient.WurstClient; @@ -94,23 +94,23 @@ public void tick() } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { - renderBackground(matrixStack); + renderBackground(helper); - drawCenteredTextWithShadow(matrixStack, textRenderer, + helper.drawCenteredTextWithShadow(textRenderer, (oldKey != null ? "Edit" : "Add") + " Keybind", width / 2, 20, 0xffffff); - drawTextWithShadow(matrixStack, textRenderer, + helper.drawTextWithShadow(textRenderer, "Key: " + key.replace("key.keyboard.", ""), width / 2 - 100, 47, 0xa0a0a0); - drawTextWithShadow(matrixStack, textRenderer, - "Commands (separated by ';')", width / 2 - 100, 87, 0xa0a0a0); + helper.drawTextWithShadow(textRenderer, "Commands (separated by ';')", + width / 2 - 100, 87, 0xa0a0a0); - commandField.render(matrixStack, mouseX, mouseY, partialTicks); - super.render(matrixStack, mouseX, mouseY, partialTicks); + commandField.render(helper, mouseX, mouseY, partialTicks); + super.render(helper, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/options/KeybindManagerScreen.java b/src/main/java/net/wurstclient/options/KeybindManagerScreen.java index 016523b66e..b693a2276b 100644 --- a/src/main/java/net/wurstclient/options/KeybindManagerScreen.java +++ b/src/main/java/net/wurstclient/options/KeybindManagerScreen.java @@ -10,10 +10,10 @@ import org.lwjgl.glfw.GLFW; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.ConfirmScreen; 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.wurstclient.WurstClient; import net.wurstclient.keybinds.Keybind; @@ -163,18 +163,18 @@ public void tick() } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { - renderBackground(matrixStack); - listGui.render(matrixStack, mouseX, mouseY, partialTicks); + renderBackground(helper); + listGui.render(helper, mouseX, mouseY, partialTicks); - drawCenteredTextWithShadow(matrixStack, textRenderer, "Keybind Manager", + helper.drawCenteredTextWithShadow(textRenderer, "Keybind Manager", width / 2, 8, 0xffffff); - drawCenteredTextWithShadow(matrixStack, textRenderer, + helper.drawCenteredTextWithShadow(textRenderer, "Keybinds: " + listGui.getItemCount(), width / 2, 20, 0xffffff); - super.render(matrixStack, mouseX, mouseY, partialTicks); + super.render(helper, mouseX, mouseY, partialTicks); } @Override @@ -222,17 +222,18 @@ protected void renderBackground() } @Override - protected void renderItem(MatrixStack matrixStack, int index, int x, + protected void renderItem(DrawableHelper helper, int index, int x, int y, int slotHeight, int mouseX, int mouseY, float partialTicks) { Keybind keybind = WurstClient.INSTANCE.getKeybinds().getAllKeybinds().get(index); - client.textRenderer.draw(matrixStack, + helper.method_51433(client.textRenderer, "Key: " + keybind.getKey().replace("key.keyboard.", ""), x + 3, - y + 3, 0xa0a0a0); - client.textRenderer.draw(matrixStack, - "Commands: " + keybind.getCommands(), x + 3, y + 15, 0xa0a0a0); + y + 3, 0xa0a0a0, false); + helper.method_51433(client.textRenderer, + "Commands: " + keybind.getCommands(), x + 3, y + 15, 0xa0a0a0, + false); } } } diff --git a/src/main/java/net/wurstclient/options/KeybindProfilesScreen.java b/src/main/java/net/wurstclient/options/KeybindProfilesScreen.java index 6c5fc30d75..8b29b38132 100644 --- a/src/main/java/net/wurstclient/options/KeybindProfilesScreen.java +++ b/src/main/java/net/wurstclient/options/KeybindProfilesScreen.java @@ -17,9 +17,9 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawableHelper; 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; import net.wurstclient.WurstClient; @@ -170,19 +170,19 @@ public void tick() } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { - renderBackground(matrixStack); - listGui.render(matrixStack, mouseX, mouseY, partialTicks); + renderBackground(helper); + listGui.render(helper, mouseX, mouseY, partialTicks); - drawCenteredTextWithShadow(matrixStack, client.textRenderer, + helper.drawCenteredTextWithShadow(client.textRenderer, "Keybind Profiles", width / 2, 12, 0xffffff); - super.render(matrixStack, mouseX, mouseY, partialTicks); + super.render(helper, mouseX, mouseY, partialTicks); if(loadButton.isSelected() && !loadButton.active) - renderTooltip(matrixStack, + helper.method_51434(textRenderer, Arrays.asList(Text.literal("You must first select a file.")), mouseX, mouseY); } @@ -236,14 +236,20 @@ protected void renderBackground() } @Override - protected void renderItem(MatrixStack matrixStack, int index, int x, + protected void renderItem(DrawableHelper helper, int index, int x, int y, int var4, int var5, int var6, float partialTicks) { - TextRenderer fr = mc.textRenderer; + TextRenderer tr = mc.textRenderer; Path path = list.get(index); - fr.draw(matrixStack, "" + path.getFileName(), x + 28, y, 0xf0f0f0); - fr.draw(matrixStack, + // tr.draw(matrixStack, "" + path.getFileName(), x + 28, y, + // 0xf0f0f0); + helper.drawTextWithShadow(tr, "" + path.getFileName(), x + 28, y, + 0xf0f0f0); + // tr.draw(matrixStack, "" + + // client.runDirectory.toPath().relativize(path), x + 28, y + 9, + // 0xa0a0a0); + helper.drawTextWithShadow(tr, "" + client.runDirectory.toPath().relativize(path), x + 28, y + 9, 0xa0a0a0); } diff --git a/src/main/java/net/wurstclient/options/PressAKeyScreen.java b/src/main/java/net/wurstclient/options/PressAKeyScreen.java index 0258413e3f..aa425a4624 100644 --- a/src/main/java/net/wurstclient/options/PressAKeyScreen.java +++ b/src/main/java/net/wurstclient/options/PressAKeyScreen.java @@ -9,9 +9,9 @@ import org.lwjgl.glfw.GLFW; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.util.InputUtil; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.Text; public class PressAKeyScreen extends Screen @@ -50,12 +50,12 @@ public boolean shouldCloseOnEsc() } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { - renderBackground(matrixStack); - drawCenteredTextWithShadow(matrixStack, textRenderer, "Press a key", + renderBackground(helper); + helper.drawCenteredTextWithShadow(textRenderer, "Press a key", width / 2, height / 4 + 48, 16777215); - super.render(matrixStack, mouseX, mouseY, partialTicks); + super.render(helper, mouseX, mouseY, partialTicks); } } diff --git a/src/main/java/net/wurstclient/options/WurstOptionsScreen.java b/src/main/java/net/wurstclient/options/WurstOptionsScreen.java index 18d1c06fe0..156b066d58 100644 --- a/src/main/java/net/wurstclient/options/WurstOptionsScreen.java +++ b/src/main/java/net/wurstclient/options/WurstOptionsScreen.java @@ -13,10 +13,10 @@ import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.Drawable; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.ClickableWidget; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.Text; import net.minecraft.util.Util; import net.minecraft.util.Util.OperatingSystem; @@ -146,34 +146,34 @@ public void close() } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { - renderBackground(matrixStack); - renderTitles(matrixStack); - super.render(matrixStack, mouseX, mouseY, partialTicks); - renderButtonTooltip(matrixStack, mouseX, mouseY); + renderBackground(helper); + renderTitles(helper); + super.render(helper, mouseX, mouseY, partialTicks); + renderButtonTooltip(helper, mouseX, mouseY); } - private void renderTitles(MatrixStack matrixStack) + private void renderTitles(DrawableHelper helper) { TextRenderer tr = client.textRenderer; int middleX = width / 2; int y1 = 40; int y2 = height / 4 + 24 - 28; - drawCenteredTextWithShadow(matrixStack, tr, "Wurst Options", middleX, - y1, 0xffffff); + helper.drawCenteredTextWithShadow(tr, "Wurst Options", middleX, y1, + 0xffffff); - drawCenteredTextWithShadow(matrixStack, tr, "Settings", middleX - 104, - y2, 0xcccccc); - drawCenteredTextWithShadow(matrixStack, tr, "Managers", middleX, y2, + helper.drawCenteredTextWithShadow(tr, "Settings", middleX - 104, y2, 0xcccccc); - drawCenteredTextWithShadow(matrixStack, tr, "Links", middleX + 104, y2, + helper.drawCenteredTextWithShadow(tr, "Managers", middleX, y2, + 0xcccccc); + helper.drawCenteredTextWithShadow(tr, "Links", middleX + 104, y2, 0xcccccc); } - private void renderButtonTooltip(MatrixStack matrixStack, int mouseX, + private void renderButtonTooltip(DrawableHelper helper, int mouseX, int mouseY) { for(Drawable d : ((IScreen)this).getButtons()) @@ -191,7 +191,7 @@ private void renderButtonTooltip(MatrixStack matrixStack, int mouseX, if(woButton.tooltip.isEmpty()) continue; - renderTooltip(matrixStack, woButton.tooltip, mouseX, mouseY); + helper.method_51434(textRenderer, woButton.tooltip, mouseX, mouseY); break; } } diff --git a/src/main/java/net/wurstclient/options/ZoomManagerScreen.java b/src/main/java/net/wurstclient/options/ZoomManagerScreen.java index bcd30a0d7a..22246d4d46 100644 --- a/src/main/java/net/wurstclient/options/ZoomManagerScreen.java +++ b/src/main/java/net/wurstclient/options/ZoomManagerScreen.java @@ -7,11 +7,11 @@ */ package net.wurstclient.options; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.option.KeyBinding; import net.minecraft.client.util.InputUtil; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.Text; import net.wurstclient.WurstClient; import net.wurstclient.other_features.ZoomOtf; @@ -94,20 +94,20 @@ public void close() } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { ZoomOtf zoom = WurstClient.INSTANCE.getOtfs().zoomOtf; SliderSetting level = zoom.getLevelSetting(); - renderBackground(matrixStack); - drawCenteredTextWithShadow(matrixStack, textRenderer, "Zoom Manager", + renderBackground(helper); + helper.drawCenteredTextWithShadow(textRenderer, "Zoom Manager", width / 2, 40, 0xffffff); - drawTextWithShadow(matrixStack, textRenderer, + helper.drawTextWithShadow(textRenderer, "Zoom Level: " + level.getValueString(), width / 2 - 75, height / 4 + 44, 0xcccccc); - super.render(matrixStack, mouseX, mouseY, partialTicks); + super.render(helper, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/serverfinder/CleanUpScreen.java b/src/main/java/net/wurstclient/serverfinder/CleanUpScreen.java index d87cb8d532..5f802849ea 100644 --- a/src/main/java/net/wurstclient/serverfinder/CleanUpScreen.java +++ b/src/main/java/net/wurstclient/serverfinder/CleanUpScreen.java @@ -15,13 +15,13 @@ import net.minecraft.SharedConstants; import net.minecraft.client.gui.Drawable; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen; import net.minecraft.client.gui.screen.multiplayer.MultiplayerServerListWidget; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.ClickableWidget; import net.minecraft.client.network.ServerInfo; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.Text; import net.wurstclient.mixinterface.IMultiplayerScreen; import net.wurstclient.mixinterface.IScreen; @@ -201,21 +201,21 @@ public boolean keyPressed(int keyCode, int scanCode, int int_3) } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { - renderBackground(matrixStack); - drawCenteredTextWithShadow(matrixStack, textRenderer, "Clean Up", - width / 2, 20, 16777215); - drawCenteredTextWithShadow(matrixStack, textRenderer, + renderBackground(helper); + helper.drawCenteredTextWithShadow(textRenderer, "Clean Up", width / 2, + 20, 16777215); + helper.drawCenteredTextWithShadow(textRenderer, "Please select the servers you want to remove:", width / 2, 36, 10526880); - super.render(matrixStack, mouseX, mouseY, partialTicks); - renderButtonTooltip(matrixStack, mouseX, mouseY); + super.render(helper, mouseX, mouseY, partialTicks); + renderButtonTooltip(helper, mouseX, mouseY); } - private void renderButtonTooltip(MatrixStack matrixStack, int mouseX, + private void renderButtonTooltip(DrawableHelper helper, int mouseX, int mouseY) { for(Drawable d : ((IScreen)this).getButtons()) @@ -233,7 +233,7 @@ private void renderButtonTooltip(MatrixStack matrixStack, int mouseX, if(cuButton.tooltip.isEmpty()) continue; - renderTooltip(matrixStack, cuButton.tooltip, mouseX, mouseY); + helper.method_51434(textRenderer, cuButton.tooltip, mouseX, mouseY); break; } } diff --git a/src/main/java/net/wurstclient/serverfinder/ServerFinderScreen.java b/src/main/java/net/wurstclient/serverfinder/ServerFinderScreen.java index 94a1f2da4c..179693b606 100644 --- a/src/main/java/net/wurstclient/serverfinder/ServerFinderScreen.java +++ b/src/main/java/net/wurstclient/serverfinder/ServerFinderScreen.java @@ -13,12 +13,12 @@ import org.lwjgl.glfw.GLFW; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; import net.minecraft.client.network.ServerInfo; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.Text; import net.minecraft.util.Util; import net.wurstclient.mixinterface.IMultiplayerScreen; @@ -214,41 +214,41 @@ public boolean keyPressed(int keyCode, int scanCode, int int_3) } @Override - public void render(MatrixStack matrixStack, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float partialTicks) { - renderBackground(matrixStack); + renderBackground(helper); - drawCenteredTextWithShadow(matrixStack, textRenderer, "Server Finder", + helper.drawCenteredTextWithShadow(textRenderer, "Server Finder", width / 2, 20, 16777215); - drawCenteredTextWithShadow(matrixStack, textRenderer, + helper.drawCenteredTextWithShadow(textRenderer, "This will search for servers with similar IPs", width / 2, 40, 10526880); - drawCenteredTextWithShadow(matrixStack, textRenderer, + helper.drawCenteredTextWithShadow(textRenderer, "to the IP you type into the field below.", width / 2, 50, 10526880); - drawCenteredTextWithShadow(matrixStack, textRenderer, + helper.drawCenteredTextWithShadow(textRenderer, "The servers it finds will be added to your server list.", width / 2, 60, 10526880); - drawTextWithShadow(matrixStack, textRenderer, "Server address:", + helper.drawTextWithShadow(textRenderer, "Server address:", width / 2 - 100, height / 4 + 24, 10526880); - ipBox.render(matrixStack, mouseX, mouseY, partialTicks); + ipBox.render(helper, mouseX, mouseY, partialTicks); - drawTextWithShadow(matrixStack, textRenderer, "Max. threads:", + helper.drawTextWithShadow(textRenderer, "Max. threads:", width / 2 - 100, height / 4 + 60, 10526880); - maxThreadsBox.render(matrixStack, mouseX, mouseY, partialTicks); + maxThreadsBox.render(helper, mouseX, mouseY, partialTicks); - drawCenteredTextWithShadow(matrixStack, textRenderer, state.toString(), + helper.drawCenteredTextWithShadow(textRenderer, state.toString(), width / 2, height / 4 + 73, 10526880); - drawTextWithShadow(matrixStack, textRenderer, + helper.drawTextWithShadow(textRenderer, "Checked: " + checked + " / 1792", width / 2 - 100, height / 4 + 84, 10526880); - drawTextWithShadow(matrixStack, textRenderer, "Working: " + working, + helper.drawTextWithShadow(textRenderer, "Working: " + working, width / 2 - 100, height / 4 + 94, 10526880); - super.render(matrixStack, mouseX, mouseY, partialTicks); + super.render(helper, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/util/BlockPlacer.java b/src/main/java/net/wurstclient/util/BlockPlacer.java index 91144943e5..b7eebd44b7 100644 --- a/src/main/java/net/wurstclient/util/BlockPlacer.java +++ b/src/main/java/net/wurstclient/util/BlockPlacer.java @@ -57,7 +57,7 @@ public static BlockPlacingParams getBlockPlacingParams(BlockPos pos) // if there is a replaceable block at the position, we need to place // against the block itself instead of a neighbor if(BlockUtils.canBeClicked(pos) - && BlockUtils.getState(pos).getMaterial().isReplaceable()) + && BlockUtils.getState(pos).isReplaceable()) { // the parameters for this happen to be the same as for breaking // the block, so we can just use BlockBreaker to get them @@ -84,7 +84,7 @@ public static BlockPlacingParams getBlockPlacingParams(BlockPos pos) VoxelShape shape = state.getOutlineShape(MC.world, neighbor); // if neighbor has no shape or is replaceable, it can't be used - if(shape.isEmpty() || state.getMaterial().isReplaceable()) + if(shape.isEmpty() || state.isReplaceable()) continue; Vec3d relCenter = shape.getBoundingBox().getCenter(); diff --git a/src/main/java/net/wurstclient/util/ListWidget.java b/src/main/java/net/wurstclient/util/ListWidget.java index 7ea2c82bf5..f012a25365 100644 --- a/src/main/java/net/wurstclient/util/ListWidget.java +++ b/src/main/java/net/wurstclient/util/ListWidget.java @@ -21,6 +21,7 @@ import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.Element; +import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.render.Tessellator; @@ -93,7 +94,7 @@ protected int getMaxPosition() protected void updateItemPosition(int index, int x, int y, float delta) {} - protected abstract void renderItem(MatrixStack matrixStack, int x, int y, + protected abstract void renderItem(DrawableHelper helper, int x, int y, int itemHeight, int mouseX, int mouseY, int i, float f); protected void renderHeader(int x, int y, Tessellator tessellator) @@ -133,7 +134,7 @@ public boolean isMouseInList(double mouseX, double mouseY) } @Override - public void render(MatrixStack matrices, int mouseX, int mouseY, + public void render(DrawableHelper helper, int mouseX, int mouseY, float delta) { if(visible) @@ -144,8 +145,7 @@ public void render(MatrixStack matrices, int mouseX, int mouseY, capYPosition(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferBuilder = tessellator.getBuffer(); - RenderSystem.setShaderTexture(0, - DrawableHelper.OPTIONS_BACKGROUND_TEXTURE); + RenderSystem.setShaderTexture(0, Screen.field_44669); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.setShader(GameRenderer::getPositionTexColorProgram); bufferBuilder.begin(VertexFormat.DrawMode.QUADS, @@ -168,7 +168,7 @@ public void render(MatrixStack matrices, int mouseX, int mouseY, if(renderHeader) renderHeader(k, l, tessellator); - renderList(matrices, k, l, mouseX, mouseY, delta); + renderList(helper, k, l, mouseX, mouseY, delta); RenderSystem.disableDepthTest(); renderHoleBackground(0, top, 255, 255); renderHoleBackground(bottom, height, 255, 255); @@ -374,8 +374,8 @@ public int getRowWidth() return 220; } - protected void renderList(MatrixStack matrixStack, int i, int j, int k, - int l, float f) + protected void renderList(DrawableHelper helper, int i, int j, int k, int l, + float f) { int m = getItemCount(); Tessellator tessellator = Tessellator.getInstance(); @@ -414,7 +414,7 @@ protected void renderList(MatrixStack matrixStack, int i, int j, int k, } RenderSystem.setShaderColor(1, 1, 1, 1); - renderItem(matrixStack, n, i, o, p, k, l, f); + renderItem(helper, n, i, o, p, k, l, f); } } @@ -435,8 +435,7 @@ protected void renderHoleBackground(int top, int bottom, int topAlpha, { Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferBuilder = tessellator.getBuffer(); - RenderSystem.setShaderTexture(0, - DrawableHelper.OPTIONS_BACKGROUND_TEXTURE); + RenderSystem.setShaderTexture(0, Screen.field_44669); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.setShader(GameRenderer::getPositionTexColorProgram); bufferBuilder.begin(VertexFormat.DrawMode.QUADS, diff --git a/src/main/java/net/wurstclient/util/RenderUtils.java b/src/main/java/net/wurstclient/util/RenderUtils.java index b144bfd141..e1da84d9f6 100644 --- a/src/main/java/net/wurstclient/util/RenderUtils.java +++ b/src/main/java/net/wurstclient/util/RenderUtils.java @@ -16,6 +16,7 @@ import net.minecraft.block.Blocks; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gl.VertexBuffer; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.BufferBuilder.BuiltBuffer; import net.minecraft.client.render.Camera; @@ -863,9 +864,11 @@ public static void drawArrow(Vec3d from, Vec3d to, bufferBuilder.vertex(matrix, 0, 2, 1).next(); } - public static void drawItem(MatrixStack matrixStack, ItemStack stack, int x, + public static void drawItem(DrawableHelper helper, ItemStack stack, int x, int y, boolean large) { + MatrixStack matrixStack = helper.method_51448(); + matrixStack.push(); matrixStack.translate(x, y, 0); if(large) @@ -877,8 +880,7 @@ public static void drawItem(MatrixStack matrixStack, ItemStack stack, int x, ? new ItemStack(Blocks.GRASS_BLOCK) : stack; DiffuseLighting.enableGuiDepthLighting(); - WurstClient.MC.getItemRenderer().renderInGuiWithOverrides(matrixStack, - renderStack, 0, 0); + helper.method_51427(renderStack, 0, 0); DiffuseLighting.disableGuiDepthLighting(); matrixStack.pop(); @@ -891,12 +893,13 @@ public static void drawItem(MatrixStack matrixStack, ItemStack stack, int x, matrixStack.scale(2, 2, 2); GL11.glDisable(GL11.GL_DEPTH_TEST); - TextRenderer fr = WurstClient.MC.textRenderer; - fr.drawWithShadow(matrixStack, "?", 3, 2, 0xf0f0f0); + TextRenderer tr = WurstClient.MC.textRenderer; + helper.method_51433(tr, "?", 3, 2, 0xf0f0f0, false); GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glEnable(GL11.GL_BLEND); matrixStack.pop(); } + + RenderSystem.setShaderColor(1, 1, 1, 1); } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index cc0b64a0f9..305d692446 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -30,8 +30,8 @@ "depends": { "fabricloader": ">=0.14.19", - "fabric-api": ">=0.77.2", - "minecraft": "~1.20-alpha.23.14.a", + "fabric-api": ">=0.78.1", + "minecraft": "~1.20-alpha.23.16.a", "java": ">=17" }, "suggests": { From 6e9b5f1e3b4490536ba2e0030570a5f5ccfe52aa Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 23 Apr 2023 19:22:43 +0200 Subject: [PATCH 047/282] Reset colors after rendering Excavator Fixes #812 --- src/main/java/net/wurstclient/hacks/ExcavatorHack.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/net/wurstclient/hacks/ExcavatorHack.java b/src/main/java/net/wurstclient/hacks/ExcavatorHack.java index 973d7a95af..18bdeb035f 100644 --- a/src/main/java/net/wurstclient/hacks/ExcavatorHack.java +++ b/src/main/java/net/wurstclient/hacks/ExcavatorHack.java @@ -321,6 +321,7 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LINE_SMOOTH); + RenderSystem.setShaderColor(1, 1, 1, 1); } @Override @@ -370,6 +371,7 @@ public void onRenderGUI(MatrixStack matrixStack, float partialTicks) // GL resets GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); + RenderSystem.setShaderColor(1, 1, 1, 1); } public void enableWithArea(BlockPos pos1, BlockPos pos2) From 46b19a47a282d13283cd80118b6d8b11575b42e9 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 24 Apr 2023 11:00:11 +0200 Subject: [PATCH 048/282] Make BowAimbot & Excavator disable each other --- src/main/java/net/wurstclient/hacks/BowAimbotHack.java | 4 ++++ src/main/java/net/wurstclient/hacks/ExcavatorHack.java | 5 ++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/BowAimbotHack.java b/src/main/java/net/wurstclient/hacks/BowAimbotHack.java index 55b76bbbad..58c27c3a39 100644 --- a/src/main/java/net/wurstclient/hacks/BowAimbotHack.java +++ b/src/main/java/net/wurstclient/hacks/BowAimbotHack.java @@ -93,6 +93,10 @@ public BowAimbotHack() @Override public void onEnable() { + // disable conflicting hacks + WURST.getHax().excavatorHack.setEnabled(false); + + // register event listeners EVENTS.add(GUIRenderListener.class, this); EVENTS.add(RenderListener.class, this); EVENTS.add(UpdateListener.class, this); diff --git a/src/main/java/net/wurstclient/hacks/ExcavatorHack.java b/src/main/java/net/wurstclient/hacks/ExcavatorHack.java index 18bdeb035f..7ef01d5861 100644 --- a/src/main/java/net/wurstclient/hacks/ExcavatorHack.java +++ b/src/main/java/net/wurstclient/hacks/ExcavatorHack.java @@ -92,13 +92,12 @@ public String getRenderName() public void onEnable() { // disable conflicting hacks - // TODO: - // WURST.getHax().bowAimbotMod.setEnabled(false); - // WURST.getHax().templateToolMod.setEnabled(false); WURST.getHax().autoMineHack.setEnabled(false); + WURST.getHax().bowAimbotHack.setEnabled(false); WURST.getHax().nukerHack.setEnabled(false); WURST.getHax().nukerLegitHack.setEnabled(false); WURST.getHax().speedNukerHack.setEnabled(false); + // WURST.getHax().templateToolHack.setEnabled(false); WURST.getHax().tunnellerHack.setEnabled(false); step = Step.START_POS; From 0c57710cf37774982824a607dc0d305497f67d46 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 24 Apr 2023 11:00:50 +0200 Subject: [PATCH 049/282] Fix Excavator text rendering in the wrong color --- src/main/java/net/wurstclient/hacks/ExcavatorHack.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/net/wurstclient/hacks/ExcavatorHack.java b/src/main/java/net/wurstclient/hacks/ExcavatorHack.java index 7ef01d5861..dca19bbbfa 100644 --- a/src/main/java/net/wurstclient/hacks/ExcavatorHack.java +++ b/src/main/java/net/wurstclient/hacks/ExcavatorHack.java @@ -363,6 +363,7 @@ public void onRenderGUI(MatrixStack matrixStack, float partialTicks) tessellator.draw(); // text + RenderSystem.setShaderColor(1, 1, 1, 1); tr.draw(matrixStack, message, 2, 1, 0xffffffff); matrixStack.pop(); From 2c6d1efd2c4ae9a8f6de9e51c6c8c527c61d92cb Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 24 Apr 2023 11:11:41 +0200 Subject: [PATCH 050/282] Fix BowAimbot not rendering correctly --- src/main/java/net/wurstclient/hacks/BowAimbotHack.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/wurstclient/hacks/BowAimbotHack.java b/src/main/java/net/wurstclient/hacks/BowAimbotHack.java index 58c27c3a39..c6460caf48 100644 --- a/src/main/java/net/wurstclient/hacks/BowAimbotHack.java +++ b/src/main/java/net/wurstclient/hacks/BowAimbotHack.java @@ -18,6 +18,7 @@ import com.mojang.blaze3d.systems.RenderSystem; +import net.minecraft.client.font.TextRenderer; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; @@ -243,6 +244,7 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LINE_SMOOTH); + RenderSystem.setShaderColor(1, 1, 1, 1); } @Override @@ -268,9 +270,11 @@ public void onRenderGUI(MatrixStack matrixStack, float partialTicks) else message = "Target Locked"; + TextRenderer tr = MC.textRenderer; + // translate to center Window sr = MC.getWindow(); - int msgWidth = MC.textRenderer.getWidth(message); + int msgWidth = tr.getWidth(message); matrixStack.translate(sr.getScaledWidth() / 2 - msgWidth / 2, sr.getScaledHeight() / 2 + 1, 0); @@ -279,12 +283,14 @@ public void onRenderGUI(MatrixStack matrixStack, float partialTicks) RenderSystem.setShaderColor(0, 0, 0, 0.5F); bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION); + bufferBuilder.vertex(matrix, 0, 0, 0).next(); bufferBuilder.vertex(matrix, msgWidth + 3, 0, 0).next(); bufferBuilder.vertex(matrix, msgWidth + 3, 10, 0).next(); bufferBuilder.vertex(matrix, 0, 10, 0).next(); tessellator.draw(); // text + RenderSystem.setShaderColor(1, 1, 1, 1); MC.textRenderer.draw(matrixStack, message, 2, 1, 0xffffffff); matrixStack.pop(); @@ -292,6 +298,7 @@ public void onRenderGUI(MatrixStack matrixStack, float partialTicks) // GL resets GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); + RenderSystem.setShaderColor(1, 1, 1, 1); } private enum Priority From 7671c9cbec340d363390adbd5db68146f6d76b9a Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 24 Apr 2023 11:27:22 +0200 Subject: [PATCH 051/282] Fix Trajectories not raytracing correctly --- src/main/java/net/wurstclient/hacks/TrajectoriesHack.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java b/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java index 24a98e4f90..581bafb49e 100644 --- a/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java +++ b/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java @@ -222,7 +222,9 @@ private ArrayList getPath(float partialTicks) arrowMotionY -= gravity * 0.1; // check for collision - RaycastContext context = new RaycastContext(eyesPos, arrowPos, + Vec3d lastPos = + path.size() > 1 ? path.get(path.size() - 2) : eyesPos; + RaycastContext context = new RaycastContext(lastPos, arrowPos, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.NONE, MC.player); if(MC.world.raycast(context).getType() != HitResult.Type.MISS) From 5e6642ade22214a4dcdfd6335c1fb55ca5420203 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 24 Apr 2023 11:47:32 +0200 Subject: [PATCH 052/282] Add entity collision detection to Trajectories --- .../net/wurstclient/hacks/TrajectoriesHack.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java b/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java index 581bafb49e..ba0b0d6596 100644 --- a/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java +++ b/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java @@ -9,6 +9,7 @@ import java.awt.Color; import java.util.ArrayList; +import java.util.function.Predicate; import org.joml.Matrix4f; import org.lwjgl.opengl.GL11; @@ -22,8 +23,12 @@ import net.minecraft.client.render.VertexFormat; import net.minecraft.client.render.VertexFormats; import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.entity.Entity; +import net.minecraft.entity.projectile.ProjectileUtil; import net.minecraft.item.*; +import net.minecraft.util.hit.EntityHitResult; import net.minecraft.util.hit.HitResult; +import net.minecraft.util.math.Box; import net.minecraft.util.math.Vec3d; import net.minecraft.world.RaycastContext; import net.wurstclient.Category; @@ -221,14 +226,24 @@ private ArrayList getPath(float partialTicks) // apply gravity arrowMotionY -= gravity * 0.1; - // check for collision Vec3d lastPos = path.size() > 1 ? path.get(path.size() - 2) : eyesPos; + + // check for block collision RaycastContext context = new RaycastContext(lastPos, arrowPos, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.NONE, MC.player); if(MC.world.raycast(context).getType() != HitResult.Type.MISS) break; + + // check for entity collision + Box box = new Box(lastPos, arrowPos); + Predicate predicate = e -> !e.isSpectator() && e.canHit(); + double maxDistSq = 64 * 64; + EntityHitResult eResult = ProjectileUtil.raycast(MC.player, lastPos, + arrowPos, box, predicate, maxDistSq); + if(eResult != null && eResult.getType() != HitResult.Type.MISS) + break; } return path; From 7cd4c1d381e8592a7a78c561a6ed8907a593b7e6 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 24 Apr 2023 21:11:15 +0200 Subject: [PATCH 053/282] Refactor TrajectoriesHack.getPath() --- .../wurstclient/hacks/TrajectoriesHack.java | 106 ++++++++---------- 1 file changed, 49 insertions(+), 57 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java b/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java index ba0b0d6596..3c7dd9feca 100644 --- a/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java +++ b/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java @@ -29,6 +29,7 @@ import net.minecraft.util.hit.EntityHitResult; import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.Box; +import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import net.minecraft.world.RaycastContext; import net.wurstclient.Category; @@ -149,60 +150,24 @@ private ArrayList getPath(float partialTicks) if(stack.isEmpty() || !isThrowable(item)) return path; - // calculate starting position - double arrowPosX = player.lastRenderX - + (player.getX() - player.lastRenderX) * partialTicks - - Math.cos(Math.toRadians(player.getYaw())) * 0.16; - - double arrowPosY = player.lastRenderY - + (player.getY() - player.lastRenderY) * partialTicks - + player.getStandingEyeHeight() - 0.1; - - double arrowPosZ = player.lastRenderZ - + (player.getZ() - player.lastRenderZ) * partialTicks - - Math.sin(Math.toRadians(player.getYaw())) * 0.16; - - // Motion factor. Arrows go faster than snowballs and all that... - double arrowMotionFactor = item instanceof RangedWeaponItem ? 1.0 : 0.4; - + // prepare yaw and pitch double yaw = Math.toRadians(player.getYaw()); double pitch = Math.toRadians(player.getPitch()); - // calculate starting motion - double arrowMotionX = - -Math.sin(yaw) * Math.cos(pitch) * arrowMotionFactor; - double arrowMotionY = -Math.sin(pitch) * arrowMotionFactor; - double arrowMotionZ = - Math.cos(yaw) * Math.cos(pitch) * arrowMotionFactor; - - // 3D Pythagorean theorem. Returns the length of the arrowMotion vector. - double arrowMotion = Math.sqrt(arrowMotionX * arrowMotionX - + arrowMotionY * arrowMotionY + arrowMotionZ * arrowMotionZ); - - arrowMotionX /= arrowMotion; - arrowMotionY /= arrowMotion; - arrowMotionZ /= arrowMotion; + // calculate starting position + double arrowPosX = + MathHelper.lerp(partialTicks, player.lastRenderX, player.getX()) + - Math.cos(yaw) * 0.16; + double arrowPosY = + MathHelper.lerp(partialTicks, player.lastRenderY, player.getY()) + + player.getStandingEyeHeight() - 0.1; + double arrowPosZ = + MathHelper.lerp(partialTicks, player.lastRenderZ, player.getZ()) + - Math.sin(yaw) * 0.16; - // apply bow charge - if(item instanceof RangedWeaponItem) - { - float bowPower = (72000 - player.getItemUseTimeLeft()) / 20.0f; - bowPower = (bowPower * bowPower + bowPower * 2.0f) / 3.0f; - - if(bowPower > 1 || bowPower <= 0.1F) - bowPower = 1; - - bowPower *= 3F; - arrowMotionX *= bowPower; - arrowMotionY *= bowPower; - arrowMotionZ *= bowPower; - - }else - { - arrowMotionX *= 1.5; - arrowMotionY *= 1.5; - arrowMotionZ *= 1.5; - } + // calculate starting motion + double bowPower = getBowPower(item); + Vec3d arrowMotion = getStartingMotion(yaw, pitch, bowPower); double gravity = getProjectileGravity(item); Vec3d eyesPos = RotationUtils.getEyesPos(); @@ -214,17 +179,15 @@ private ArrayList getPath(float partialTicks) path.add(arrowPos); // apply motion - arrowPosX += arrowMotionX * 0.1; - arrowPosY += arrowMotionY * 0.1; - arrowPosZ += arrowMotionZ * 0.1; + arrowPosX += arrowMotion.x * 0.1; + arrowPosY += arrowMotion.y * 0.1; + arrowPosZ += arrowMotion.z * 0.1; // apply air friction - arrowMotionX *= 0.999; - arrowMotionY *= 0.999; - arrowMotionZ *= 0.999; + arrowMotion = arrowMotion.multiply(0.999); // apply gravity - arrowMotionY -= gravity * 0.1; + arrowMotion = arrowMotion.add(0, -gravity * 0.1, 0); Vec3d lastPos = path.size() > 1 ? path.get(path.size() - 2) : eyesPos; @@ -249,6 +212,35 @@ private ArrayList getPath(float partialTicks) return path; } + private Vec3d getStartingMotion(double yaw, double pitch, double bowPower) + { + double cosOfPitch = Math.cos(pitch); + + double arrowMotionX = -Math.sin(yaw) * cosOfPitch; + double arrowMotionY = -Math.sin(pitch); + double arrowMotionZ = Math.cos(yaw) * cosOfPitch; + + return new Vec3d(arrowMotionX, arrowMotionY, arrowMotionZ).normalize() + .multiply(bowPower); + } + + private double getBowPower(Item item) + { + // use a static 1.5x for snowballs and such + if(!(item instanceof RangedWeaponItem)) + return 1.5; + + // calculate bow power + float bowPower = (72000 - MC.player.getItemUseTimeLeft()) / 20F; + bowPower = bowPower * bowPower + bowPower * 2F; + + // clamp value if fully charged or not charged at all + if(bowPower > 3 || bowPower <= 0.3F) + bowPower = 3; + + return bowPower; + } + private double getProjectileGravity(Item item) { if(item instanceof BowItem || item instanceof CrossbowItem) From 844c33855020ba40610f399730af723121fcf18e Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 26 Apr 2023 13:47:04 +0200 Subject: [PATCH 054/282] Add offhand support and further clean up Trajectories code --- .../wurstclient/hacks/TrajectoriesHack.java | 93 +++++++++++-------- .../net/wurstclient/util/EntityUtils.java | 10 ++ 2 files changed, 65 insertions(+), 38 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java b/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java index 3c7dd9feca..f15f13c434 100644 --- a/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java +++ b/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java @@ -26,10 +26,11 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.projectile.ProjectileUtil; import net.minecraft.item.*; +import net.minecraft.util.Arm; +import net.minecraft.util.Hand; import net.minecraft.util.hit.EntityHitResult; import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.Box; -import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import net.minecraft.world.RaycastContext; import net.wurstclient.Category; @@ -37,6 +38,7 @@ import net.wurstclient.events.RenderListener; import net.wurstclient.hack.Hack; import net.wurstclient.settings.ColorSetting; +import net.wurstclient.util.EntityUtils; import net.wurstclient.util.RenderUtils; import net.wurstclient.util.RotationUtils; @@ -143,45 +145,43 @@ private ArrayList getPath(float partialTicks) ClientPlayerEntity player = MC.player; ArrayList path = new ArrayList<>(); + // find the hand with a throwable item + Hand hand = Hand.MAIN_HAND; ItemStack stack = player.getMainHandStack(); - Item item = stack.getItem(); + if(!isThrowable(stack)) + { + hand = Hand.OFF_HAND; + stack = player.getOffHandStack(); + + // if neither hand has a throwable item, return empty path + if(!isThrowable(stack)) + return path; + } - // check if item is throwable - if(stack.isEmpty() || !isThrowable(item)) - return path; + // calculate item-specific values + Item item = stack.getItem(); + double throwPower = getThrowPower(item); + double gravity = getProjectileGravity(item); // prepare yaw and pitch double yaw = Math.toRadians(player.getYaw()); double pitch = Math.toRadians(player.getPitch()); // calculate starting position - double arrowPosX = - MathHelper.lerp(partialTicks, player.lastRenderX, player.getX()) - - Math.cos(yaw) * 0.16; - double arrowPosY = - MathHelper.lerp(partialTicks, player.lastRenderY, player.getY()) - + player.getStandingEyeHeight() - 0.1; - double arrowPosZ = - MathHelper.lerp(partialTicks, player.lastRenderZ, player.getZ()) - - Math.sin(yaw) * 0.16; + Vec3d arrowPos = EntityUtils.getLerpedPos(player, partialTicks) + .add(getHandOffset(hand, yaw)); // calculate starting motion - double bowPower = getBowPower(item); - Vec3d arrowMotion = getStartingMotion(yaw, pitch, bowPower); - - double gravity = getProjectileGravity(item); - Vec3d eyesPos = RotationUtils.getEyesPos(); + Vec3d arrowMotion = getStartingMotion(yaw, pitch, throwPower); + // build the path for(int i = 0; i < 1000; i++) { // add to path - Vec3d arrowPos = new Vec3d(arrowPosX, arrowPosY, arrowPosZ); path.add(arrowPos); // apply motion - arrowPosX += arrowMotion.x * 0.1; - arrowPosY += arrowMotion.y * 0.1; - arrowPosZ += arrowMotion.z * 0.1; + arrowPos = arrowPos.add(arrowMotion.multiply(0.1)); // apply air friction arrowMotion = arrowMotion.multiply(0.999); @@ -189,14 +189,14 @@ private ArrayList getPath(float partialTicks) // apply gravity arrowMotion = arrowMotion.add(0, -gravity * 0.1, 0); - Vec3d lastPos = - path.size() > 1 ? path.get(path.size() - 2) : eyesPos; + Vec3d lastPos = path.size() > 1 ? path.get(path.size() - 2) + : RotationUtils.getEyesPos(); // check for block collision - RaycastContext context = new RaycastContext(lastPos, arrowPos, + RaycastContext bContext = new RaycastContext(lastPos, arrowPos, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.NONE, MC.player); - if(MC.world.raycast(context).getType() != HitResult.Type.MISS) + if(MC.world.raycast(bContext).getType() != HitResult.Type.MISS) break; // check for entity collision @@ -212,7 +212,22 @@ private ArrayList getPath(float partialTicks) return path; } - private Vec3d getStartingMotion(double yaw, double pitch, double bowPower) + private Vec3d getHandOffset(Hand hand, double yaw) + { + Arm mainArm = MC.options.getMainArm().getValue(); + + boolean rightSide = mainArm == Arm.RIGHT && hand == Hand.MAIN_HAND + || mainArm == Arm.LEFT && hand == Hand.OFF_HAND; + + double sideMultiplier = rightSide ? -1 : 1; + double handOffsetX = Math.cos(yaw) * 0.16 * sideMultiplier; + double handOffsetY = MC.player.getStandingEyeHeight() - 0.1; + double handOffsetZ = Math.sin(yaw) * 0.16 * sideMultiplier; + + return new Vec3d(handOffsetX, handOffsetY, handOffsetZ); + } + + private Vec3d getStartingMotion(double yaw, double pitch, double throwPower) { double cosOfPitch = Math.cos(pitch); @@ -221,10 +236,10 @@ private Vec3d getStartingMotion(double yaw, double pitch, double bowPower) double arrowMotionZ = Math.cos(yaw) * cosOfPitch; return new Vec3d(arrowMotionX, arrowMotionY, arrowMotionZ).normalize() - .multiply(bowPower); + .multiply(throwPower); } - private double getBowPower(Item item) + private double getThrowPower(Item item) { // use a static 1.5x for snowballs and such if(!(item instanceof RangedWeaponItem)) @@ -243,10 +258,10 @@ private double getBowPower(Item item) private double getProjectileGravity(Item item) { - if(item instanceof BowItem || item instanceof CrossbowItem) + if(item instanceof RangedWeaponItem) return 0.05; - if(item instanceof PotionItem) + if(item instanceof ThrowablePotionItem) return 0.4; if(item instanceof FishingRodItem) @@ -258,13 +273,15 @@ private double getProjectileGravity(Item item) return 0.03; } - private boolean isThrowable(Item item) + public static boolean isThrowable(ItemStack stack) { - return item instanceof BowItem || item instanceof CrossbowItem - || item instanceof SnowballItem || item instanceof EggItem - || item instanceof EnderPearlItem - || item instanceof SplashPotionItem - || item instanceof LingeringPotionItem + if(stack.isEmpty()) + return false; + + Item item = stack.getItem(); + return item instanceof RangedWeaponItem || item instanceof SnowballItem + || item instanceof EggItem || item instanceof EnderPearlItem + || item instanceof ThrowablePotionItem || item instanceof FishingRodItem || item instanceof TridentItem; } } diff --git a/src/main/java/net/wurstclient/util/EntityUtils.java b/src/main/java/net/wurstclient/util/EntityUtils.java index 6ae15b471c..c328376c9e 100644 --- a/src/main/java/net/wurstclient/util/EntityUtils.java +++ b/src/main/java/net/wurstclient/util/EntityUtils.java @@ -17,6 +17,8 @@ import net.minecraft.entity.decoration.EndCrystalEntity; import net.minecraft.entity.passive.AnimalEntity; import net.minecraft.entity.projectile.ShulkerBulletEntity; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.Vec3d; import net.wurstclient.WurstClient; public enum EntityUtils @@ -49,4 +51,12 @@ public static Stream getValidAnimals() public static Predicate IS_VALID_ANIMAL = a -> a != null && !a.isRemoved() && a.getHealth() > 0; + + public static Vec3d getLerpedPos(Entity e, float partialTicks) + { + double x = MathHelper.lerp(partialTicks, e.lastRenderX, e.getX()); + double y = MathHelper.lerp(partialTicks, e.lastRenderY, e.getY()); + double z = MathHelper.lerp(partialTicks, e.lastRenderZ, e.getZ()); + return new Vec3d(x, y, z); + } } From 5910942e0e092a8f5131896ad01b82443ed2aa74 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Thu, 27 Apr 2023 09:54:11 +0200 Subject: [PATCH 055/282] [Wurst-Bot] Update to 23w17a --- gradle.properties | 8 +++---- .../java/net/wurstclient/WurstClient.java | 2 +- .../java/net/wurstclient/ai/PathFinder.java | 4 ++-- .../wurstclient/altmanager/AltRenderer.java | 13 +++++----- .../altmanager/screens/AltEditorScreen.java | 7 +++--- .../altmanager/screens/AltManagerScreen.java | 24 +++++++++---------- .../net/wurstclient/clickgui/ClickGui.java | 22 ++++++++--------- .../wurstclient/clickgui/ComboBoxPopup.java | 10 ++++---- .../net/wurstclient/clickgui/Component.java | 4 ++-- .../java/net/wurstclient/clickgui/Popup.java | 4 ++-- .../components/AbstractListEditButton.java | 10 ++++---- .../clickgui/components/BlockComponent.java | 8 +++---- .../components/CheckboxComponent.java | 10 ++++---- .../clickgui/components/ColorComponent.java | 12 +++++----- .../components/ComboBoxComponent.java | 12 +++++----- .../clickgui/components/FeatureButton.java | 10 ++++---- .../clickgui/components/FileComponent.java | 10 ++++---- .../clickgui/components/RadarComponent.java | 7 +++--- .../clickgui/components/SliderComponent.java | 12 +++++----- .../clickgui/screens/AddBookOfferScreen.java | 16 ++++++------- .../clickgui/screens/ClickGuiScreen.java | 4 ++-- .../clickgui/screens/EditBlockListScreen.java | 14 +++++------ .../clickgui/screens/EditBlockScreen.java | 6 ++--- .../clickgui/screens/EditBookOfferScreen.java | 10 ++++---- .../screens/EditBookOffersScreen.java | 16 ++++++------- .../clickgui/screens/EditColorScreen.java | 12 +++++----- .../clickgui/screens/EditItemListScreen.java | 14 +++++------ .../clickgui/screens/EditSliderScreen.java | 4 ++-- .../clickgui/screens/SelectFileScreen.java | 12 +++++----- .../net/wurstclient/commands/TacoCmd.java | 5 ++-- .../wurstclient/events/GUIRenderListener.java | 9 ++++--- .../net/wurstclient/hacks/BowAimbotHack.java | 9 ++++--- .../net/wurstclient/hacks/ExcavatorHack.java | 8 +++---- .../wurstclient/hacks/MobSpawnEspHack.java | 2 +- .../java/net/wurstclient/hud/HackListHUD.java | 20 ++++++++-------- .../java/net/wurstclient/hud/IngameHUD.java | 5 ++-- src/main/java/net/wurstclient/hud/TabGui.java | 11 ++++----- .../java/net/wurstclient/hud/WurstLogo.java | 8 +++---- .../mixin/GameMenuScreenMixin.java | 4 ++-- .../net/wurstclient/mixin/IngameHudMixin.java | 7 +++--- .../net/wurstclient/mixin/ScreenMixin.java | 4 ++-- .../wurstclient/mixin/StatsScreenMixin.java | 2 +- .../wurstclient/mixin/TitleScreenMixin.java | 2 +- .../navigator/NavigatorFeatureScreen.java | 11 ++++----- .../navigator/NavigatorMainScreen.java | 16 ++++++------- .../navigator/NavigatorNewKeybindScreen.java | 7 +++--- .../NavigatorRemoveKeybindScreen.java | 7 +++--- .../navigator/NavigatorScreen.java | 9 ++++--- .../ForcedChatReportsScreen.java | 4 ++-- .../nochatreports/NcrModRequiredScreen.java | 4 ++-- .../options/EnterProfileNameScreen.java | 4 ++-- .../options/KeybindEditorScreen.java | 4 ++-- .../options/KeybindManagerScreen.java | 10 ++++---- .../options/KeybindProfilesScreen.java | 8 +++---- .../wurstclient/options/PressAKeyScreen.java | 5 ++-- .../options/WurstOptionsScreen.java | 10 ++++---- .../options/ZoomManagerScreen.java | 4 ++-- .../serverfinder/CleanUpScreen.java | 8 +++---- .../serverfinder/ServerFinderScreen.java | 5 ++-- .../java/net/wurstclient/util/ListWidget.java | 12 +++++----- .../net/wurstclient/util/RenderUtils.java | 10 ++++---- 61 files changed, 258 insertions(+), 273 deletions(-) diff --git a/gradle.properties b/gradle.properties index b42ee0bfd7..7e6c86a217 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,15 +4,15 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these at https://fabricmc.net/develop/ and # https://www.curseforge.com/minecraft/mc-mods/fabric-api -minecraft_version=23w16a -yarn_mappings=23w16a+build.4 +minecraft_version=23w17a +yarn_mappings=23w17a+build.4 loader_version=0.14.19 #Fabric api -fabric_version=0.78.1+1.20 +fabric_version=0.79.1+1.20 # Mod Properties -mod_version = v7.32-MC23w16a +mod_version = v7.32-MC23w17a maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index 4ab279e375..1d1b8add89 100644 --- a/src/main/java/net/wurstclient/WurstClient.java +++ b/src/main/java/net/wurstclient/WurstClient.java @@ -57,7 +57,7 @@ public enum WurstClient public static IMinecraftClient IMC; public static final String VERSION = "7.32"; - public static final String MC_VERSION = "23w16a"; + public static final String MC_VERSION = "23w17a"; private WurstAnalytics analytics; private EventManager eventManager; diff --git a/src/main/java/net/wurstclient/ai/PathFinder.java b/src/main/java/net/wurstclient/ai/PathFinder.java index 0e8b9db50a..8e088a29fe 100644 --- a/src/main/java/net/wurstclient/ai/PathFinder.java +++ b/src/main/java/net/wurstclient/ai/PathFinder.java @@ -283,7 +283,7 @@ protected boolean canBeSolid(BlockPos pos) BlockState state = BlockUtils.getState(pos); Block block = state.getBlock(); - return state.method_51366() && !(block instanceof AbstractSignBlock) + return state.blocksMovement() && !(block instanceof AbstractSignBlock) || block instanceof LadderBlock || jesus && (block == Blocks.WATER || block == Blocks.LAVA); } @@ -300,7 +300,7 @@ private boolean canGoThrough(BlockPos pos) // check if solid BlockState state = BlockUtils.getState(pos); Block block = state.getBlock(); - if(state.method_51366() && !(block instanceof AbstractSignBlock)) + if(state.blocksMovement() && !(block instanceof AbstractSignBlock)) return false; // check if trapped diff --git a/src/main/java/net/wurstclient/altmanager/AltRenderer.java b/src/main/java/net/wurstclient/altmanager/AltRenderer.java index a263de58d9..685e184263 100644 --- a/src/main/java/net/wurstclient/altmanager/AltRenderer.java +++ b/src/main/java/net/wurstclient/altmanager/AltRenderer.java @@ -15,8 +15,7 @@ import com.mojang.authlib.GameProfile; import com.mojang.blaze3d.systems.RenderSystem; - -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.network.PlayerListEntry; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.BufferRenderer; @@ -53,7 +52,7 @@ private static void bindSkinTexture(String name) RenderSystem.setShaderTexture(0, loadedSkins.get(name)); } - private static void drawTexture(DrawableHelper helper, int x, int y, + private static void drawTexture(DrawContext helper, int x, int y, float u, float v, int w, int h, int fw, int fh) { int x2 = x + w; @@ -65,7 +64,7 @@ private static void drawTexture(DrawableHelper helper, int x, int y, float vPlusHOverFh = (v + h) / fh; RenderSystem.setShader(GameRenderer::getPositionTexProgram); - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); Matrix4f matrix4f = matrixStack.peek().getPositionMatrix(); BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer(); bufferBuilder.begin(VertexFormat.DrawMode.QUADS, @@ -81,7 +80,7 @@ private static void drawTexture(DrawableHelper helper, int x, int y, BufferRenderer.drawWithGlobalProgram(bufferBuilder.end()); } - public static void drawAltFace(DrawableHelper helper, String name, int x, + public static void drawAltFace(DrawContext helper, String name, int x, int y, int w, int h, boolean selected) { try @@ -116,7 +115,7 @@ public static void drawAltFace(DrawableHelper helper, String name, int x, } } - public static void drawAltBody(DrawableHelper helper, String name, int x, + public static void drawAltBody(DrawContext helper, String name, int x, int y, int width, int height) { try @@ -247,7 +246,7 @@ public static void drawAltBody(DrawableHelper helper, String name, int x, } } - public static void drawAltBack(DrawableHelper helper, String name, int x, + public static void drawAltBack(DrawContext helper, String name, int x, int y, int width, int height) { try diff --git a/src/main/java/net/wurstclient/altmanager/screens/AltEditorScreen.java b/src/main/java/net/wurstclient/altmanager/screens/AltEditorScreen.java index 474b95cd59..2ef9b5f710 100644 --- a/src/main/java/net/wurstclient/altmanager/screens/AltEditorScreen.java +++ b/src/main/java/net/wurstclient/altmanager/screens/AltEditorScreen.java @@ -27,8 +27,7 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.mojang.blaze3d.systems.RenderSystem; - -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -343,12 +342,12 @@ public boolean mouseClicked(double x, double y, int button) } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { renderBackground(helper); - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); diff --git a/src/main/java/net/wurstclient/altmanager/screens/AltManagerScreen.java b/src/main/java/net/wurstclient/altmanager/screens/AltManagerScreen.java index 2a36f541b0..07a85536ce 100644 --- a/src/main/java/net/wurstclient/altmanager/screens/AltManagerScreen.java +++ b/src/main/java/net/wurstclient/altmanager/screens/AltManagerScreen.java @@ -29,8 +29,8 @@ import it.unimi.dsi.fastutil.booleans.BooleanConsumer; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.Drawable; -import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.ConfirmScreen; import net.minecraft.client.gui.screen.NoticeScreen; import net.minecraft.client.gui.screen.Screen; @@ -409,13 +409,13 @@ private void confirmRemove(boolean confirmed) } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { renderBackground(helper); listGui.render(helper, mouseX, mouseY, partialTicks); - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); @@ -473,7 +473,7 @@ public void render(DrawableHelper helper, int mouseX, int mouseY, renderAltTooltip(helper, mouseX, mouseY); } - private void renderAltTooltip(DrawableHelper helper, int mouseX, int mouseY) + private void renderAltTooltip(DrawContext helper, int mouseX, int mouseY) { if(!listGui.isMouseInList(mouseX, mouseY)) return; @@ -515,10 +515,10 @@ private void renderAltTooltip(DrawableHelper helper, int mouseX, int mouseY) if(alt.isFavorite()) addTooltip(tooltip, "favorite"); - helper.method_51434(textRenderer, tooltip, mouseX, mouseY); + helper.drawTooltip(textRenderer, tooltip, mouseX, mouseY); } - private void renderButtonTooltip(DrawableHelper helper, int mouseX, + private void renderButtonTooltip(DrawContext helper, int mouseX, int mouseY) { for(Drawable d : ((IScreen)(Object)this).getButtons()) @@ -542,7 +542,7 @@ private void renderButtonTooltip(DrawableHelper helper, int mouseX, else addTooltip(tooltip, "window_freeze"); - helper.method_51434(textRenderer, tooltip, mouseX, mouseY); + helper.drawTooltip(textRenderer, tooltip, mouseX, mouseY); break; } } @@ -637,12 +637,12 @@ protected void renderBackground() } @Override - protected void renderItem(DrawableHelper helper, int id, int x, int y, + protected void renderItem(DrawContext helper, int id, int x, int y, int var4, int var5, int var6, float partialTicks) { Alt alt = list.get(id); - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); @@ -677,15 +677,15 @@ protected void renderItem(DrawableHelper helper, int id, int x, int y, isSelectedItem(id)); // name / email - helper.method_51433(client.textRenderer, + helper.drawText(client.textRenderer, "Name: " + alt.getDisplayName(), x + 31, y + 3, 10526880, false); - helper.method_51433(client.textRenderer, + helper.drawText(client.textRenderer, "Name: " + alt.getDisplayName(), x + 31, y + 3, 10526880, false); String bottomText = getBottomText(alt); - helper.method_51433(client.textRenderer, bottomText, x + 31, y + 15, + helper.drawText(client.textRenderer, bottomText, x + 31, y + 15, 10526880, false); } diff --git a/src/main/java/net/wurstclient/clickgui/ClickGui.java b/src/main/java/net/wurstclient/clickgui/ClickGui.java index 75b5eb795d..d2d9369b63 100644 --- a/src/main/java/net/wurstclient/clickgui/ClickGui.java +++ b/src/main/java/net/wurstclient/clickgui/ClickGui.java @@ -28,7 +28,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.render.Tessellator; @@ -460,7 +460,7 @@ private void handleComponentMouseClick(Window window, double mouseX, } } - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { updateColors(); @@ -504,9 +504,9 @@ public void render(DrawableHelper helper, int mouseX, int mouseY, GL11.glDisable(GL11.GL_BLEND); } - public void renderPopups(DrawableHelper helper, int mouseX, int mouseY) + public void renderPopups(DrawContext helper, int mouseX, int mouseY) { - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); for(Popup popup : popups) { Component owner = popup.getOwner(); @@ -527,9 +527,9 @@ public void renderPopups(DrawableHelper helper, int mouseX, int mouseY) } } - public void renderTooltip(DrawableHelper helper, int mouseX, int mouseY) + public void renderTooltip(DrawContext helper, int mouseX, int mouseY) { - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); @@ -586,14 +586,14 @@ public void renderTooltip(DrawableHelper helper, int mouseX, int mouseY) // text RenderSystem.setShaderColor(1, 1, 1, 1); for(int i = 0; i < lines.length; i++) - helper.method_51433(fr, lines[i], xt1 + 2, + helper.drawText(fr, lines[i], xt1 + 2, yt1 + 2 + i * fr.fontHeight, txtColor, false); GL11.glEnable(GL11.GL_BLEND); matrixStack.pop(); } - public void renderPinnedWindows(DrawableHelper helper, float partialTicks) + public void renderPinnedWindows(DrawContext helper, float partialTicks) { GL11.glDisable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_BLEND); @@ -626,7 +626,7 @@ public void updateColors() acColor = clickGui.getAccentColor(); } - private void renderWindow(DrawableHelper helper, Window window, int mouseX, + private void renderWindow(DrawContext helper, Window window, int mouseX, int mouseY, float partialTicks) { int x1 = window.getX(); @@ -635,7 +635,7 @@ private void renderWindow(DrawableHelper helper, Window window, int mouseX, int y2 = y1 + window.getHeight(); int y3 = y1 + 13; - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); @@ -892,7 +892,7 @@ private void renderWindow(DrawableHelper helper, Window window, int mouseX, TextRenderer fr = MC.textRenderer; String title = fr.trimToWidth(Text.literal(window.getTitle()), x3 - x1) .getString(); - helper.method_51433(fr, title, x1 + 2, y1 + 3, txtColor, false); + helper.drawText(fr, title, x1 + 2, y1 + 3, txtColor, false); GL11.glEnable(GL11.GL_BLEND); } diff --git a/src/main/java/net/wurstclient/clickgui/ComboBoxPopup.java b/src/main/java/net/wurstclient/clickgui/ComboBoxPopup.java index f3b634c6b4..674699b040 100644 --- a/src/main/java/net/wurstclient/clickgui/ComboBoxPopup.java +++ b/src/main/java/net/wurstclient/clickgui/ComboBoxPopup.java @@ -13,7 +13,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.render.Tessellator; @@ -70,9 +70,9 @@ public void handleMouseClick(int mouseX, int mouseY, int mouseButton) } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY) + public void render(DrawContext helper, int mouseX, int mouseY) { - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); int x1 = getX(); int x2 = x1 + getWidth(); int y1 = getY(); @@ -150,14 +150,14 @@ private void drawValueBackground(MatrixStack matrixStack, int x1, int x2, tessellator.draw(); } - private void drawValueName(DrawableHelper helper, int x1, int yi1, + private void drawValueName(DrawContext helper, int x1, int yi1, Enum value) { ClickGui gui = WurstClient.INSTANCE.getGui(); int txtColor = gui.getTxtColor(); RenderSystem.setShaderColor(1, 1, 1, 1); - helper.method_51433(tr, value.toString(), x1 + 2, yi1 + 2, txtColor, + helper.drawText(tr, value.toString(), x1 + 2, yi1 + 2, txtColor, false); GL11.glEnable(GL11.GL_BLEND); } diff --git a/src/main/java/net/wurstclient/clickgui/Component.java b/src/main/java/net/wurstclient/clickgui/Component.java index b2fb13e8a3..52b98005da 100644 --- a/src/main/java/net/wurstclient/clickgui/Component.java +++ b/src/main/java/net/wurstclient/clickgui/Component.java @@ -7,7 +7,7 @@ */ package net.wurstclient.clickgui; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; public abstract class Component { @@ -23,7 +23,7 @@ public void handleMouseClick(double mouseX, double mouseY, int mouseButton) } - public abstract void render(DrawableHelper helper, int mouseX, int mouseY, + public abstract void render(DrawContext helper, int mouseX, int mouseY, float partialTicks); public abstract int getDefaultWidth(); diff --git a/src/main/java/net/wurstclient/clickgui/Popup.java b/src/main/java/net/wurstclient/clickgui/Popup.java index b77f62f557..296b5f34bd 100644 --- a/src/main/java/net/wurstclient/clickgui/Popup.java +++ b/src/main/java/net/wurstclient/clickgui/Popup.java @@ -7,7 +7,7 @@ */ package net.wurstclient.clickgui; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; public abstract class Popup { @@ -27,7 +27,7 @@ public Popup(Component owner) public abstract void handleMouseClick(int mouseX, int mouseY, int mouseButton); - public abstract void render(DrawableHelper helper, int mouseX, int mouseY); + public abstract void render(DrawContext helper, int mouseX, int mouseY); public abstract int getDefaultWidth(); diff --git a/src/main/java/net/wurstclient/clickgui/components/AbstractListEditButton.java b/src/main/java/net/wurstclient/clickgui/components/AbstractListEditButton.java index ed5597a989..b9c0c763bb 100644 --- a/src/main/java/net/wurstclient/clickgui/components/AbstractListEditButton.java +++ b/src/main/java/net/wurstclient/clickgui/components/AbstractListEditButton.java @@ -14,7 +14,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.render.Tessellator; @@ -57,7 +57,7 @@ public void handleMouseClick(double mouseX, double mouseY, int mouseButton) } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { ClickGui gui = WurstClient.INSTANCE.getGui(); @@ -80,7 +80,7 @@ public void render(DrawableHelper helper, int mouseX, int mouseY, boolean hText = hovering && mouseX < x3; boolean hBox = hovering && mouseX >= x3; - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); @@ -124,8 +124,8 @@ public void render(DrawableHelper helper, int mouseX, int mouseY, // setting name RenderSystem.setShaderColor(1, 1, 1, 1); TextRenderer tr = MC.textRenderer; - helper.method_51433(tr, getText(), x1, y1 + 2, txtColor, false); - helper.method_51433(tr, buttonText, x3 + 2, y1 + 2, txtColor, false); + helper.drawText(tr, getText(), x1, y1 + 2, txtColor, false); + helper.drawText(tr, buttonText, x3 + 2, y1 + 2, txtColor, false); GL11.glEnable(GL11.GL_BLEND); } diff --git a/src/main/java/net/wurstclient/clickgui/components/BlockComponent.java b/src/main/java/net/wurstclient/clickgui/components/BlockComponent.java index 1a97eef3f1..fb6d61f0f5 100644 --- a/src/main/java/net/wurstclient/clickgui/components/BlockComponent.java +++ b/src/main/java/net/wurstclient/clickgui/components/BlockComponent.java @@ -14,7 +14,7 @@ import net.minecraft.block.Block; import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; @@ -62,7 +62,7 @@ public void handleMouseClick(double mouseX, double mouseY, int mouseButton) } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { ClickGui gui = WurstClient.INSTANCE.getGui(); @@ -86,7 +86,7 @@ public void render(DrawableHelper helper, int mouseX, int mouseY, ItemStack stack = new ItemStack(setting.getBlock()); - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); @@ -121,7 +121,7 @@ else if(hBlock) RenderSystem.setShaderColor(1, 1, 1, 1); TextRenderer tr = WurstClient.MC.textRenderer; String text = setting.getName() + ":"; - helper.method_51433(tr, text, x1, y1 + 2, txtColor, false); + helper.drawText(tr, text, x1, y1 + 2, txtColor, false); MatrixStack modelViewStack = RenderSystem.getModelViewStack(); modelViewStack.push(); diff --git a/src/main/java/net/wurstclient/clickgui/components/CheckboxComponent.java b/src/main/java/net/wurstclient/clickgui/components/CheckboxComponent.java index 007fb867a8..ed37d1deb8 100644 --- a/src/main/java/net/wurstclient/clickgui/components/CheckboxComponent.java +++ b/src/main/java/net/wurstclient/clickgui/components/CheckboxComponent.java @@ -13,7 +13,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.render.Tessellator; @@ -56,10 +56,10 @@ public void handleMouseClick(double mouseX, double mouseY, int mouseButton) } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); int x1 = getX(); int x2 = x1 + getWidth(); int x3 = x1 + 11; @@ -211,7 +211,7 @@ private void drawCheck(MatrixStack matrixStack, int x1, int y1, tessellator.draw(); } - private void drawName(DrawableHelper helper, int x3, int y1) + private void drawName(DrawContext helper, int x3, int y1) { ClickGui gui = WurstClient.INSTANCE.getGui(); int txtColor = gui.getTxtColor(); @@ -221,7 +221,7 @@ private void drawName(DrawableHelper helper, int x3, int y1) String name = setting.getName(); int tx = x3 + 2; int ty = y1 + 2; - helper.method_51433(MC.textRenderer, name, tx, ty, txtColor, false); + helper.drawText(MC.textRenderer, name, tx, ty, txtColor, false); GL11.glEnable(GL11.GL_BLEND); } diff --git a/src/main/java/net/wurstclient/clickgui/components/ColorComponent.java b/src/main/java/net/wurstclient/clickgui/components/ColorComponent.java index 3bb8138f32..5cfcea46f2 100644 --- a/src/main/java/net/wurstclient/clickgui/components/ColorComponent.java +++ b/src/main/java/net/wurstclient/clickgui/components/ColorComponent.java @@ -14,7 +14,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.render.Tessellator; @@ -56,10 +56,10 @@ else if(mouseButton == 1) } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); int x1 = getX(); int x2 = x1 + getWidth(); int y1 = getY(); @@ -157,7 +157,7 @@ private void drawBox(MatrixStack matrixStack, int x1, int x2, int y2, tessellator.draw(); } - private void drawNameAndValue(DrawableHelper helper, int x1, int x2, int y1) + private void drawNameAndValue(DrawContext helper, int x1, int x2, int y1) { ClickGui gui = WurstClient.INSTANCE.getGui(); int txtColor = gui.getTxtColor(); @@ -165,11 +165,11 @@ private void drawNameAndValue(DrawableHelper helper, int x1, int x2, int y1) RenderSystem.setShaderColor(1, 1, 1, 1); TextRenderer tr = MC.textRenderer; - helper.method_51433(tr, setting.getName(), x1, y1, txtColor, false); + helper.drawText(tr, setting.getName(), x1, y1, txtColor, false); String value = ColorUtils.toHex(setting.getColor()); int valueWidth = tr.getWidth(value); - helper.method_51433(tr, value, x2 - valueWidth, y1, txtColor, false); + helper.drawText(tr, value, x2 - valueWidth, y1, txtColor, false); GL11.glEnable(GL11.GL_BLEND); } diff --git a/src/main/java/net/wurstclient/clickgui/components/ComboBoxComponent.java b/src/main/java/net/wurstclient/clickgui/components/ComboBoxComponent.java index ac22c446c6..b3788a49d5 100644 --- a/src/main/java/net/wurstclient/clickgui/components/ComboBoxComponent.java +++ b/src/main/java/net/wurstclient/clickgui/components/ComboBoxComponent.java @@ -17,7 +17,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.render.Tessellator; @@ -103,10 +103,10 @@ private boolean isPopupOpen() } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); int x1 = getX(); int x2 = x1 + getWidth(); int x3 = x2 - 11; @@ -259,7 +259,7 @@ private void drawArrow(MatrixStack matrixStack, int x2, int x3, int y1, tessellator.draw(); } - private void drawNameAndValue(DrawableHelper helper, int x1, int x4, int y1) + private void drawNameAndValue(DrawContext helper, int x1, int x4, int y1) { ClickGui gui = WurstClient.INSTANCE.getGui(); int txtColor = gui.getTxtColor(); @@ -269,8 +269,8 @@ private void drawNameAndValue(DrawableHelper helper, int x1, int x4, int y1) String name = setting.getName(); String value = "" + setting.getSelected(); - helper.method_51433(tr, name, x1, y1 + 2, txtColor, false); - helper.method_51433(tr, value, x4 + 2, y1 + 2, txtColor, false); + helper.drawText(tr, name, x1, y1 + 2, txtColor, false); + helper.drawText(tr, value, x4 + 2, y1 + 2, txtColor, false); GL11.glEnable(GL11.GL_BLEND); } diff --git a/src/main/java/net/wurstclient/clickgui/components/FeatureButton.java b/src/main/java/net/wurstclient/clickgui/components/FeatureButton.java index 2a0eb73742..f1be4e3b12 100644 --- a/src/main/java/net/wurstclient/clickgui/components/FeatureButton.java +++ b/src/main/java/net/wurstclient/clickgui/components/FeatureButton.java @@ -16,7 +16,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.render.Tessellator; @@ -96,10 +96,10 @@ private void closeSettingsWindow() } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); int x1 = getX(); int x2 = x1 + getWidth(); int x3 = hasSettings ? x2 - 11 : x2; @@ -290,7 +290,7 @@ private void drawSettingsArrow(MatrixStack matrixStack, int x2, int x3, tessellator.draw(); } - private void drawName(DrawableHelper helper, int x1, int x3, int y1) + private void drawName(DrawContext helper, int x1, int x3, int y1) { ClickGui gui = WurstClient.INSTANCE.getGui(); int txtColor = gui.getTxtColor(); @@ -303,7 +303,7 @@ private void drawName(DrawableHelper helper, int x1, int x3, int y1) int tx = x1 + (x3 - x1 - nameWidth) / 2; int ty = y1 + 2; - helper.method_51433(tr, name, tx, ty, txtColor, false); + helper.drawText(tr, name, tx, ty, txtColor, false); GL11.glEnable(GL11.GL_BLEND); } diff --git a/src/main/java/net/wurstclient/clickgui/components/FileComponent.java b/src/main/java/net/wurstclient/clickgui/components/FileComponent.java index 02504a78b0..44e2e54e01 100644 --- a/src/main/java/net/wurstclient/clickgui/components/FileComponent.java +++ b/src/main/java/net/wurstclient/clickgui/components/FileComponent.java @@ -13,7 +13,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.render.Tessellator; @@ -55,7 +55,7 @@ public void handleMouseClick(double mouseX, double mouseY, int mouseButton) } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { ClickGui gui = WurstClient.INSTANCE.getGui(); @@ -81,7 +81,7 @@ public void render(DrawableHelper helper, int mouseX, int mouseY, boolean hText = hovering && mouseX < x3; boolean hBox = hovering && mouseX >= x3; - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); @@ -130,8 +130,8 @@ else if(hBox) // setting name RenderSystem.setShaderColor(1, 1, 1, 1); String text = setting.getName() + ": "; - helper.method_51433(tr, text, x1, y1 + 2, txtColor, false); - helper.method_51433(tr, setting.getSelectedFileName(), x3 + 2, y1 + 2, + helper.drawText(tr, text, x1, y1 + 2, txtColor, false); + helper.drawText(tr, setting.getSelectedFileName(), x3 + 2, y1 + 2, txtColor, false); GL11.glEnable(GL11.GL_BLEND); } diff --git a/src/main/java/net/wurstclient/clickgui/components/RadarComponent.java b/src/main/java/net/wurstclient/clickgui/components/RadarComponent.java index 2c337f3ff1..fc12728dc9 100644 --- a/src/main/java/net/wurstclient/clickgui/components/RadarComponent.java +++ b/src/main/java/net/wurstclient/clickgui/components/RadarComponent.java @@ -11,8 +11,7 @@ import org.joml.Quaternionf; import com.mojang.blaze3d.systems.RenderSystem; - -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; @@ -44,7 +43,7 @@ public RadarComponent(RadarHack hack) } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { ClickGui gui = WurstClient.INSTANCE.getGui(); @@ -63,7 +62,7 @@ public void render(DrawableHelper helper, int mouseX, int mouseY, && mouseY < y2 && mouseY >= -scroll && mouseY < getParent().getHeight() - 13 - scroll; - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); diff --git a/src/main/java/net/wurstclient/clickgui/components/SliderComponent.java b/src/main/java/net/wurstclient/clickgui/components/SliderComponent.java index 93122af35f..9a3d7ed1c2 100644 --- a/src/main/java/net/wurstclient/clickgui/components/SliderComponent.java +++ b/src/main/java/net/wurstclient/clickgui/components/SliderComponent.java @@ -14,7 +14,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; @@ -76,10 +76,10 @@ private void handleRightClick() } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); int x1 = getX(); int x2 = x1 + getWidth(); int x3 = x1 + 2; @@ -302,7 +302,7 @@ private void drawKnob(MatrixStack matrixStack, int x1, int x2, int y2, tessellator.draw(); } - private void drawNameAndValue(DrawableHelper helper, int x1, int x2, int y1, + private void drawNameAndValue(DrawContext helper, int x1, int x2, int y1, boolean renderAsDisabled) { ClickGui gui = WurstClient.INSTANCE.getGui(); @@ -314,8 +314,8 @@ private void drawNameAndValue(DrawableHelper helper, int x1, int x2, int y1, String name = setting.getName(); String value = setting.getValueString(); int valueWidth = tr.getWidth(value); - helper.method_51433(tr, name, x1, y1 + 2, txtColor, false); - helper.method_51433(tr, value, x2 - valueWidth, y1 + 2, txtColor, + helper.drawText(tr, name, x1, y1 + 2, txtColor, false); + helper.drawText(tr, value, x2 - valueWidth, y1 + 2, txtColor, false); GL11.glEnable(GL11.GL_BLEND); diff --git a/src/main/java/net/wurstclient/clickgui/screens/AddBookOfferScreen.java b/src/main/java/net/wurstclient/clickgui/screens/AddBookOfferScreen.java index 6fa8c5ff05..8b26104dcb 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/AddBookOfferScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/AddBookOfferScreen.java @@ -14,7 +14,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -287,10 +287,10 @@ public void tick() } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); listGui.render(helper, mouseX, mouseY, partialTicks); matrixStack.push(); @@ -393,10 +393,10 @@ protected void renderBackground() } @Override - protected void renderItem(DrawableHelper helper, int index, int x, + protected void renderItem(DrawContext helper, int index, int x, int y, int var4, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); if(isSelectedItem(index)) drawSelectionOutline(matrixStack, x, y); @@ -410,14 +410,14 @@ protected void renderItem(DrawableHelper helper, int index, int x, String name = bookOffer.getEnchantmentName(); int nameColor = enchantment.isCursed() ? 0xff5555 : 0xf0f0f0; - helper.method_51433(tr, name, x + 28, y, nameColor, false); + helper.drawText(tr, name, x + 28, y, nameColor, false); - helper.method_51433(tr, bookOffer.id(), x + 28, y + 9, 0xa0a0a0, + helper.drawText(tr, bookOffer.id(), x + 28, y + 9, 0xa0a0a0, false); int maxLevel = enchantment.getMaxLevel(); String levels = maxLevel + (maxLevel == 1 ? " level" : " levels"); - helper.method_51433(tr, levels, x + 28, y + 18, 0xa0a0a0, false); + helper.drawText(tr, levels, x + 28, y + 18, 0xa0a0a0, false); } } } diff --git a/src/main/java/net/wurstclient/clickgui/screens/ClickGuiScreen.java b/src/main/java/net/wurstclient/clickgui/screens/ClickGuiScreen.java index ef04023993..f6fbce0f7b 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/ClickGuiScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/ClickGuiScreen.java @@ -7,7 +7,7 @@ */ package net.wurstclient.clickgui.screens; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.text.Text; import net.wurstclient.clickgui.ClickGui; @@ -50,7 +50,7 @@ public boolean mouseScrolled(double mouseX, double mouseY, double delta) } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { super.render(helper, mouseX, mouseY, partialTicks); diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditBlockListScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditBlockListScreen.java index 3db8f5c36c..0efbbdd009 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditBlockListScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditBlockListScreen.java @@ -14,7 +14,7 @@ import net.minecraft.block.Block; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.ConfirmScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; @@ -161,10 +161,10 @@ public void tick() } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); listGui.render(helper, mouseX, mouseY, partialTicks); helper.drawCenteredTextWithShadow(client.textRenderer, @@ -258,7 +258,7 @@ protected void renderBackground() } @Override - protected void renderItem(DrawableHelper helper, int index, int x, + protected void renderItem(DrawContext helper, int index, int x, int y, int var4, int var5, int var6, float partialTicks) { String name = list.get(index); @@ -269,9 +269,9 @@ protected void renderItem(DrawableHelper helper, int index, int x, RenderUtils.drawItem(helper, stack, x + 1, y + 1, true); String displayName = stack.isEmpty() ? "\u00a7ounknown block\u00a7r" : stack.getName().getString(); - helper.method_51433(tr, displayName, x + 28, y, 0xf0f0f0, false); - helper.method_51433(tr, name, x + 28, y + 9, 0xa0a0a0, false); - helper.method_51433(tr, + helper.drawText(tr, displayName, x + 28, y, 0xf0f0f0, false); + helper.drawText(tr, name, x + 28, y + 9, 0xa0a0a0, false); + helper.drawText(tr, "ID: " + Block.getRawIdFromState(block.getDefaultState()), x + 28, y + 18, 0xa0a0a0, false); } diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditBlockScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditBlockScreen.java index 3ab6b61620..462d01a2ea 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditBlockScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditBlockScreen.java @@ -12,7 +12,7 @@ import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -97,10 +97,10 @@ public void tick() } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); TextRenderer tr = client.textRenderer; renderBackground(helper); diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditBookOfferScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditBookOfferScreen.java index 4660b830fc..ebeba9dcae 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditBookOfferScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditBookOfferScreen.java @@ -10,7 +10,7 @@ import org.lwjgl.glfw.GLFW; import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -252,10 +252,10 @@ public void tick() } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); renderBackgroundTexture(helper); matrixStack.push(); @@ -280,7 +280,7 @@ public void render(DrawableHelper helper, int mouseX, int mouseY, int nameColor = enchantment.isCursed() ? 0xff5555 : 0xffffff; helper.drawTextWithShadow(tr, name, x + 28, y, nameColor); - helper.method_51433(tr, bookOffer.id(), x + 28, y + 9, 0xa0a0a0, false); + helper.drawText(tr, bookOffer.id(), x + 28, y + 9, 0xa0a0a0, false); String price; if(bookOffer.price() >= 64) @@ -292,7 +292,7 @@ public void render(DrawableHelper helper, int mouseX, int mouseY, x + 28 + tr.getWidth(price), y + 16, false); } - helper.method_51433(tr, price, x + 28, y + 18, 0xa0a0a0, false); + helper.drawText(tr, price, x + 28, y + 18, 0xa0a0a0, false); levelField.render(helper, mouseX, mouseY, partialTicks); priceField.render(helper, mouseX, mouseY, partialTicks); diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditBookOffersScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditBookOffersScreen.java index 2af5011a71..fc31019660 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditBookOffersScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditBookOffersScreen.java @@ -13,7 +13,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.ConfirmScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; @@ -177,10 +177,10 @@ public void tick() } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); listGui.render(helper, mouseX, mouseY, partialTicks); matrixStack.push(); @@ -250,10 +250,10 @@ protected void renderBackground() } @Override - protected void renderItem(DrawableHelper helper, int index, int x, + protected void renderItem(DrawContext helper, int index, int x, int y, int var4, int var5, int var6, float partialTicks) { - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); if(isSelectedItem(index)) drawSelectionOutline(matrixStack, x, y); @@ -267,9 +267,9 @@ protected void renderItem(DrawableHelper helper, int index, int x, Enchantment enchantment = bookOffer.getEnchantment(); int nameColor = enchantment.isCursed() ? 0xff5555 : 0xf0f0f0; - helper.method_51433(tr, name, x + 28, y, nameColor, false); + helper.drawText(tr, name, x + 28, y, nameColor, false); - helper.method_51433(tr, bookOffer.id(), x + 28, y + 9, 0xa0a0a0, + helper.drawText(tr, bookOffer.id(), x + 28, y + 9, 0xa0a0a0, false); String price; @@ -282,7 +282,7 @@ protected void renderItem(DrawableHelper helper, int index, int x, x + 28 + tr.getWidth(price), y + 16, false); } - helper.method_51433(tr, price, x + 28, y + 18, 0xa0a0a0, false); + helper.drawText(tr, price, x + 28, y + 18, 0xa0a0a0, false); } } } diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditColorScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditColorScreen.java index 40d4028dfd..0af9444828 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditColorScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditColorScreen.java @@ -18,7 +18,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -165,7 +165,7 @@ public void tick() } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { TextRenderer tr = client.textRenderer; @@ -186,13 +186,13 @@ public void render(DrawableHelper helper, int mouseX, int mouseY, helper.drawTexture(paletteIdentifier, x, y, u, v, w, h, fw, fh); // RGB letters - helper.method_51433(tr, "#", fieldsX - 3 - tr.getWidth("#"), + helper.drawText(tr, "#", fieldsX - 3 - tr.getWidth("#"), fieldsY + 6, 0xF0F0F0, false); - helper.method_51433(tr, "R:", fieldsX - 3 - tr.getWidth("R:"), + helper.drawText(tr, "R:", fieldsX - 3 - tr.getWidth("R:"), fieldsY + 6 + 35, 0xFF0000, false); - helper.method_51433(tr, "G:", fieldsX + 75 - 3 - tr.getWidth("G:"), + helper.drawText(tr, "G:", fieldsX + 75 - 3 - tr.getWidth("G:"), fieldsY + 6 + 35, 0x00FF00, false); - helper.method_51433(tr, "B:", fieldsX + 150 - 3 - tr.getWidth("B:"), + helper.drawText(tr, "B:", fieldsX + 150 - 3 - tr.getWidth("B:"), fieldsY + 6 + 35, 0x0000FF, false); hexValueField.render(helper, mouseX, mouseY, partialTicks); diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditItemListScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditItemListScreen.java index 6de474821a..57eb5fe879 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditItemListScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditItemListScreen.java @@ -13,7 +13,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.ConfirmScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; @@ -163,10 +163,10 @@ public void tick() } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); listGui.render(helper, mouseX, mouseY, partialTicks); helper.drawCenteredTextWithShadow(client.textRenderer, @@ -265,7 +265,7 @@ protected void renderBackground() } @Override - protected void renderItem(DrawableHelper helper, int index, int x, + protected void renderItem(DrawContext helper, int index, int x, int y, int var4, int var5, int var6, float partialTicks) { String name = list.get(index); @@ -276,9 +276,9 @@ protected void renderItem(DrawableHelper helper, int index, int x, RenderUtils.drawItem(helper, stack, x + 1, y + 1, true); String displayName = stack.isEmpty() ? "\u00a7ounknown item\u00a7r" : stack.getName().getString(); - helper.method_51433(tr, displayName, x + 28, y, 0xf0f0f0, false); - helper.method_51433(tr, name, x + 28, y + 9, 0xa0a0a0, false); - helper.method_51433(tr, "ID: " + Registries.ITEM.getRawId(item), + helper.drawText(tr, displayName, x + 28, y, 0xf0f0f0, false); + helper.drawText(tr, name, x + 28, y + 9, 0xa0a0a0, false); + helper.drawText(tr, "ID: " + Registries.ITEM.getRawId(item), x + 28, y + 18, 0xa0a0a0, false); } } diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditSliderScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditSliderScreen.java index 47bf7d62c4..3cc1339354 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditSliderScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditSliderScreen.java @@ -10,7 +10,7 @@ import org.lwjgl.glfw.GLFW; import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -92,7 +92,7 @@ public void tick() } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { renderBackground(helper); diff --git a/src/main/java/net/wurstclient/clickgui/screens/SelectFileScreen.java b/src/main/java/net/wurstclient/clickgui/screens/SelectFileScreen.java index 9592653244..b165b42ce8 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/SelectFileScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/SelectFileScreen.java @@ -16,7 +16,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.ConfirmScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; @@ -162,7 +162,7 @@ public void tick() } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { renderBackground(helper); @@ -174,7 +174,7 @@ public void render(DrawableHelper helper, int mouseX, int mouseY, super.render(helper, mouseX, mouseY, partialTicks); if(doneButton.isSelected() && !doneButton.active) - helper.method_51434(textRenderer, + helper.drawTooltip(textRenderer, Arrays.asList(Text.literal("You must first select a file.")), mouseX, mouseY); } @@ -234,15 +234,15 @@ protected void renderBackground() } @Override - protected void renderItem(DrawableHelper helper, int index, int x, + protected void renderItem(DrawContext helper, int index, int x, int y, int var4, int var5, int var6, float partialTicks) { TextRenderer tr = mc.textRenderer; Path path = list.get(index); - helper.method_51433(tr, "" + path.getFileName(), x + 28, y, + helper.drawText(tr, "" + path.getFileName(), x + 28, y, 0xf0f0f0, false); - helper.method_51433(tr, + helper.drawText(tr, "" + client.runDirectory.toPath().relativize(path), x + 28, y + 9, 0xa0a0a0, false); } diff --git a/src/main/java/net/wurstclient/commands/TacoCmd.java b/src/main/java/net/wurstclient/commands/TacoCmd.java index 7ec114c032..c91a524a0e 100644 --- a/src/main/java/net/wurstclient/commands/TacoCmd.java +++ b/src/main/java/net/wurstclient/commands/TacoCmd.java @@ -10,8 +10,7 @@ import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.systems.RenderSystem; - -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.util.Window; import net.minecraft.util.Identifier; import net.wurstclient.Category; @@ -82,7 +81,7 @@ public void onUpdate() } @Override - public void onRenderGUI(DrawableHelper helper, float partialTicks) + public void onRenderGUI(DrawContext helper, float partialTicks) { GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_CULL_FACE); diff --git a/src/main/java/net/wurstclient/events/GUIRenderListener.java b/src/main/java/net/wurstclient/events/GUIRenderListener.java index f695992282..94402380a1 100644 --- a/src/main/java/net/wurstclient/events/GUIRenderListener.java +++ b/src/main/java/net/wurstclient/events/GUIRenderListener.java @@ -8,21 +8,20 @@ package net.wurstclient.events; import java.util.ArrayList; - -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.wurstclient.event.Event; import net.wurstclient.event.Listener; public interface GUIRenderListener extends Listener { - public void onRenderGUI(DrawableHelper helper, float partialTicks); + public void onRenderGUI(DrawContext helper, float partialTicks); public static class GUIRenderEvent extends Event { private final float partialTicks; - private final DrawableHelper helper; + private final DrawContext helper; - public GUIRenderEvent(DrawableHelper helper, float partialTicks) + public GUIRenderEvent(DrawContext helper, float partialTicks) { this.helper = helper; this.partialTicks = partialTicks; diff --git a/src/main/java/net/wurstclient/hacks/BowAimbotHack.java b/src/main/java/net/wurstclient/hacks/BowAimbotHack.java index bdec313c63..449e30539c 100644 --- a/src/main/java/net/wurstclient/hacks/BowAimbotHack.java +++ b/src/main/java/net/wurstclient/hacks/BowAimbotHack.java @@ -17,8 +17,7 @@ import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.systems.RenderSystem; - -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; @@ -243,9 +242,9 @@ public void onRender(MatrixStack matrixStack, float partialTicks) } @Override - public void onRenderGUI(DrawableHelper helper, float partialTicks) + public void onRenderGUI(DrawContext helper, float partialTicks) { - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); if(target == null) return; @@ -283,7 +282,7 @@ public void onRenderGUI(DrawableHelper helper, float partialTicks) tessellator.draw(); // text - helper.method_51433(MC.textRenderer, message, 2, 1, 0xffffffff, false); + helper.drawText(MC.textRenderer, message, 2, 1, 0xffffffff, false); matrixStack.pop(); diff --git a/src/main/java/net/wurstclient/hacks/ExcavatorHack.java b/src/main/java/net/wurstclient/hacks/ExcavatorHack.java index 9154b01a68..4e61061592 100644 --- a/src/main/java/net/wurstclient/hacks/ExcavatorHack.java +++ b/src/main/java/net/wurstclient/hacks/ExcavatorHack.java @@ -21,7 +21,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.render.Tessellator; @@ -325,14 +325,14 @@ public void onRender(MatrixStack matrixStack, float partialTicks) } @Override - public void onRenderGUI(DrawableHelper helper, float partialTicks) + public void onRenderGUI(DrawContext helper, float partialTicks) { // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_CULL_FACE); - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); matrixStack.push(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); @@ -365,7 +365,7 @@ public void onRenderGUI(DrawableHelper helper, float partialTicks) tessellator.draw(); // text - helper.method_51433(tr, message, 2, 1, 0xffffffff, false); + helper.drawText(tr, message, 2, 1, 0xffffffff, false); matrixStack.pop(); diff --git a/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java b/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java index 64f9c42801..658f81c20e 100644 --- a/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java +++ b/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java @@ -299,7 +299,7 @@ private void scan() BlockPos pos = new BlockPos(x, y, z); BlockState state = world.getBlockState(pos); - if(state.method_51366()) + if(state.blocksMovement()) continue; if(!state.getFluidState().isEmpty()) continue; diff --git a/src/main/java/net/wurstclient/hud/HackListHUD.java b/src/main/java/net/wurstclient/hud/HackListHUD.java index 01b4016331..c350b8f8a5 100644 --- a/src/main/java/net/wurstclient/hud/HackListHUD.java +++ b/src/main/java/net/wurstclient/hud/HackListHUD.java @@ -13,7 +13,7 @@ import java.util.Iterator; import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.util.Window; import net.wurstclient.WurstClient; import net.wurstclient.events.UpdateListener; @@ -34,7 +34,7 @@ public HackListHUD() WurstClient.INSTANCE.getEventManager().add(UpdateListener.class, this); } - public void render(DrawableHelper helper, float partialTicks) + public void render(DrawContext helper, float partialTicks) { if(otf.getMode() == Mode.HIDDEN) return; @@ -64,14 +64,14 @@ public void render(DrawableHelper helper, float partialTicks) drawHackList(helper, partialTicks); } - private void drawCounter(DrawableHelper helper) + private void drawCounter(DrawContext helper) { long size = activeHax.stream().filter(e -> e.hack.isEnabled()).count(); String s = size + " hack" + (size != 1 ? "s" : "") + " active"; drawString(helper, s); } - private void drawHackList(DrawableHelper helper, float partialTicks) + private void drawHackList(DrawContext helper, float partialTicks) { if(otf.isAnimations()) for(HackListEntry e : activeHax) @@ -129,7 +129,7 @@ else if(!enabled && e.offset >= 4) } } - private void drawString(DrawableHelper helper, String s) + private void drawString(DrawContext helper, String s) { TextRenderer tr = WurstClient.MC.textRenderer; int posX; @@ -144,13 +144,13 @@ private void drawString(DrawableHelper helper, String s) posX = screenWidth - stringWidth - 2; } - helper.method_51433(tr, s, posX + 1, posY + 1, 0xff000000, false); - helper.method_51433(tr, s, posX, posY, textColor | 0xff000000, false); + helper.drawText(tr, s, posX + 1, posY + 1, 0xff000000, false); + helper.drawText(tr, s, posX, posY, textColor | 0xff000000, false); posY += 9; } - private void drawWithOffset(DrawableHelper helper, HackListEntry e, + private void drawWithOffset(DrawContext helper, HackListEntry e, float partialTicks) { TextRenderer tr = WurstClient.MC.textRenderer; @@ -171,9 +171,9 @@ private void drawWithOffset(DrawableHelper helper, HackListEntry e, } int alpha = (int)(255 * (1 - offset / 4)) << 24; - helper.method_51433(tr, s, (int)posX + 1, posY + 1, 0x04000000 | alpha, + helper.drawText(tr, s, (int)posX + 1, posY + 1, 0x04000000 | alpha, false); - helper.method_51433(tr, s, (int)posX, posY, textColor | alpha, false); + helper.drawText(tr, s, (int)posX, posY, textColor | alpha, false); posY += 9; } diff --git a/src/main/java/net/wurstclient/hud/IngameHUD.java b/src/main/java/net/wurstclient/hud/IngameHUD.java index cd96e069bd..b0aa82d982 100644 --- a/src/main/java/net/wurstclient/hud/IngameHUD.java +++ b/src/main/java/net/wurstclient/hud/IngameHUD.java @@ -10,8 +10,7 @@ import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.systems.RenderSystem; - -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.wurstclient.WurstClient; import net.wurstclient.clickgui.ClickGui; import net.wurstclient.clickgui.screens.ClickGuiScreen; @@ -24,7 +23,7 @@ public final class IngameHUD implements GUIRenderListener private TabGui tabGui; @Override - public void onRenderGUI(DrawableHelper helper, float partialTicks) + public void onRenderGUI(DrawContext helper, float partialTicks) { if(!WurstClient.INSTANCE.isEnabled()) return; diff --git a/src/main/java/net/wurstclient/hud/TabGui.java b/src/main/java/net/wurstclient/hud/TabGui.java index 06b0c645c5..c9950f6e1a 100644 --- a/src/main/java/net/wurstclient/hud/TabGui.java +++ b/src/main/java/net/wurstclient/hud/TabGui.java @@ -15,8 +15,7 @@ import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.systems.RenderSystem; - -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.render.Tessellator; @@ -122,9 +121,9 @@ public void onKeyPress(KeyPressEvent event) } } - public void render(DrawableHelper helper, float partialTicks) + public void render(DrawContext helper, float partialTicks) { - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); if(tabGuiOtf.isHidden()) return; @@ -158,7 +157,7 @@ public void render(DrawableHelper helper, float partialTicks) if(i == selected) tabName = (tabOpened ? "<" : ">") + tabName; - helper.method_51433(WurstClient.MC.textRenderer, tabName, 2, textY, + helper.drawText(WurstClient.MC.textRenderer, tabName, 2, textY, txtColor, false); textY += 10; } @@ -193,7 +192,7 @@ public void render(DrawableHelper helper, float partialTicks) if(i == tab.selected) fName = ">" + fName; - helper.method_51433(WurstClient.MC.textRenderer, fName, 2, + helper.drawText(WurstClient.MC.textRenderer, fName, 2, tabTextY, txtColor, false); tabTextY += 10; } diff --git a/src/main/java/net/wurstclient/hud/WurstLogo.java b/src/main/java/net/wurstclient/hud/WurstLogo.java index d94885301b..670fabcbe0 100644 --- a/src/main/java/net/wurstclient/hud/WurstLogo.java +++ b/src/main/java/net/wurstclient/hud/WurstLogo.java @@ -13,7 +13,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.render.Tessellator; @@ -29,9 +29,9 @@ public final class WurstLogo private static final Identifier texture = new Identifier("wurst", "wurst_128.png"); - public void render(DrawableHelper helper) + public void render(DrawContext helper) { - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); WurstLogoOtf otf = WurstClient.INSTANCE.getOtfs().wurstLogoOtf; if(!otf.isVisible()) return; @@ -55,7 +55,7 @@ public void render(DrawableHelper helper) // draw version string GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_DEPTH_TEST); - helper.method_51433(tr, version, 74, 8, otf.getTextColor(), false); + helper.drawText(tr, version, 74, 8, otf.getTextColor(), false); // draw Wurst logo RenderSystem.setShaderColor(1, 1, 1, 1); diff --git a/src/main/java/net/wurstclient/mixin/GameMenuScreenMixin.java b/src/main/java/net/wurstclient/mixin/GameMenuScreenMixin.java index 54f152b2bf..4bafc9e68a 100644 --- a/src/main/java/net/wurstclient/mixin/GameMenuScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/GameMenuScreenMixin.java @@ -18,7 +18,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import net.fabricmc.fabric.api.client.screen.v1.Screens; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.GameMenuScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; @@ -112,7 +112,7 @@ private void openWurstOptions() @Inject(at = @At("TAIL"), method = "render(Lnet/minecraft/client/gui/DrawableHelper;IIF)V") - private void onRender(DrawableHelper helper, int mouseX, int mouseY, + private void onRender(DrawContext helper, int mouseX, int mouseY, float partialTicks, CallbackInfo ci) { if(!WurstClient.INSTANCE.isEnabled() || wurstOptionsButton == null) diff --git a/src/main/java/net/wurstclient/mixin/IngameHudMixin.java b/src/main/java/net/wurstclient/mixin/IngameHudMixin.java index 417e8eafe7..81ca18f90a 100644 --- a/src/main/java/net/wurstclient/mixin/IngameHudMixin.java +++ b/src/main/java/net/wurstclient/mixin/IngameHudMixin.java @@ -11,8 +11,7 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.hud.InGameHud; import net.minecraft.util.Identifier; import net.wurstclient.WurstClient; @@ -28,7 +27,7 @@ public class IngameHudMixin remap = false, ordinal = 3), method = "render(Lnet/minecraft/client/gui/DrawableHelper;F)V") - private void onRender(DrawableHelper helper, float partialTicks, + private void onRender(DrawContext helper, float partialTicks, CallbackInfo ci) { if(WurstClient.MC.options.debugEnabled) @@ -41,7 +40,7 @@ private void onRender(DrawableHelper helper, float partialTicks, @Inject(at = @At("HEAD"), method = "renderOverlay(Lnet/minecraft/client/gui/DrawableHelper;Lnet/minecraft/util/Identifier;F)V", cancellable = true) - private void onRenderOverlay(DrawableHelper helper, Identifier texture, + private void onRenderOverlay(DrawContext helper, Identifier texture, float opacity, CallbackInfo ci) { if(texture == null || texture.getPath() == null) diff --git a/src/main/java/net/wurstclient/mixin/ScreenMixin.java b/src/main/java/net/wurstclient/mixin/ScreenMixin.java index f0dbc1602c..070993fc95 100644 --- a/src/main/java/net/wurstclient/mixin/ScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/ScreenMixin.java @@ -17,8 +17,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import net.minecraft.client.gui.AbstractParentElement; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.Drawable; -import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.Screen; import net.wurstclient.WurstClient; import net.wurstclient.mixinterface.IScreen; @@ -34,7 +34,7 @@ public abstract class ScreenMixin extends AbstractParentElement @Inject(at = @At("HEAD"), method = "renderBackground(Lnet/minecraft/client/gui/DrawableHelper;)V", cancellable = true) - public void onRenderBackground(DrawableHelper helper, CallbackInfo ci) + public void onRenderBackground(DrawContext helper, CallbackInfo ci) { if(WurstClient.INSTANCE.getHax().noBackgroundHack .shouldCancelBackground((Screen)(Object)this)) diff --git a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java index 187f0eeda4..5297484e74 100644 --- a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java @@ -55,7 +55,7 @@ private void onCreateButtons(CallbackInfo ci) .equals(I18n.translate("gui.done"))) continue; - button.setX(width / 2 + 2); + button.method_46421(width / 2 + 2); button.setWidth(150); } } diff --git a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java index 28488e077b..87f2248691 100644 --- a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java @@ -77,7 +77,7 @@ private void onTick(CallbackInfo ci) // adjust AltManager button if Realms button has been moved // happens when ModMenu is installed - altsButton.setY(realmsButton.getY()); + altsButton.method_46419(realmsButton.getY()); } /** diff --git a/src/main/java/net/wurstclient/navigator/NavigatorFeatureScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorFeatureScreen.java index 69cb48293b..a848dbb35e 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorFeatureScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorFeatureScreen.java @@ -20,9 +20,8 @@ import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.systems.RenderSystem; - +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.Drawable; -import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.ClickableWidget; import net.minecraft.client.render.BufferBuilder; @@ -319,10 +318,10 @@ protected void onUpdate() } @Override - protected void onRender(DrawableHelper helper, int mouseX, int mouseY, + protected void onRender(DrawContext helper, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); ClickGui gui = WurstClient.INSTANCE.getGui(); int txtColor = gui.getTxtColor(); @@ -476,7 +475,7 @@ else if(mouseX >= x1 && mouseX <= x2 && mouseY >= y1 int textY = bgy1 + scroll + 2; for(String line : text.split("\n")) { - helper.method_51433(client.textRenderer, line, bgx1 + 2, textY, + helper.drawText(client.textRenderer, line, bgx1 + 2, textY, txtColor, false); textY += client.textRenderer.fontHeight; } @@ -519,7 +518,7 @@ else if(hovering) // text String buttonText = button.getMessage().getString(); - helper.method_51433(client.textRenderer, buttonText, + helper.drawText(client.textRenderer, buttonText, (x1 + x2 - client.textRenderer.getWidth(buttonText)) / 2, y1 + 5, txtColor, false); GL11.glEnable(GL11.GL_BLEND); diff --git a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java index ab6690b6fd..98051679a3 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java @@ -17,7 +17,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.TextFieldWidget; import net.minecraft.client.render.BufferBuilder; @@ -74,7 +74,7 @@ protected void onResize() setFocused(searchBar); searchBar.setFocused(true); - searchBar.setX(middleX - 100); + searchBar.method_46421(middleX - 100); setContentHeight(navigatorDisplayList.size() / 3 * 20); } @@ -228,10 +228,10 @@ public void mouseMoved(double mouseX, double mouseY) } @Override - protected void onRender(DrawableHelper helper, int mouseX, int mouseY, + protected void onRender(DrawContext helper, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); ClickGui gui = WurstClient.INSTANCE.getGui(); float[] bgColor = gui.getBgColor(); float[] acColor = gui.getAcColor(); @@ -329,15 +329,15 @@ protected void onRender(DrawableHelper helper, int mouseX, int mouseY, // text for(int i = 0; i < lines.length; i++) - helper.method_51433(tr, lines[i], xt1 + 2, + helper.drawText(tr, lines[i], xt1 + 2, yt1 + 2 + i * tr.fontHeight, txtColor, false); } } - private void renderFeature(DrawableHelper helper, int mouseX, int mouseY, + private void renderFeature(DrawContext helper, int mouseX, int mouseY, float partialTicks, int i, int x, int y) { - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); ClickGui gui = WurstClient.INSTANCE.getGui(); float[] bgColor = gui.getBgColor(); int txtColor = gui.getTxtColor(); @@ -475,7 +475,7 @@ else if(clickTimer == 0) RenderSystem.setShader(GameRenderer::getPositionProgram); RenderSystem.setShaderColor(1, 1, 1, 1); String buttonText = feature.getName(); - helper.method_51433(client.textRenderer, buttonText, area.x + 4, + helper.drawText(client.textRenderer, buttonText, area.x + 4, area.y + 4, txtColor, false); GL11.glEnable(GL11.GL_BLEND); } diff --git a/src/main/java/net/wurstclient/navigator/NavigatorNewKeybindScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorNewKeybindScreen.java index e98cb71f9a..71e1df6e87 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorNewKeybindScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorNewKeybindScreen.java @@ -14,9 +14,8 @@ import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.systems.RenderSystem; - +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.Drawable; -import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.ClickableWidget; import net.minecraft.client.util.InputUtil; @@ -157,10 +156,10 @@ protected void onUpdate() } @Override - protected void onRender(DrawableHelper helper, int mouseX, int mouseY, + protected void onRender(DrawContext helper, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); ClickGui gui = WurstClient.INSTANCE.getGui(); int txtColor = gui.getTxtColor(); diff --git a/src/main/java/net/wurstclient/navigator/NavigatorRemoveKeybindScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorRemoveKeybindScreen.java index 5b7d762e19..521a902538 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorRemoveKeybindScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorRemoveKeybindScreen.java @@ -16,9 +16,8 @@ import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.systems.RenderSystem; - +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.Drawable; -import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.ClickableWidget; import net.minecraft.client.util.math.MatrixStack; @@ -129,10 +128,10 @@ protected void onUpdate() } @Override - protected void onRender(DrawableHelper helper, int mouseX, int mouseY, + protected void onRender(DrawContext helper, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); ClickGui gui = WurstClient.INSTANCE.getGui(); int txtColor = gui.getTxtColor(); diff --git a/src/main/java/net/wurstclient/navigator/NavigatorScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorScreen.java index b08a07f862..3b7d48b05b 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorScreen.java @@ -13,8 +13,7 @@ import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.systems.RenderSystem; - -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; @@ -143,10 +142,10 @@ public final void tick() } @Override - public final void render(DrawableHelper helper, int mouseX, int mouseY, + public final void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); // GL settings GL11.glEnable(GL11.GL_BLEND); @@ -209,7 +208,7 @@ protected abstract void onMouseDrag(double mouseX, double mouseY, protected abstract void onUpdate(); - protected abstract void onRender(DrawableHelper helper, int mouseX, + protected abstract void onRender(DrawContext helper, int mouseX, int mouseY, float partialTicks); protected final int getStringHeight(String s) diff --git a/src/main/java/net/wurstclient/nochatreports/ForcedChatReportsScreen.java b/src/main/java/net/wurstclient/nochatreports/ForcedChatReportsScreen.java index 9918364e24..f97bb64b14 100644 --- a/src/main/java/net/wurstclient/nochatreports/ForcedChatReportsScreen.java +++ b/src/main/java/net/wurstclient/nochatreports/ForcedChatReportsScreen.java @@ -12,7 +12,7 @@ import java.util.function.Supplier; import net.minecraft.client.font.MultilineText; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.text.LiteralTextContent; @@ -101,7 +101,7 @@ private void toggleSignatures() } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float delta) { renderBackground(helper); diff --git a/src/main/java/net/wurstclient/nochatreports/NcrModRequiredScreen.java b/src/main/java/net/wurstclient/nochatreports/NcrModRequiredScreen.java index 695fa6ccaa..0db22a890e 100644 --- a/src/main/java/net/wurstclient/nochatreports/NcrModRequiredScreen.java +++ b/src/main/java/net/wurstclient/nochatreports/NcrModRequiredScreen.java @@ -12,7 +12,7 @@ import java.util.function.Supplier; import net.minecraft.client.font.MultilineText; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.text.Text; @@ -117,7 +117,7 @@ private void toggleVanillaSpoof() } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float delta) { renderBackground(helper); diff --git a/src/main/java/net/wurstclient/options/EnterProfileNameScreen.java b/src/main/java/net/wurstclient/options/EnterProfileNameScreen.java index 7804ea79db..fb59d5064e 100644 --- a/src/main/java/net/wurstclient/options/EnterProfileNameScreen.java +++ b/src/main/java/net/wurstclient/options/EnterProfileNameScreen.java @@ -12,7 +12,7 @@ import org.lwjgl.glfw.GLFW; import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -88,7 +88,7 @@ public void tick() } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { renderBackground(helper); diff --git a/src/main/java/net/wurstclient/options/KeybindEditorScreen.java b/src/main/java/net/wurstclient/options/KeybindEditorScreen.java index 0be5f364a0..9de18f5843 100644 --- a/src/main/java/net/wurstclient/options/KeybindEditorScreen.java +++ b/src/main/java/net/wurstclient/options/KeybindEditorScreen.java @@ -7,7 +7,7 @@ */ package net.wurstclient.options; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -94,7 +94,7 @@ public void tick() } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { renderBackground(helper); diff --git a/src/main/java/net/wurstclient/options/KeybindManagerScreen.java b/src/main/java/net/wurstclient/options/KeybindManagerScreen.java index b693a2276b..41aef4b31b 100644 --- a/src/main/java/net/wurstclient/options/KeybindManagerScreen.java +++ b/src/main/java/net/wurstclient/options/KeybindManagerScreen.java @@ -10,7 +10,7 @@ import org.lwjgl.glfw.GLFW; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.ConfirmScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; @@ -163,7 +163,7 @@ public void tick() } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { renderBackground(helper); @@ -222,16 +222,16 @@ protected void renderBackground() } @Override - protected void renderItem(DrawableHelper helper, int index, int x, + protected void renderItem(DrawContext helper, int index, int x, int y, int slotHeight, int mouseX, int mouseY, float partialTicks) { Keybind keybind = WurstClient.INSTANCE.getKeybinds().getAllKeybinds().get(index); - helper.method_51433(client.textRenderer, + helper.drawText(client.textRenderer, "Key: " + keybind.getKey().replace("key.keyboard.", ""), x + 3, y + 3, 0xa0a0a0, false); - helper.method_51433(client.textRenderer, + helper.drawText(client.textRenderer, "Commands: " + keybind.getCommands(), x + 3, y + 15, 0xa0a0a0, false); } diff --git a/src/main/java/net/wurstclient/options/KeybindProfilesScreen.java b/src/main/java/net/wurstclient/options/KeybindProfilesScreen.java index 8b29b38132..93eaeceef0 100644 --- a/src/main/java/net/wurstclient/options/KeybindProfilesScreen.java +++ b/src/main/java/net/wurstclient/options/KeybindProfilesScreen.java @@ -17,7 +17,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.text.Text; @@ -170,7 +170,7 @@ public void tick() } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { renderBackground(helper); @@ -182,7 +182,7 @@ public void render(DrawableHelper helper, int mouseX, int mouseY, super.render(helper, mouseX, mouseY, partialTicks); if(loadButton.isSelected() && !loadButton.active) - helper.method_51434(textRenderer, + helper.drawTooltip(textRenderer, Arrays.asList(Text.literal("You must first select a file.")), mouseX, mouseY); } @@ -236,7 +236,7 @@ protected void renderBackground() } @Override - protected void renderItem(DrawableHelper helper, int index, int x, + protected void renderItem(DrawContext helper, int index, int x, int y, int var4, int var5, int var6, float partialTicks) { TextRenderer tr = mc.textRenderer; diff --git a/src/main/java/net/wurstclient/options/PressAKeyScreen.java b/src/main/java/net/wurstclient/options/PressAKeyScreen.java index aa425a4624..abc05feeea 100644 --- a/src/main/java/net/wurstclient/options/PressAKeyScreen.java +++ b/src/main/java/net/wurstclient/options/PressAKeyScreen.java @@ -8,8 +8,7 @@ package net.wurstclient.options; import org.lwjgl.glfw.GLFW; - -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.util.InputUtil; import net.minecraft.text.Text; @@ -50,7 +49,7 @@ public boolean shouldCloseOnEsc() } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { renderBackground(helper); diff --git a/src/main/java/net/wurstclient/options/WurstOptionsScreen.java b/src/main/java/net/wurstclient/options/WurstOptionsScreen.java index 156b066d58..5dfd7eb707 100644 --- a/src/main/java/net/wurstclient/options/WurstOptionsScreen.java +++ b/src/main/java/net/wurstclient/options/WurstOptionsScreen.java @@ -12,8 +12,8 @@ import java.util.function.Supplier; import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.Drawable; -import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.ClickableWidget; @@ -146,7 +146,7 @@ public void close() } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { renderBackground(helper); @@ -155,7 +155,7 @@ public void render(DrawableHelper helper, int mouseX, int mouseY, renderButtonTooltip(helper, mouseX, mouseY); } - private void renderTitles(DrawableHelper helper) + private void renderTitles(DrawContext helper) { TextRenderer tr = client.textRenderer; int middleX = width / 2; @@ -173,7 +173,7 @@ private void renderTitles(DrawableHelper helper) 0xcccccc); } - private void renderButtonTooltip(DrawableHelper helper, int mouseX, + private void renderButtonTooltip(DrawContext helper, int mouseX, int mouseY) { for(Drawable d : ((IScreen)this).getButtons()) @@ -191,7 +191,7 @@ private void renderButtonTooltip(DrawableHelper helper, int mouseX, if(woButton.tooltip.isEmpty()) continue; - helper.method_51434(textRenderer, woButton.tooltip, mouseX, mouseY); + helper.drawTooltip(textRenderer, woButton.tooltip, mouseX, mouseY); break; } } diff --git a/src/main/java/net/wurstclient/options/ZoomManagerScreen.java b/src/main/java/net/wurstclient/options/ZoomManagerScreen.java index 22246d4d46..5d64483882 100644 --- a/src/main/java/net/wurstclient/options/ZoomManagerScreen.java +++ b/src/main/java/net/wurstclient/options/ZoomManagerScreen.java @@ -7,7 +7,7 @@ */ package net.wurstclient.options; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.option.KeyBinding; @@ -94,7 +94,7 @@ public void close() } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { ZoomOtf zoom = WurstClient.INSTANCE.getOtfs().zoomOtf; diff --git a/src/main/java/net/wurstclient/serverfinder/CleanUpScreen.java b/src/main/java/net/wurstclient/serverfinder/CleanUpScreen.java index 5f802849ea..813031e0de 100644 --- a/src/main/java/net/wurstclient/serverfinder/CleanUpScreen.java +++ b/src/main/java/net/wurstclient/serverfinder/CleanUpScreen.java @@ -14,8 +14,8 @@ import org.lwjgl.glfw.GLFW; import net.minecraft.SharedConstants; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.Drawable; -import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen; import net.minecraft.client.gui.screen.multiplayer.MultiplayerServerListWidget; @@ -201,7 +201,7 @@ public boolean keyPressed(int keyCode, int scanCode, int int_3) } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { renderBackground(helper); @@ -215,7 +215,7 @@ public void render(DrawableHelper helper, int mouseX, int mouseY, renderButtonTooltip(helper, mouseX, mouseY); } - private void renderButtonTooltip(DrawableHelper helper, int mouseX, + private void renderButtonTooltip(DrawContext helper, int mouseX, int mouseY) { for(Drawable d : ((IScreen)this).getButtons()) @@ -233,7 +233,7 @@ private void renderButtonTooltip(DrawableHelper helper, int mouseX, if(cuButton.tooltip.isEmpty()) continue; - helper.method_51434(textRenderer, cuButton.tooltip, mouseX, mouseY); + helper.drawTooltip(textRenderer, cuButton.tooltip, mouseX, mouseY); break; } } diff --git a/src/main/java/net/wurstclient/serverfinder/ServerFinderScreen.java b/src/main/java/net/wurstclient/serverfinder/ServerFinderScreen.java index 179693b606..cadec82f62 100644 --- a/src/main/java/net/wurstclient/serverfinder/ServerFinderScreen.java +++ b/src/main/java/net/wurstclient/serverfinder/ServerFinderScreen.java @@ -12,8 +12,7 @@ import java.util.ArrayList; import org.lwjgl.glfw.GLFW; - -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen; import net.minecraft.client.gui.widget.ButtonWidget; @@ -214,7 +213,7 @@ public boolean keyPressed(int keyCode, int scanCode, int int_3) } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float partialTicks) { renderBackground(helper); diff --git a/src/main/java/net/wurstclient/util/ListWidget.java b/src/main/java/net/wurstclient/util/ListWidget.java index f012a25365..1420112a4e 100644 --- a/src/main/java/net/wurstclient/util/ListWidget.java +++ b/src/main/java/net/wurstclient/util/ListWidget.java @@ -18,8 +18,8 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.AbstractParentElement; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.Drawable; -import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.gui.Element; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.render.BufferBuilder; @@ -94,7 +94,7 @@ protected int getMaxPosition() protected void updateItemPosition(int index, int x, int y, float delta) {} - protected abstract void renderItem(DrawableHelper helper, int x, int y, + protected abstract void renderItem(DrawContext helper, int x, int y, int itemHeight, int mouseX, int mouseY, int i, float f); protected void renderHeader(int x, int y, Tessellator tessellator) @@ -134,7 +134,7 @@ public boolean isMouseInList(double mouseX, double mouseY) } @Override - public void render(DrawableHelper helper, int mouseX, int mouseY, + public void render(DrawContext helper, int mouseX, int mouseY, float delta) { if(visible) @@ -145,7 +145,7 @@ public void render(DrawableHelper helper, int mouseX, int mouseY, capYPosition(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferBuilder = tessellator.getBuffer(); - RenderSystem.setShaderTexture(0, Screen.field_44669); + RenderSystem.setShaderTexture(0, Screen.OPTIONS_BACKGROUND_TEXTURE); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.setShader(GameRenderer::getPositionTexColorProgram); bufferBuilder.begin(VertexFormat.DrawMode.QUADS, @@ -374,7 +374,7 @@ public int getRowWidth() return 220; } - protected void renderList(DrawableHelper helper, int i, int j, int k, int l, + protected void renderList(DrawContext helper, int i, int j, int k, int l, float f) { int m = getItemCount(); @@ -435,7 +435,7 @@ protected void renderHoleBackground(int top, int bottom, int topAlpha, { Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferBuilder = tessellator.getBuffer(); - RenderSystem.setShaderTexture(0, Screen.field_44669); + RenderSystem.setShaderTexture(0, Screen.OPTIONS_BACKGROUND_TEXTURE); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.setShader(GameRenderer::getPositionTexColorProgram); bufferBuilder.begin(VertexFormat.DrawMode.QUADS, diff --git a/src/main/java/net/wurstclient/util/RenderUtils.java b/src/main/java/net/wurstclient/util/RenderUtils.java index e1da84d9f6..dd1e258367 100644 --- a/src/main/java/net/wurstclient/util/RenderUtils.java +++ b/src/main/java/net/wurstclient/util/RenderUtils.java @@ -16,7 +16,7 @@ import net.minecraft.block.Blocks; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gl.VertexBuffer; -import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.BufferBuilder.BuiltBuffer; import net.minecraft.client.render.Camera; @@ -864,10 +864,10 @@ public static void drawArrow(Vec3d from, Vec3d to, bufferBuilder.vertex(matrix, 0, 2, 1).next(); } - public static void drawItem(DrawableHelper helper, ItemStack stack, int x, + public static void drawItem(DrawContext helper, ItemStack stack, int x, int y, boolean large) { - MatrixStack matrixStack = helper.method_51448(); + MatrixStack matrixStack = helper.getMatrices(); matrixStack.push(); matrixStack.translate(x, y, 0); @@ -880,7 +880,7 @@ public static void drawItem(DrawableHelper helper, ItemStack stack, int x, ? new ItemStack(Blocks.GRASS_BLOCK) : stack; DiffuseLighting.enableGuiDepthLighting(); - helper.method_51427(renderStack, 0, 0); + helper.drawItem(renderStack, 0, 0); DiffuseLighting.disableGuiDepthLighting(); matrixStack.pop(); @@ -894,7 +894,7 @@ public static void drawItem(DrawableHelper helper, ItemStack stack, int x, GL11.glDisable(GL11.GL_DEPTH_TEST); TextRenderer tr = WurstClient.MC.textRenderer; - helper.method_51433(tr, "?", 3, 2, 0xf0f0f0, false); + helper.drawText(tr, "?", 3, 2, 0xf0f0f0, false); GL11.glEnable(GL11.GL_DEPTH_TEST); matrixStack.pop(); From 844fd142866d5a457709c4156b6984b314eb45b0 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Thu, 27 Apr 2023 14:10:20 +0200 Subject: [PATCH 056/282] Update to 23w17a --- .../wurstclient/altmanager/AltRenderer.java | 65 ++++++++++--------- .../altmanager/screens/AltEditorScreen.java | 27 ++++---- .../altmanager/screens/AltManagerScreen.java | 46 ++++++------- .../net/wurstclient/clickgui/ClickGui.java | 34 +++++----- .../wurstclient/clickgui/ComboBoxPopup.java | 10 +-- .../net/wurstclient/clickgui/Component.java | 2 +- .../java/net/wurstclient/clickgui/Popup.java | 2 +- .../components/AbstractListEditButton.java | 8 +-- .../clickgui/components/BlockComponent.java | 8 +-- .../components/CheckboxComponent.java | 10 +-- .../clickgui/components/ColorComponent.java | 12 ++-- .../components/ComboBoxComponent.java | 12 ++-- .../clickgui/components/FeatureButton.java | 10 +-- .../clickgui/components/FileComponent.java | 8 +-- .../clickgui/components/RadarComponent.java | 5 +- .../clickgui/components/SliderComponent.java | 13 ++-- .../clickgui/screens/AddBookOfferScreen.java | 36 +++++----- .../clickgui/screens/ClickGuiScreen.java | 6 +- .../clickgui/screens/EditBlockListScreen.java | 46 ++++++------- .../clickgui/screens/EditBlockScreen.java | 34 +++++----- .../clickgui/screens/EditBookOfferScreen.java | 32 ++++----- .../screens/EditBookOffersScreen.java | 26 ++++---- .../clickgui/screens/EditColorScreen.java | 32 ++++----- .../clickgui/screens/EditItemListScreen.java | 46 ++++++------- .../clickgui/screens/EditSliderScreen.java | 12 ++-- .../clickgui/screens/SelectFileScreen.java | 22 +++---- .../net/wurstclient/commands/TacoCmd.java | 5 +- .../wurstclient/events/GUIRenderListener.java | 11 ++-- .../net/wurstclient/hacks/BowAimbotHack.java | 7 +- .../net/wurstclient/hacks/ExcavatorHack.java | 6 +- .../net/wurstclient/hacks/NewChunksHack.java | 3 +- .../java/net/wurstclient/hud/HackListHUD.java | 28 ++++---- .../java/net/wurstclient/hud/IngameHUD.java | 11 ++-- src/main/java/net/wurstclient/hud/TabGui.java | 9 +-- .../java/net/wurstclient/hud/WurstLogo.java | 8 +-- .../mixin/GameMenuScreenMixin.java | 6 +- .../net/wurstclient/mixin/IngameHudMixin.java | 11 ++-- .../mixin/PlayerSkinProviderMixin.java | 16 ++--- .../net/wurstclient/mixin/ScreenMixin.java | 4 +- .../wurstclient/mixin/StatsScreenMixin.java | 2 +- .../wurstclient/mixin/TitleScreenMixin.java | 2 +- .../navigator/NavigatorFeatureScreen.java | 19 +++--- .../navigator/NavigatorMainScreen.java | 20 +++--- .../navigator/NavigatorNewKeybindScreen.java | 18 ++--- .../NavigatorRemoveKeybindScreen.java | 20 +++--- .../navigator/NavigatorScreen.java | 9 +-- .../ForcedChatReportsScreen.java | 11 ++-- .../nochatreports/NcrModRequiredScreen.java | 11 ++-- .../options/EnterProfileNameScreen.java | 10 +-- .../options/KeybindEditorScreen.java | 14 ++-- .../options/KeybindManagerScreen.java | 20 +++--- .../options/KeybindProfilesScreen.java | 20 +++--- .../wurstclient/options/PressAKeyScreen.java | 9 +-- .../options/WurstOptionsScreen.java | 24 +++---- .../options/ZoomManagerScreen.java | 10 +-- .../serverfinder/CleanUpScreen.java | 16 ++--- .../serverfinder/ServerFinderScreen.java | 29 +++++---- .../java/net/wurstclient/util/ChunkUtils.java | 19 ++++++ .../java/net/wurstclient/util/ListWidget.java | 11 ++-- .../net/wurstclient/util/RenderUtils.java | 8 +-- src/main/resources/fabric.mod.json | 2 +- 61 files changed, 511 insertions(+), 482 deletions(-) diff --git a/src/main/java/net/wurstclient/altmanager/AltRenderer.java b/src/main/java/net/wurstclient/altmanager/AltRenderer.java index 685e184263..5d83d0ad9a 100644 --- a/src/main/java/net/wurstclient/altmanager/AltRenderer.java +++ b/src/main/java/net/wurstclient/altmanager/AltRenderer.java @@ -15,6 +15,7 @@ import com.mojang.authlib.GameProfile; import com.mojang.blaze3d.systems.RenderSystem; + import net.minecraft.client.gui.DrawContext; import net.minecraft.client.network.PlayerListEntry; import net.minecraft.client.render.BufferBuilder; @@ -52,8 +53,8 @@ private static void bindSkinTexture(String name) RenderSystem.setShaderTexture(0, loadedSkins.get(name)); } - private static void drawTexture(DrawContext helper, int x, int y, - float u, float v, int w, int h, int fw, int fh) + private static void drawTexture(DrawContext context, int x, int y, float u, + float v, int w, int h, int fw, int fh) { int x2 = x + w; int y2 = y + h; @@ -64,7 +65,7 @@ private static void drawTexture(DrawContext helper, int x, int y, float vPlusHOverFh = (v + h) / fh; RenderSystem.setShader(GameRenderer::getPositionTexProgram); - MatrixStack matrixStack = helper.getMatrices(); + MatrixStack matrixStack = context.getMatrices(); Matrix4f matrix4f = matrixStack.peek().getPositionMatrix(); BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer(); bufferBuilder.begin(VertexFormat.DrawMode.QUADS, @@ -80,7 +81,7 @@ private static void drawTexture(DrawContext helper, int x, int y, BufferRenderer.drawWithGlobalProgram(bufferBuilder.end()); } - public static void drawAltFace(DrawContext helper, String name, int x, + public static void drawAltFace(DrawContext context, String name, int x, int y, int w, int h, boolean selected) { try @@ -98,14 +99,14 @@ public static void drawAltFace(DrawContext helper, String name, int x, int fh = 192; float u = 24; float v = 24; - drawTexture(helper, x, y, u, v, w, h, fw, fh); + drawTexture(context, x, y, u, v, w, h, fw, fh); // Hat fw = 192; fh = 192; u = 120; v = 24; - drawTexture(helper, x, y, u, v, w, h, fw, fh); + drawTexture(context, x, y, u, v, w, h, fw, fh); GL11.glDisable(GL11.GL_BLEND); @@ -115,7 +116,7 @@ public static void drawAltFace(DrawContext helper, String name, int x, } } - public static void drawAltBody(DrawContext helper, String name, int x, + public static void drawAltBody(DrawContext context, String name, int x, int y, int width, int height) { try @@ -137,7 +138,7 @@ public static void drawAltBody(DrawContext helper, String name, int x, int fh = height * 2; float u = height / 4; float v = height / 4; - drawTexture(helper, x, y, u, v, w, h, fw, fh); + drawTexture(context, x, y, u, v, w, h, fw, fh); // Hat x = x + 0; @@ -146,7 +147,7 @@ public static void drawAltBody(DrawContext helper, String name, int x, h = height / 4; u = height / 4 * 5; v = height / 4; - drawTexture(helper, x, y, u, v, w, h, fw, fh); + drawTexture(context, x, y, u, v, w, h, fw, fh); // Chest x = x + 0; @@ -155,7 +156,7 @@ public static void drawAltBody(DrawContext helper, String name, int x, h = height / 8 * 3; u = height / 4 * 2.5F; v = height / 4 * 2.5F; - drawTexture(helper, x, y, u, v, w, h, fw, fh); + drawTexture(context, x, y, u, v, w, h, fw, fh); // Jacket x = x + 0; @@ -164,7 +165,7 @@ public static void drawAltBody(DrawContext helper, String name, int x, h = height / 8 * 3; u = height / 4 * 2.5F; v = height / 4 * 4.5F; - drawTexture(helper, x, y, u, v, w, h, fw, fh); + drawTexture(context, x, y, u, v, w, h, fw, fh); // Left Arm x = x - width / 16 * (slim ? 3 : 4); @@ -173,7 +174,7 @@ public static void drawAltBody(DrawContext helper, String name, int x, h = height / 8 * 3; u = height / 4 * 5.5F; v = height / 4 * 2.5F; - drawTexture(helper, x, y, u, v, w, h, fw, fh); + drawTexture(context, x, y, u, v, w, h, fw, fh); // Left Sleeve x = x + 0; @@ -182,7 +183,7 @@ public static void drawAltBody(DrawContext helper, String name, int x, h = height / 8 * 3; u = height / 4 * 5.5F; v = height / 4 * 4.5F; - drawTexture(helper, x, y, u, v, w, h, fw, fh); + drawTexture(context, x, y, u, v, w, h, fw, fh); // Right Arm x = x + width / 16 * (slim ? 11 : 12); @@ -191,7 +192,7 @@ public static void drawAltBody(DrawContext helper, String name, int x, h = height / 8 * 3; u = height / 4 * 5.5F; v = height / 4 * 2.5F; - drawTexture(helper, x, y, u, v, w, h, fw, fh); + drawTexture(context, x, y, u, v, w, h, fw, fh); // Right Sleeve x = x + 0; @@ -200,7 +201,7 @@ public static void drawAltBody(DrawContext helper, String name, int x, h = height / 8 * 3; u = height / 4 * 5.5F; v = height / 4 * 4.5F; - drawTexture(helper, x, y, u, v, w, h, fw, fh); + drawTexture(context, x, y, u, v, w, h, fw, fh); // Left Leg x = x - width / 2; @@ -209,7 +210,7 @@ public static void drawAltBody(DrawContext helper, String name, int x, h = height / 8 * 3; u = height / 4 * 0.5F; v = height / 4 * 2.5F; - drawTexture(helper, x, y, u, v, w, h, fw, fh); + drawTexture(context, x, y, u, v, w, h, fw, fh); // Left Pants x = x + 0; @@ -218,7 +219,7 @@ public static void drawAltBody(DrawContext helper, String name, int x, h = height / 8 * 3; u = height / 4 * 0.5F; v = height / 4 * 4.5F; - drawTexture(helper, x, y, u, v, w, h, fw, fh); + drawTexture(context, x, y, u, v, w, h, fw, fh); // Right Leg x = x + width / 4; @@ -227,7 +228,7 @@ public static void drawAltBody(DrawContext helper, String name, int x, h = height / 8 * 3; u = height / 4 * 0.5F; v = height / 4 * 2.5F; - drawTexture(helper, x, y, u, v, w, h, fw, fh); + drawTexture(context, x, y, u, v, w, h, fw, fh); // Right Pants x = x + 0; @@ -236,7 +237,7 @@ public static void drawAltBody(DrawContext helper, String name, int x, h = height / 8 * 3; u = height / 4 * 0.5F; v = height / 4 * 4.5F; - drawTexture(helper, x, y, u, v, w, h, fw, fh); + drawTexture(context, x, y, u, v, w, h, fw, fh); GL11.glDisable(GL11.GL_BLEND); @@ -246,7 +247,7 @@ public static void drawAltBody(DrawContext helper, String name, int x, } } - public static void drawAltBack(DrawContext helper, String name, int x, + public static void drawAltBack(DrawContext context, String name, int x, int y, int width, int height) { try @@ -268,7 +269,7 @@ public static void drawAltBack(DrawContext helper, String name, int x, int fh = height * 2; float u = height / 4 * 3; float v = height / 4; - drawTexture(helper, x, y, u, v, w, h, fw, fh); + drawTexture(context, x, y, u, v, w, h, fw, fh); // Hat x = x + 0; @@ -277,7 +278,7 @@ public static void drawAltBack(DrawContext helper, String name, int x, h = height / 4; u = height / 4 * 7; v = height / 4; - drawTexture(helper, x, y, u, v, w, h, fw, fh); + drawTexture(context, x, y, u, v, w, h, fw, fh); // Chest x = x + 0; @@ -286,7 +287,7 @@ public static void drawAltBack(DrawContext helper, String name, int x, h = height / 8 * 3; u = height / 4 * 4; v = height / 4 * 2.5F; - drawTexture(helper, x, y, u, v, w, h, fw, fh); + drawTexture(context, x, y, u, v, w, h, fw, fh); // Jacket x = x + 0; @@ -295,7 +296,7 @@ public static void drawAltBack(DrawContext helper, String name, int x, h = height / 8 * 3; u = height / 4 * 4; v = height / 4 * 4.5F; - drawTexture(helper, x, y, u, v, w, h, fw, fh); + drawTexture(context, x, y, u, v, w, h, fw, fh); // Left Arm x = x - width / 16 * (slim ? 3 : 4); @@ -304,7 +305,7 @@ public static void drawAltBack(DrawContext helper, String name, int x, h = height / 8 * 3; u = height / 4 * (slim ? 6.375F : 6.5F); v = height / 4 * 2.5F; - drawTexture(helper, x, y, u, v, w, h, fw, fh); + drawTexture(context, x, y, u, v, w, h, fw, fh); // Left Sleeve x = x + 0; @@ -313,7 +314,7 @@ public static void drawAltBack(DrawContext helper, String name, int x, h = height / 8 * 3; u = height / 4 * (slim ? 6.375F : 6.5F); v = height / 4 * 4.5F; - drawTexture(helper, x, y, u, v, w, h, fw, fh); + drawTexture(context, x, y, u, v, w, h, fw, fh); // Right Arm x = x + width / 16 * (slim ? 11 : 12); @@ -322,7 +323,7 @@ public static void drawAltBack(DrawContext helper, String name, int x, h = height / 8 * 3; u = height / 4 * (slim ? 6.375F : 6.5F); v = height / 4 * 2.5F; - drawTexture(helper, x, y, u, v, w, h, fw, fh); + drawTexture(context, x, y, u, v, w, h, fw, fh); // Right Sleeve x = x + 0; @@ -331,7 +332,7 @@ public static void drawAltBack(DrawContext helper, String name, int x, h = height / 8 * 3; u = height / 4 * (slim ? 6.375F : 6.5F); v = height / 4 * 4.5F; - drawTexture(helper, x, y, u, v, w, h, fw, fh); + drawTexture(context, x, y, u, v, w, h, fw, fh); // Left Leg x = x - width / 2; @@ -340,7 +341,7 @@ public static void drawAltBack(DrawContext helper, String name, int x, h = height / 8 * 3; u = height / 4 * 1.5F; v = height / 4 * 2.5F; - drawTexture(helper, x, y, u, v, w, h, fw, fh); + drawTexture(context, x, y, u, v, w, h, fw, fh); // Left Pants x = x + 0; @@ -349,7 +350,7 @@ public static void drawAltBack(DrawContext helper, String name, int x, h = height / 8 * 3; u = height / 4 * 1.5F; v = height / 4 * 4.5F; - drawTexture(helper, x, y, u, v, w, h, fw, fh); + drawTexture(context, x, y, u, v, w, h, fw, fh); // Right Leg x = x + width / 4; @@ -358,7 +359,7 @@ public static void drawAltBack(DrawContext helper, String name, int x, h = height / 8 * 3; u = height / 4 * 1.5F; v = height / 4 * 2.5F; - drawTexture(helper, x, y, u, v, w, h, fw, fh); + drawTexture(context, x, y, u, v, w, h, fw, fh); // Right Pants x = x + 0; @@ -367,7 +368,7 @@ public static void drawAltBack(DrawContext helper, String name, int x, h = height / 8 * 3; u = height / 4 * 1.5F; v = height / 4 * 4.5F; - drawTexture(helper, x, y, u, v, w, h, fw, fh); + drawTexture(context, x, y, u, v, w, h, fw, fh); GL11.glDisable(GL11.GL_BLEND); diff --git a/src/main/java/net/wurstclient/altmanager/screens/AltEditorScreen.java b/src/main/java/net/wurstclient/altmanager/screens/AltEditorScreen.java index 2ef9b5f710..1a0d3bb759 100644 --- a/src/main/java/net/wurstclient/altmanager/screens/AltEditorScreen.java +++ b/src/main/java/net/wurstclient/altmanager/screens/AltEditorScreen.java @@ -27,6 +27,7 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.mojang.blaze3d.systems.RenderSystem; + import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; @@ -342,40 +343,40 @@ public boolean mouseClicked(double x, double y, int button) } @Override - public void render(DrawContext helper, int mouseX, int mouseY, + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(helper); + renderBackground(context); - MatrixStack matrixStack = helper.getMatrices(); + MatrixStack matrixStack = context.getMatrices(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); RenderSystem.setShader(GameRenderer::getPositionProgram); // skin preview - AltRenderer.drawAltBack(helper, nameOrEmailBox.getText(), + AltRenderer.drawAltBack(context, nameOrEmailBox.getText(), (width / 2 - 100) / 2 - 64, height / 2 - 128, 128, 256); - AltRenderer.drawAltBody(helper, nameOrEmailBox.getText(), + AltRenderer.drawAltBody(context, nameOrEmailBox.getText(), width - (width / 2 - 100) / 2 - 64, height / 2 - 128, 128, 256); // text - helper.drawTextWithShadow(textRenderer, "Name (for cracked alts), or", + context.drawTextWithShadow(textRenderer, "Name (for cracked alts), or", width / 2 - 100, 37, 10526880); - helper.drawTextWithShadow(textRenderer, "E-Mail (for premium alts)", + context.drawTextWithShadow(textRenderer, "E-Mail (for premium alts)", width / 2 - 100, 47, 10526880); - helper.drawTextWithShadow(textRenderer, + context.drawTextWithShadow(textRenderer, "Password (leave blank for cracked alts)", width / 2 - 100, 87, 10526880); String[] lines = message.split("\n"); for(int i = 0; i < lines.length; i++) - helper.drawCenteredTextWithShadow(textRenderer, lines[i], width / 2, - 142 + 10 * i, 16777215); + context.drawCenteredTextWithShadow(textRenderer, lines[i], + width / 2, 142 + 10 * i, 16777215); // text boxes - nameOrEmailBox.render(helper, mouseX, mouseY, partialTicks); - passwordBox.render(helper, mouseX, mouseY, partialTicks); + nameOrEmailBox.render(context, mouseX, mouseY, partialTicks); + passwordBox.render(context, mouseX, mouseY, partialTicks); // red flash for errors if(errorTimer > 0) @@ -398,7 +399,7 @@ public void render(DrawContext helper, int mouseX, int mouseY, errorTimer--; } - super.render(helper, mouseX, mouseY, partialTicks); + super.render(context, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/altmanager/screens/AltManagerScreen.java b/src/main/java/net/wurstclient/altmanager/screens/AltManagerScreen.java index 07a85536ce..12656b70ee 100644 --- a/src/main/java/net/wurstclient/altmanager/screens/AltManagerScreen.java +++ b/src/main/java/net/wurstclient/altmanager/screens/AltManagerScreen.java @@ -409,13 +409,13 @@ private void confirmRemove(boolean confirmed) } @Override - public void render(DrawContext helper, int mouseX, int mouseY, + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(helper); - listGui.render(helper, mouseX, mouseY, partialTicks); + renderBackground(context); + listGui.render(context, mouseX, mouseY, partialTicks); - MatrixStack matrixStack = helper.getMatrices(); + MatrixStack matrixStack = context.getMatrices(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); @@ -429,19 +429,19 @@ public void render(DrawContext helper, int mouseX, int mouseY, if(alt == null) return; - AltRenderer.drawAltBack(helper, alt.getName(), + AltRenderer.drawAltBack(context, alt.getName(), (width / 2 - 125) / 2 - 32, height / 2 - 64 - 9, 64, 128); - AltRenderer.drawAltBody(helper, alt.getName(), + AltRenderer.drawAltBody(context, alt.getName(), width - (width / 2 - 140) / 2 - 32, height / 2 - 64 - 9, 64, 128); } // title text - helper.drawCenteredTextWithShadow(textRenderer, "Alt Manager", + context.drawCenteredTextWithShadow(textRenderer, "Alt Manager", width / 2, 4, 16777215); - helper.drawCenteredTextWithShadow(textRenderer, + context.drawCenteredTextWithShadow(textRenderer, "Alts: " + altManager.getList().size(), width / 2, 14, 10526880); - helper.drawCenteredTextWithShadow( + context.drawCenteredTextWithShadow( textRenderer, "premium: " + altManager.getNumPremium() + ", cracked: " + altManager.getNumCracked(), width / 2, 24, 10526880); @@ -468,12 +468,12 @@ public void render(DrawContext helper, int mouseX, int mouseY, errorTimer--; } - super.render(helper, mouseX, mouseY, partialTicks); - renderButtonTooltip(helper, mouseX, mouseY); - renderAltTooltip(helper, mouseX, mouseY); + super.render(context, mouseX, mouseY, partialTicks); + renderButtonTooltip(context, mouseX, mouseY); + renderAltTooltip(context, mouseX, mouseY); } - private void renderAltTooltip(DrawContext helper, int mouseX, int mouseY) + private void renderAltTooltip(DrawContext context, int mouseX, int mouseY) { if(!listGui.isMouseInList(mouseX, mouseY)) return; @@ -515,10 +515,10 @@ private void renderAltTooltip(DrawContext helper, int mouseX, int mouseY) if(alt.isFavorite()) addTooltip(tooltip, "favorite"); - helper.drawTooltip(textRenderer, tooltip, mouseX, mouseY); + context.drawTooltip(textRenderer, tooltip, mouseX, mouseY); } - private void renderButtonTooltip(DrawContext helper, int mouseX, + private void renderButtonTooltip(DrawContext context, int mouseX, int mouseY) { for(Drawable d : ((IScreen)(Object)this).getButtons()) @@ -542,7 +542,7 @@ private void renderButtonTooltip(DrawContext helper, int mouseX, else addTooltip(tooltip, "window_freeze"); - helper.drawTooltip(textRenderer, tooltip, mouseX, mouseY); + context.drawTooltip(textRenderer, tooltip, mouseX, mouseY); break; } } @@ -637,12 +637,12 @@ protected void renderBackground() } @Override - protected void renderItem(DrawContext helper, int id, int x, int y, + protected void renderItem(DrawContext context, int id, int x, int y, int var4, int var5, int var6, float partialTicks) { Alt alt = list.get(id); - MatrixStack matrixStack = helper.getMatrices(); + MatrixStack matrixStack = context.getMatrices(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); @@ -673,19 +673,19 @@ protected void renderItem(DrawContext helper, int id, int x, int y, } // face - AltRenderer.drawAltFace(helper, alt.getName(), x + 1, y + 1, 24, 24, - isSelectedItem(id)); + AltRenderer.drawAltFace(context, alt.getName(), x + 1, y + 1, 24, + 24, isSelectedItem(id)); // name / email - helper.drawText(client.textRenderer, + context.drawText(client.textRenderer, "Name: " + alt.getDisplayName(), x + 31, y + 3, 10526880, false); - helper.drawText(client.textRenderer, + context.drawText(client.textRenderer, "Name: " + alt.getDisplayName(), x + 31, y + 3, 10526880, false); String bottomText = getBottomText(alt); - helper.drawText(client.textRenderer, bottomText, x + 31, y + 15, + context.drawText(client.textRenderer, bottomText, x + 31, y + 15, 10526880, false); } diff --git a/src/main/java/net/wurstclient/clickgui/ClickGui.java b/src/main/java/net/wurstclient/clickgui/ClickGui.java index d2d9369b63..7b28bd9e03 100644 --- a/src/main/java/net/wurstclient/clickgui/ClickGui.java +++ b/src/main/java/net/wurstclient/clickgui/ClickGui.java @@ -460,7 +460,7 @@ private void handleComponentMouseClick(Window window, double mouseX, } } - public void render(DrawContext helper, int mouseX, int mouseY, + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { updateColors(); @@ -494,19 +494,19 @@ public void render(DrawContext helper, int mouseX, int mouseY, else window.stopDraggingScrollbar(); - renderWindow(helper, window, mouseX, mouseY, partialTicks); + renderWindow(context, window, mouseX, mouseY, partialTicks); } - renderPopups(helper, mouseX, mouseY); - renderTooltip(helper, mouseX, mouseY); + renderPopups(context, mouseX, mouseY); + renderTooltip(context, mouseX, mouseY); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); } - public void renderPopups(DrawContext helper, int mouseX, int mouseY) + public void renderPopups(DrawContext context, int mouseX, int mouseY) { - MatrixStack matrixStack = helper.getMatrices(); + MatrixStack matrixStack = context.getMatrices(); for(Popup popup : popups) { Component owner = popup.getOwner(); @@ -521,15 +521,15 @@ public void renderPopups(DrawContext helper, int mouseX, int mouseY) int cMouseX = mouseX - x1; int cMouseY = mouseY - y1; - popup.render(helper, cMouseX, cMouseY); + popup.render(context, cMouseX, cMouseY); matrixStack.pop(); } } - public void renderTooltip(DrawContext helper, int mouseX, int mouseY) + public void renderTooltip(DrawContext context, int mouseX, int mouseY) { - MatrixStack matrixStack = helper.getMatrices(); + MatrixStack matrixStack = context.getMatrices(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); @@ -586,14 +586,14 @@ public void renderTooltip(DrawContext helper, int mouseX, int mouseY) // text RenderSystem.setShaderColor(1, 1, 1, 1); for(int i = 0; i < lines.length; i++) - helper.drawText(fr, lines[i], xt1 + 2, - yt1 + 2 + i * fr.fontHeight, txtColor, false); + context.drawText(fr, lines[i], xt1 + 2, yt1 + 2 + i * fr.fontHeight, + txtColor, false); GL11.glEnable(GL11.GL_BLEND); matrixStack.pop(); } - public void renderPinnedWindows(DrawContext helper, float partialTicks) + public void renderPinnedWindows(DrawContext context, float partialTicks) { GL11.glDisable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_BLEND); @@ -602,7 +602,7 @@ public void renderPinnedWindows(DrawContext helper, float partialTicks) for(Window window : windows) if(window.isPinned() && !window.isInvisible()) - renderWindow(helper, window, Integer.MIN_VALUE, + renderWindow(context, window, Integer.MIN_VALUE, Integer.MIN_VALUE, partialTicks); GL11.glEnable(GL11.GL_CULL_FACE); @@ -626,7 +626,7 @@ public void updateColors() acColor = clickGui.getAccentColor(); } - private void renderWindow(DrawContext helper, Window window, int mouseX, + private void renderWindow(DrawContext context, Window window, int mouseX, int mouseY, float partialTicks) { int x1 = window.getX(); @@ -635,7 +635,7 @@ private void renderWindow(DrawContext helper, Window window, int mouseX, int y2 = y1 + window.getHeight(); int y3 = y1 + 13; - MatrixStack matrixStack = helper.getMatrices(); + MatrixStack matrixStack = context.getMatrices(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); @@ -796,7 +796,7 @@ private void renderWindow(DrawContext helper, Window window, int mouseX, int cMouseX = mouseX - x1; int cMouseY = mouseY - y4; for(int i = 0; i < window.countChildren(); i++) - window.getChild(i).render(helper, cMouseX, cMouseY, + window.getChild(i).render(context, cMouseX, cMouseY, partialTicks); matrixStack.pop(); @@ -892,7 +892,7 @@ private void renderWindow(DrawContext helper, Window window, int mouseX, TextRenderer fr = MC.textRenderer; String title = fr.trimToWidth(Text.literal(window.getTitle()), x3 - x1) .getString(); - helper.drawText(fr, title, x1 + 2, y1 + 3, txtColor, false); + context.drawText(fr, title, x1 + 2, y1 + 3, txtColor, false); GL11.glEnable(GL11.GL_BLEND); } diff --git a/src/main/java/net/wurstclient/clickgui/ComboBoxPopup.java b/src/main/java/net/wurstclient/clickgui/ComboBoxPopup.java index 674699b040..0587f5db47 100644 --- a/src/main/java/net/wurstclient/clickgui/ComboBoxPopup.java +++ b/src/main/java/net/wurstclient/clickgui/ComboBoxPopup.java @@ -70,9 +70,9 @@ public void handleMouseClick(int mouseX, int mouseY, int mouseButton) } @Override - public void render(DrawContext helper, int mouseX, int mouseY) + public void render(DrawContext context, int mouseX, int mouseY) { - MatrixStack matrixStack = helper.getMatrices(); + MatrixStack matrixStack = context.getMatrices(); int x1 = getX(); int x2 = x1 + getWidth(); int y1 = getY(); @@ -99,7 +99,7 @@ public void render(DrawContext helper, int mouseX, int mouseY) boolean hValue = hovering && mouseY >= yi1 && mouseY < yi2; drawValueBackground(matrixStack, x1, x2, yi1, yi2, hValue); - drawValueName(helper, x1, yi1, value); + drawValueName(context, x1, yi1, value); } } @@ -150,14 +150,14 @@ private void drawValueBackground(MatrixStack matrixStack, int x1, int x2, tessellator.draw(); } - private void drawValueName(DrawContext helper, int x1, int yi1, + private void drawValueName(DrawContext context, int x1, int yi1, Enum value) { ClickGui gui = WurstClient.INSTANCE.getGui(); int txtColor = gui.getTxtColor(); RenderSystem.setShaderColor(1, 1, 1, 1); - helper.drawText(tr, value.toString(), x1 + 2, yi1 + 2, txtColor, + context.drawText(tr, value.toString(), x1 + 2, yi1 + 2, txtColor, false); GL11.glEnable(GL11.GL_BLEND); } diff --git a/src/main/java/net/wurstclient/clickgui/Component.java b/src/main/java/net/wurstclient/clickgui/Component.java index 52b98005da..b826fd847c 100644 --- a/src/main/java/net/wurstclient/clickgui/Component.java +++ b/src/main/java/net/wurstclient/clickgui/Component.java @@ -23,7 +23,7 @@ public void handleMouseClick(double mouseX, double mouseY, int mouseButton) } - public abstract void render(DrawContext helper, int mouseX, int mouseY, + public abstract void render(DrawContext context, int mouseX, int mouseY, float partialTicks); public abstract int getDefaultWidth(); diff --git a/src/main/java/net/wurstclient/clickgui/Popup.java b/src/main/java/net/wurstclient/clickgui/Popup.java index 296b5f34bd..240f7ba31b 100644 --- a/src/main/java/net/wurstclient/clickgui/Popup.java +++ b/src/main/java/net/wurstclient/clickgui/Popup.java @@ -27,7 +27,7 @@ public Popup(Component owner) public abstract void handleMouseClick(int mouseX, int mouseY, int mouseButton); - public abstract void render(DrawContext helper, int mouseX, int mouseY); + public abstract void render(DrawContext context, int mouseX, int mouseY); public abstract int getDefaultWidth(); diff --git a/src/main/java/net/wurstclient/clickgui/components/AbstractListEditButton.java b/src/main/java/net/wurstclient/clickgui/components/AbstractListEditButton.java index b9c0c763bb..37ab63e942 100644 --- a/src/main/java/net/wurstclient/clickgui/components/AbstractListEditButton.java +++ b/src/main/java/net/wurstclient/clickgui/components/AbstractListEditButton.java @@ -57,7 +57,7 @@ public void handleMouseClick(double mouseX, double mouseY, int mouseButton) } @Override - public void render(DrawContext helper, int mouseX, int mouseY, + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { ClickGui gui = WurstClient.INSTANCE.getGui(); @@ -80,7 +80,7 @@ public void render(DrawContext helper, int mouseX, int mouseY, boolean hText = hovering && mouseX < x3; boolean hBox = hovering && mouseX >= x3; - MatrixStack matrixStack = helper.getMatrices(); + MatrixStack matrixStack = context.getMatrices(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); @@ -124,8 +124,8 @@ public void render(DrawContext helper, int mouseX, int mouseY, // setting name RenderSystem.setShaderColor(1, 1, 1, 1); TextRenderer tr = MC.textRenderer; - helper.drawText(tr, getText(), x1, y1 + 2, txtColor, false); - helper.drawText(tr, buttonText, x3 + 2, y1 + 2, txtColor, false); + context.drawText(tr, getText(), x1, y1 + 2, txtColor, false); + context.drawText(tr, buttonText, x3 + 2, y1 + 2, txtColor, false); GL11.glEnable(GL11.GL_BLEND); } diff --git a/src/main/java/net/wurstclient/clickgui/components/BlockComponent.java b/src/main/java/net/wurstclient/clickgui/components/BlockComponent.java index fb6d61f0f5..890f1e8c4b 100644 --- a/src/main/java/net/wurstclient/clickgui/components/BlockComponent.java +++ b/src/main/java/net/wurstclient/clickgui/components/BlockComponent.java @@ -62,7 +62,7 @@ public void handleMouseClick(double mouseX, double mouseY, int mouseButton) } @Override - public void render(DrawContext helper, int mouseX, int mouseY, + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { ClickGui gui = WurstClient.INSTANCE.getGui(); @@ -86,7 +86,7 @@ public void render(DrawContext helper, int mouseX, int mouseY, ItemStack stack = new ItemStack(setting.getBlock()); - MatrixStack matrixStack = helper.getMatrices(); + MatrixStack matrixStack = context.getMatrices(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); @@ -121,14 +121,14 @@ else if(hBlock) RenderSystem.setShaderColor(1, 1, 1, 1); TextRenderer tr = WurstClient.MC.textRenderer; String text = setting.getName() + ":"; - helper.drawText(tr, text, x1, y1 + 2, txtColor, false); + context.drawText(tr, text, x1, y1 + 2, txtColor, false); MatrixStack modelViewStack = RenderSystem.getModelViewStack(); modelViewStack.push(); Window parent = getParent(); modelViewStack.translate(parent.getX(), parent.getY() + 13 + parent.getScrollOffset(), 0); - RenderUtils.drawItem(helper, stack, x3, y1, true); + RenderUtils.drawItem(context, stack, x3, y1, true); modelViewStack.pop(); RenderSystem.applyModelViewMatrix(); diff --git a/src/main/java/net/wurstclient/clickgui/components/CheckboxComponent.java b/src/main/java/net/wurstclient/clickgui/components/CheckboxComponent.java index ed37d1deb8..c1f4cf71bc 100644 --- a/src/main/java/net/wurstclient/clickgui/components/CheckboxComponent.java +++ b/src/main/java/net/wurstclient/clickgui/components/CheckboxComponent.java @@ -56,10 +56,10 @@ public void handleMouseClick(double mouseX, double mouseY, int mouseButton) } @Override - public void render(DrawContext helper, int mouseX, int mouseY, + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.getMatrices(); + MatrixStack matrixStack = context.getMatrices(); int x1 = getX(); int x2 = x1 + getWidth(); int x3 = x1 + 11; @@ -82,7 +82,7 @@ public void render(DrawContext helper, int mouseX, int mouseY, if(setting.isChecked()) drawCheck(matrixStack, x1, y1, hovering); - drawName(helper, x3, y1); + drawName(context, x3, y1); } private boolean isHovering(int mouseX, int mouseY, int x1, int x2, int y1, @@ -211,7 +211,7 @@ private void drawCheck(MatrixStack matrixStack, int x1, int y1, tessellator.draw(); } - private void drawName(DrawContext helper, int x3, int y1) + private void drawName(DrawContext context, int x3, int y1) { ClickGui gui = WurstClient.INSTANCE.getGui(); int txtColor = gui.getTxtColor(); @@ -221,7 +221,7 @@ private void drawName(DrawContext helper, int x3, int y1) String name = setting.getName(); int tx = x3 + 2; int ty = y1 + 2; - helper.drawText(MC.textRenderer, name, tx, ty, txtColor, false); + context.drawText(MC.textRenderer, name, tx, ty, txtColor, false); GL11.glEnable(GL11.GL_BLEND); } diff --git a/src/main/java/net/wurstclient/clickgui/components/ColorComponent.java b/src/main/java/net/wurstclient/clickgui/components/ColorComponent.java index 5cfcea46f2..52da223c03 100644 --- a/src/main/java/net/wurstclient/clickgui/components/ColorComponent.java +++ b/src/main/java/net/wurstclient/clickgui/components/ColorComponent.java @@ -56,10 +56,10 @@ else if(mouseButton == 1) } @Override - public void render(DrawContext helper, int mouseX, int mouseY, + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.getMatrices(); + MatrixStack matrixStack = context.getMatrices(); int x1 = getX(); int x2 = x1 + getWidth(); int y1 = getY(); @@ -86,7 +86,7 @@ public void render(DrawContext helper, int mouseX, int mouseY, drawBackground(matrixStack, x1, x2, y1, y3); drawBox(matrixStack, x1, x2, y2, y3, hovering && mouseY >= y3); - drawNameAndValue(helper, x1, x2, y1 + 2); + drawNameAndValue(context, x1, x2, y1 + 2); } private boolean isHovering(int mouseX, int mouseY, int x1, int x2, int y1, @@ -157,7 +157,7 @@ private void drawBox(MatrixStack matrixStack, int x1, int x2, int y2, tessellator.draw(); } - private void drawNameAndValue(DrawContext helper, int x1, int x2, int y1) + private void drawNameAndValue(DrawContext context, int x1, int x2, int y1) { ClickGui gui = WurstClient.INSTANCE.getGui(); int txtColor = gui.getTxtColor(); @@ -165,11 +165,11 @@ private void drawNameAndValue(DrawContext helper, int x1, int x2, int y1) RenderSystem.setShaderColor(1, 1, 1, 1); TextRenderer tr = MC.textRenderer; - helper.drawText(tr, setting.getName(), x1, y1, txtColor, false); + context.drawText(tr, setting.getName(), x1, y1, txtColor, false); String value = ColorUtils.toHex(setting.getColor()); int valueWidth = tr.getWidth(value); - helper.drawText(tr, value, x2 - valueWidth, y1, txtColor, false); + context.drawText(tr, value, x2 - valueWidth, y1, txtColor, false); GL11.glEnable(GL11.GL_BLEND); } diff --git a/src/main/java/net/wurstclient/clickgui/components/ComboBoxComponent.java b/src/main/java/net/wurstclient/clickgui/components/ComboBoxComponent.java index b3788a49d5..330e51fd54 100644 --- a/src/main/java/net/wurstclient/clickgui/components/ComboBoxComponent.java +++ b/src/main/java/net/wurstclient/clickgui/components/ComboBoxComponent.java @@ -103,10 +103,10 @@ private boolean isPopupOpen() } @Override - public void render(DrawContext helper, int mouseX, int mouseY, + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.getMatrices(); + MatrixStack matrixStack = context.getMatrices(); int x1 = getX(); int x2 = x1 + getWidth(); int x3 = x2 - 11; @@ -130,7 +130,7 @@ public void render(DrawContext helper, int mouseX, int mouseY, drawSeparator(matrixStack, x3, y1, y2); drawArrow(matrixStack, x2, x3, y1, y2, hBox); - drawNameAndValue(helper, x1, x4, y1); + drawNameAndValue(context, x1, x4, y1); } private boolean isHovering(int mouseX, int mouseY, int x1, int x2, int y1, @@ -259,7 +259,7 @@ private void drawArrow(MatrixStack matrixStack, int x2, int x3, int y1, tessellator.draw(); } - private void drawNameAndValue(DrawContext helper, int x1, int x4, int y1) + private void drawNameAndValue(DrawContext context, int x1, int x4, int y1) { ClickGui gui = WurstClient.INSTANCE.getGui(); int txtColor = gui.getTxtColor(); @@ -269,8 +269,8 @@ private void drawNameAndValue(DrawContext helper, int x1, int x4, int y1) String name = setting.getName(); String value = "" + setting.getSelected(); - helper.drawText(tr, name, x1, y1 + 2, txtColor, false); - helper.drawText(tr, value, x4 + 2, y1 + 2, txtColor, false); + context.drawText(tr, name, x1, y1 + 2, txtColor, false); + context.drawText(tr, value, x4 + 2, y1 + 2, txtColor, false); GL11.glEnable(GL11.GL_BLEND); } diff --git a/src/main/java/net/wurstclient/clickgui/components/FeatureButton.java b/src/main/java/net/wurstclient/clickgui/components/FeatureButton.java index f1be4e3b12..85f2691517 100644 --- a/src/main/java/net/wurstclient/clickgui/components/FeatureButton.java +++ b/src/main/java/net/wurstclient/clickgui/components/FeatureButton.java @@ -96,10 +96,10 @@ private void closeSettingsWindow() } @Override - public void render(DrawContext helper, int mouseX, int mouseY, + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.getMatrices(); + MatrixStack matrixStack = context.getMatrices(); int x1 = getX(); int x2 = x1 + getWidth(); int x3 = hasSettings ? x2 - 11 : x2; @@ -128,7 +128,7 @@ public void render(DrawContext helper, int mouseX, int mouseY, drawSettingsArrow(matrixStack, x2, x3, y1, y2, hSettings); } - drawName(helper, x1, x3, y1); + drawName(context, x1, x3, y1); } private boolean isHovering(int mouseX, int mouseY, int x1, int x2, int y1, @@ -290,7 +290,7 @@ private void drawSettingsArrow(MatrixStack matrixStack, int x2, int x3, tessellator.draw(); } - private void drawName(DrawContext helper, int x1, int x3, int y1) + private void drawName(DrawContext context, int x1, int x3, int y1) { ClickGui gui = WurstClient.INSTANCE.getGui(); int txtColor = gui.getTxtColor(); @@ -303,7 +303,7 @@ private void drawName(DrawContext helper, int x1, int x3, int y1) int tx = x1 + (x3 - x1 - nameWidth) / 2; int ty = y1 + 2; - helper.drawText(tr, name, tx, ty, txtColor, false); + context.drawText(tr, name, tx, ty, txtColor, false); GL11.glEnable(GL11.GL_BLEND); } diff --git a/src/main/java/net/wurstclient/clickgui/components/FileComponent.java b/src/main/java/net/wurstclient/clickgui/components/FileComponent.java index 44e2e54e01..853e9c7c80 100644 --- a/src/main/java/net/wurstclient/clickgui/components/FileComponent.java +++ b/src/main/java/net/wurstclient/clickgui/components/FileComponent.java @@ -55,7 +55,7 @@ public void handleMouseClick(double mouseX, double mouseY, int mouseButton) } @Override - public void render(DrawContext helper, int mouseX, int mouseY, + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { ClickGui gui = WurstClient.INSTANCE.getGui(); @@ -81,7 +81,7 @@ public void render(DrawContext helper, int mouseX, int mouseY, boolean hText = hovering && mouseX < x3; boolean hBox = hovering && mouseX >= x3; - MatrixStack matrixStack = helper.getMatrices(); + MatrixStack matrixStack = context.getMatrices(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); @@ -130,8 +130,8 @@ else if(hBox) // setting name RenderSystem.setShaderColor(1, 1, 1, 1); String text = setting.getName() + ": "; - helper.drawText(tr, text, x1, y1 + 2, txtColor, false); - helper.drawText(tr, setting.getSelectedFileName(), x3 + 2, y1 + 2, + context.drawText(tr, text, x1, y1 + 2, txtColor, false); + context.drawText(tr, setting.getSelectedFileName(), x3 + 2, y1 + 2, txtColor, false); GL11.glEnable(GL11.GL_BLEND); } diff --git a/src/main/java/net/wurstclient/clickgui/components/RadarComponent.java b/src/main/java/net/wurstclient/clickgui/components/RadarComponent.java index fc12728dc9..9e2bf0bee0 100644 --- a/src/main/java/net/wurstclient/clickgui/components/RadarComponent.java +++ b/src/main/java/net/wurstclient/clickgui/components/RadarComponent.java @@ -11,6 +11,7 @@ import org.joml.Quaternionf; import com.mojang.blaze3d.systems.RenderSystem; + import net.minecraft.client.gui.DrawContext; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.render.BufferBuilder; @@ -43,7 +44,7 @@ public RadarComponent(RadarHack hack) } @Override - public void render(DrawContext helper, int mouseX, int mouseY, + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { ClickGui gui = WurstClient.INSTANCE.getGui(); @@ -62,7 +63,7 @@ public void render(DrawContext helper, int mouseX, int mouseY, && mouseY < y2 && mouseY >= -scroll && mouseY < getParent().getHeight() - 13 - scroll; - MatrixStack matrixStack = helper.getMatrices(); + MatrixStack matrixStack = context.getMatrices(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); diff --git a/src/main/java/net/wurstclient/clickgui/components/SliderComponent.java b/src/main/java/net/wurstclient/clickgui/components/SliderComponent.java index 9a3d7ed1c2..ef4d3f0489 100644 --- a/src/main/java/net/wurstclient/clickgui/components/SliderComponent.java +++ b/src/main/java/net/wurstclient/clickgui/components/SliderComponent.java @@ -76,10 +76,10 @@ private void handleRightClick() } @Override - public void render(DrawContext helper, int mouseX, int mouseY, + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.getMatrices(); + MatrixStack matrixStack = context.getMatrices(); int x1 = getX(); int x2 = x1 + getWidth(); int x3 = x1 + 2; @@ -114,7 +114,7 @@ else if(hSlider && !dragging) drawBackground(matrixStack, x1, x2, x3, x4, y1, y2, y4, y5); drawRail(matrixStack, x3, x4, y4, y5, hSlider, renderAsDisabled); drawKnob(matrixStack, x1, x2, y2, y3, hSlider, renderAsDisabled); - drawNameAndValue(helper, x1, x2, y1, renderAsDisabled); + drawNameAndValue(context, x1, x2, y1, renderAsDisabled); } private void handleDragging(int mouseX, int x3, int x4) @@ -302,7 +302,7 @@ private void drawKnob(MatrixStack matrixStack, int x1, int x2, int y2, tessellator.draw(); } - private void drawNameAndValue(DrawContext helper, int x1, int x2, int y1, + private void drawNameAndValue(DrawContext context, int x1, int x2, int y1, boolean renderAsDisabled) { ClickGui gui = WurstClient.INSTANCE.getGui(); @@ -314,9 +314,8 @@ private void drawNameAndValue(DrawContext helper, int x1, int x2, int y1, String name = setting.getName(); String value = setting.getValueString(); int valueWidth = tr.getWidth(value); - helper.drawText(tr, name, x1, y1 + 2, txtColor, false); - helper.drawText(tr, value, x2 - valueWidth, y1 + 2, txtColor, - false); + context.drawText(tr, name, x1, y1 + 2, txtColor, false); + context.drawText(tr, value, x2 - valueWidth, y1 + 2, txtColor, false); GL11.glEnable(GL11.GL_BLEND); } diff --git a/src/main/java/net/wurstclient/clickgui/screens/AddBookOfferScreen.java b/src/main/java/net/wurstclient/clickgui/screens/AddBookOfferScreen.java index 8b26104dcb..b822164d2b 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/AddBookOfferScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/AddBookOfferScreen.java @@ -287,39 +287,39 @@ public void tick() } @Override - public void render(DrawContext helper, int mouseX, int mouseY, + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.getMatrices(); - listGui.render(helper, mouseX, mouseY, partialTicks); + MatrixStack matrixStack = context.getMatrices(); + listGui.render(context, mouseX, mouseY, partialTicks); matrixStack.push(); matrixStack.translate(0, 0, 300); TextRenderer tr = client.textRenderer; String titleText = "Available Books (" + listGui.getItemCount() + ")"; - helper.drawCenteredTextWithShadow(tr, titleText, width / 2, 12, + context.drawCenteredTextWithShadow(tr, titleText, width / 2, 12, 0xffffff); - levelField.render(helper, mouseX, mouseY, partialTicks); - priceField.render(helper, mouseX, mouseY, partialTicks); - super.render(helper, mouseX, mouseY, partialTicks); + levelField.render(context, mouseX, mouseY, partialTicks); + priceField.render(context, mouseX, mouseY, partialTicks); + super.render(context, mouseX, mouseY, partialTicks); matrixStack.translate(width / 2 - 100, 0, 0); - helper.drawTextWithShadow(tr, "Level:", 0, height - 72, 0xf0f0f0); - helper.drawTextWithShadow(tr, "Max price:", 0, height - 56, 0xf0f0f0); + context.drawTextWithShadow(tr, "Level:", 0, height - 72, 0xf0f0f0); + context.drawTextWithShadow(tr, "Max price:", 0, height - 56, 0xf0f0f0); if(alreadyAdded && offerToAdd != null) { String errorText = offerToAdd.getEnchantmentNameWithLevel() + " is already on your list!"; - helper.drawTextWithShadow(tr, errorText, 0, height - 40, 0xff5555); + context.drawTextWithShadow(tr, errorText, 0, height - 40, 0xff5555); } matrixStack.pop(); - RenderUtils.drawItem(helper, new ItemStack(Items.EMERALD), + RenderUtils.drawItem(context, new ItemStack(Items.EMERALD), width / 2 - 16, height - 58, false); } @@ -393,16 +393,16 @@ protected void renderBackground() } @Override - protected void renderItem(DrawContext helper, int index, int x, - int y, int var4, int mouseX, int mouseY, float partialTicks) + protected void renderItem(DrawContext context, int index, int x, int y, + int var4, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.getMatrices(); + MatrixStack matrixStack = context.getMatrices(); if(isSelectedItem(index)) drawSelectionOutline(matrixStack, x, y); Item item = Registries.ITEM.get(new Identifier("enchanted_book")); ItemStack stack = new ItemStack(item); - RenderUtils.drawItem(helper, stack, x + 1, y + 1, true); + RenderUtils.drawItem(context, stack, x + 1, y + 1, true); TextRenderer tr = mc.textRenderer; BookOffer bookOffer = list.get(index); @@ -410,14 +410,14 @@ protected void renderItem(DrawContext helper, int index, int x, String name = bookOffer.getEnchantmentName(); int nameColor = enchantment.isCursed() ? 0xff5555 : 0xf0f0f0; - helper.drawText(tr, name, x + 28, y, nameColor, false); + context.drawText(tr, name, x + 28, y, nameColor, false); - helper.drawText(tr, bookOffer.id(), x + 28, y + 9, 0xa0a0a0, + context.drawText(tr, bookOffer.id(), x + 28, y + 9, 0xa0a0a0, false); int maxLevel = enchantment.getMaxLevel(); String levels = maxLevel + (maxLevel == 1 ? " level" : " levels"); - helper.drawText(tr, levels, x + 28, y + 18, 0xa0a0a0, false); + context.drawText(tr, levels, x + 28, y + 18, 0xa0a0a0, false); } } } diff --git a/src/main/java/net/wurstclient/clickgui/screens/ClickGuiScreen.java b/src/main/java/net/wurstclient/clickgui/screens/ClickGuiScreen.java index f6fbce0f7b..67dffd847e 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/ClickGuiScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/ClickGuiScreen.java @@ -50,10 +50,10 @@ public boolean mouseScrolled(double mouseX, double mouseY, double delta) } @Override - public void render(DrawContext helper, int mouseX, int mouseY, + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - super.render(helper, mouseX, mouseY, partialTicks); - gui.render(helper, mouseX, mouseY, partialTicks); + super.render(context, mouseX, mouseY, partialTicks); + gui.render(context, mouseX, mouseY, partialTicks); } } diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditBlockListScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditBlockListScreen.java index 0efbbdd009..03767f4b89 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditBlockListScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditBlockListScreen.java @@ -161,44 +161,44 @@ public void tick() } @Override - public void render(DrawContext helper, int mouseX, int mouseY, + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.getMatrices(); - listGui.render(helper, mouseX, mouseY, partialTicks); + MatrixStack matrixStack = context.getMatrices(); + listGui.render(context, mouseX, mouseY, partialTicks); - helper.drawCenteredTextWithShadow(client.textRenderer, + context.drawCenteredTextWithShadow(client.textRenderer, blockList.getName() + " (" + listGui.getItemCount() + ")", width / 2, 12, 0xffffff); matrixStack.push(); matrixStack.translate(0, 0, 300); - blockNameField.render(helper, mouseX, mouseY, partialTicks); - super.render(helper, mouseX, mouseY, partialTicks); + blockNameField.render(context, mouseX, mouseY, partialTicks); + super.render(context, mouseX, mouseY, partialTicks); matrixStack.translate(-64 + width / 2 - 152, 0, 0); if(blockNameField.getText().isEmpty() && !blockNameField.isFocused()) - helper.drawTextWithShadow(client.textRenderer, "block name or ID", + context.drawTextWithShadow(client.textRenderer, "block name or ID", 68, height - 50, 0x808080); int border = blockNameField.isFocused() ? 0xffffffff : 0xffa0a0a0; int black = 0xff000000; - helper.fill(48, height - 56, 64, height - 36, border); - helper.fill(49, height - 55, 64, height - 37, black); - helper.fill(214, height - 56, 244, height - 55, border); - helper.fill(214, height - 37, 244, height - 36, border); - helper.fill(244, height - 56, 246, height - 36, border); - helper.fill(214, height - 55, 243, height - 52, black); - helper.fill(214, height - 40, 243, height - 37, black); - helper.fill(214, height - 55, 216, height - 37, black); - helper.fill(242, height - 55, 245, height - 37, black); + context.fill(48, height - 56, 64, height - 36, border); + context.fill(49, height - 55, 64, height - 37, black); + context.fill(214, height - 56, 244, height - 55, border); + context.fill(214, height - 37, 244, height - 36, border); + context.fill(244, height - 56, 246, height - 36, border); + context.fill(214, height - 55, 243, height - 52, black); + context.fill(214, height - 40, 243, height - 37, black); + context.fill(214, height - 55, 216, height - 37, black); + context.fill(242, height - 55, 245, height - 37, black); matrixStack.pop(); - RenderUtils.drawItem(helper, + RenderUtils.drawItem(context, blockToAdd == null ? ItemStack.EMPTY : new ItemStack(blockToAdd), width / 2 - 164, height - 52, false); } @@ -258,20 +258,20 @@ protected void renderBackground() } @Override - protected void renderItem(DrawContext helper, int index, int x, - int y, int var4, int var5, int var6, float partialTicks) + protected void renderItem(DrawContext context, int index, int x, int y, + int var4, int var5, int var6, float partialTicks) { String name = list.get(index); Block block = BlockUtils.getBlockFromName(name); ItemStack stack = new ItemStack(block); TextRenderer tr = mc.textRenderer; - RenderUtils.drawItem(helper, stack, x + 1, y + 1, true); + RenderUtils.drawItem(context, stack, x + 1, y + 1, true); String displayName = stack.isEmpty() ? "\u00a7ounknown block\u00a7r" : stack.getName().getString(); - helper.drawText(tr, displayName, x + 28, y, 0xf0f0f0, false); - helper.drawText(tr, name, x + 28, y + 9, 0xa0a0a0, false); - helper.drawText(tr, + context.drawText(tr, displayName, x + 28, y, 0xf0f0f0, false); + context.drawText(tr, name, x + 28, y + 9, 0xa0a0a0, false); + context.drawText(tr, "ID: " + Block.getRawIdFromState(block.getDefaultState()), x + 28, y + 18, 0xa0a0a0, false); } diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditBlockScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditBlockScreen.java index 462d01a2ea..15ba477551 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditBlockScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditBlockScreen.java @@ -97,18 +97,18 @@ public void tick() } @Override - public void render(DrawContext helper, int mouseX, int mouseY, + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.getMatrices(); + MatrixStack matrixStack = context.getMatrices(); TextRenderer tr = client.textRenderer; - renderBackground(helper); - helper.drawCenteredTextWithShadow(tr, setting.getName(), width / 2, 20, + renderBackground(context); + context.drawCenteredTextWithShadow(tr, setting.getName(), width / 2, 20, 0xFFFFFF); - blockField.render(helper, mouseX, mouseY, partialTicks); - super.render(helper, mouseX, mouseY, partialTicks); + blockField.render(context, mouseX, mouseY, partialTicks); + super.render(context, mouseX, mouseY, partialTicks); matrixStack.push(); matrixStack.translate(-64 + width / 2 - 100, 115, 0); @@ -120,20 +120,20 @@ public void render(DrawContext helper, int mouseX, int mouseY, int lblX = lblAbove ? 50 : 68; int lblY = lblAbove ? -66 : -50; int lblColor = lblAbove ? 0xF0F0F0 : 0x808080; - helper.drawTextWithShadow(tr, lblText, lblX, lblY, lblColor); + context.drawTextWithShadow(tr, lblText, lblX, lblY, lblColor); int border = blockField.isFocused() ? 0xffffffff : 0xffa0a0a0; int black = 0xff000000; - helper.fill(48, -56, 64, -36, border); - helper.fill(49, -55, 64, -37, black); - helper.fill(214, -56, 244, -55, border); - helper.fill(214, -37, 244, -36, border); - helper.fill(244, -56, 246, -36, border); - helper.fill(214, -55, 243, -52, black); - helper.fill(214, -40, 243, -37, black); - helper.fill(215, -55, 216, -37, black); - helper.fill(242, -55, 245, -37, black); + context.fill(48, -56, 64, -36, border); + context.fill(49, -55, 64, -37, black); + context.fill(214, -56, 244, -55, border); + context.fill(214, -37, 244, -36, border); + context.fill(244, -56, 246, -36, border); + context.fill(214, -55, 243, -52, black); + context.fill(214, -40, 243, -37, black); + context.fill(215, -55, 216, -37, black); + context.fill(242, -55, 245, -37, black); matrixStack.pop(); @@ -143,7 +143,7 @@ public void render(DrawContext helper, int mouseX, int mouseY, if(blockToAdd == null) blockToAdd = Blocks.AIR; - RenderUtils.drawItem(helper, new ItemStack(blockToAdd), + RenderUtils.drawItem(context, new ItemStack(blockToAdd), -64 + width / 2 - 100 + 52, 115 - 52, false); } diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditBookOfferScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditBookOfferScreen.java index ebeba9dcae..e3f66b5ce5 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditBookOfferScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditBookOfferScreen.java @@ -252,18 +252,18 @@ public void tick() } @Override - public void render(DrawContext helper, int mouseX, int mouseY, + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.getMatrices(); - renderBackgroundTexture(helper); + MatrixStack matrixStack = context.getMatrices(); + renderBackgroundTexture(context); matrixStack.push(); matrixStack.translate(0, 0, 300); TextRenderer tr = client.textRenderer; String titleText = "Edit Book Offer"; - helper.drawCenteredTextWithShadow(tr, titleText, width / 2, 12, + context.drawCenteredTextWithShadow(tr, titleText, width / 2, 12, 0xffffff); int x = width / 2 - 100; @@ -271,16 +271,16 @@ public void render(DrawContext helper, int mouseX, int mouseY, Item item = Registries.ITEM.get(new Identifier("enchanted_book")); ItemStack stack = new ItemStack(item); - RenderUtils.drawItem(helper, stack, x + 1, y + 1, true); + RenderUtils.drawItem(context, stack, x + 1, y + 1, true); BookOffer bookOffer = offerToSave; String name = bookOffer.getEnchantmentNameWithLevel(); Enchantment enchantment = bookOffer.getEnchantment(); int nameColor = enchantment.isCursed() ? 0xff5555 : 0xffffff; - helper.drawTextWithShadow(tr, name, x + 28, y, nameColor); + context.drawTextWithShadow(tr, name, x + 28, y, nameColor); - helper.drawText(tr, bookOffer.id(), x + 28, y + 9, 0xa0a0a0, false); + context.drawText(tr, bookOffer.id(), x + 28, y + 9, 0xa0a0a0, false); String price; if(bookOffer.price() >= 64) @@ -288,31 +288,31 @@ public void render(DrawContext helper, int mouseX, int mouseY, else { price = "max " + bookOffer.price(); - RenderUtils.drawItem(helper, new ItemStack(Items.EMERALD), + RenderUtils.drawItem(context, new ItemStack(Items.EMERALD), x + 28 + tr.getWidth(price), y + 16, false); } - helper.drawText(tr, price, x + 28, y + 18, 0xa0a0a0, false); + context.drawText(tr, price, x + 28, y + 18, 0xa0a0a0, false); - levelField.render(helper, mouseX, mouseY, partialTicks); - priceField.render(helper, mouseX, mouseY, partialTicks); - super.render(helper, mouseX, mouseY, partialTicks); + levelField.render(context, mouseX, mouseY, partialTicks); + priceField.render(context, mouseX, mouseY, partialTicks); + super.render(context, mouseX, mouseY, partialTicks); matrixStack.translate(width / 2 - 100, 112, 0); - helper.drawTextWithShadow(tr, "Level:", 0, 0, 0xf0f0f0); - helper.drawTextWithShadow(tr, "Max price:", 0, 16, 0xf0f0f0); + context.drawTextWithShadow(tr, "Level:", 0, 0, 0xf0f0f0); + context.drawTextWithShadow(tr, "Max price:", 0, 16, 0xf0f0f0); if(alreadyAdded && offerToSave != null) { String errorText = offerToSave.getEnchantmentNameWithLevel() + " is already on your list!"; - helper.drawTextWithShadow(tr, errorText, 0, 32, 0xff5555); + context.drawTextWithShadow(tr, errorText, 0, 32, 0xff5555); } matrixStack.pop(); - RenderUtils.drawItem(helper, new ItemStack(Items.EMERALD), + RenderUtils.drawItem(context, new ItemStack(Items.EMERALD), width / 2 - 16, 126, false); } diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditBookOffersScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditBookOffersScreen.java index fc31019660..f65894dbe5 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditBookOffersScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditBookOffersScreen.java @@ -177,20 +177,20 @@ public void tick() } @Override - public void render(DrawContext helper, int mouseX, int mouseY, + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.getMatrices(); - listGui.render(helper, mouseX, mouseY, partialTicks); + MatrixStack matrixStack = context.getMatrices(); + listGui.render(context, mouseX, mouseY, partialTicks); matrixStack.push(); matrixStack.translate(0, 0, 300); - helper.drawCenteredTextWithShadow(client.textRenderer, + context.drawCenteredTextWithShadow(client.textRenderer, bookOffers.getName() + " (" + listGui.getItemCount() + ")", width / 2, 12, 0xffffff); - super.render(helper, mouseX, mouseY, partialTicks); + super.render(context, mouseX, mouseY, partialTicks); matrixStack.pop(); } @@ -250,16 +250,16 @@ protected void renderBackground() } @Override - protected void renderItem(DrawContext helper, int index, int x, - int y, int var4, int var5, int var6, float partialTicks) + protected void renderItem(DrawContext context, int index, int x, int y, + int var4, int var5, int var6, float partialTicks) { - MatrixStack matrixStack = helper.getMatrices(); + MatrixStack matrixStack = context.getMatrices(); if(isSelectedItem(index)) drawSelectionOutline(matrixStack, x, y); Item item = Registries.ITEM.get(new Identifier("enchanted_book")); ItemStack stack = new ItemStack(item); - RenderUtils.drawItem(helper, stack, x + 1, y + 1, true); + RenderUtils.drawItem(context, stack, x + 1, y + 1, true); TextRenderer tr = mc.textRenderer; BookOffer bookOffer = list.get(index); @@ -267,9 +267,9 @@ protected void renderItem(DrawContext helper, int index, int x, Enchantment enchantment = bookOffer.getEnchantment(); int nameColor = enchantment.isCursed() ? 0xff5555 : 0xf0f0f0; - helper.drawText(tr, name, x + 28, y, nameColor, false); + context.drawText(tr, name, x + 28, y, nameColor, false); - helper.drawText(tr, bookOffer.id(), x + 28, y + 9, 0xa0a0a0, + context.drawText(tr, bookOffer.id(), x + 28, y + 9, 0xa0a0a0, false); String price; @@ -278,11 +278,11 @@ protected void renderItem(DrawContext helper, int index, int x, else { price = "max " + bookOffer.price(); - RenderUtils.drawItem(helper, new ItemStack(Items.EMERALD), + RenderUtils.drawItem(context, new ItemStack(Items.EMERALD), x + 28 + tr.getWidth(price), y + 16, false); } - helper.drawText(tr, price, x + 28, y + 18, 0xa0a0a0, false); + context.drawText(tr, price, x + 28, y + 18, 0xa0a0a0, false); } } } diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditColorScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditColorScreen.java index 0af9444828..787cc1bf91 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditColorScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditColorScreen.java @@ -165,13 +165,13 @@ public void tick() } @Override - public void render(DrawContext helper, int mouseX, int mouseY, + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { TextRenderer tr = client.textRenderer; - renderBackground(helper); - helper.drawCenteredTextWithShadow(client.textRenderer, + renderBackground(context); + context.drawCenteredTextWithShadow(client.textRenderer, colorSetting.getName(), width / 2, 16, 0xF0F0F0); // Draw palette @@ -183,22 +183,22 @@ public void render(DrawContext helper, int mouseX, int mouseY, int fh = paletteHeight; float u = 0; float v = 0; - helper.drawTexture(paletteIdentifier, x, y, u, v, w, h, fw, fh); + context.drawTexture(paletteIdentifier, x, y, u, v, w, h, fw, fh); // RGB letters - helper.drawText(tr, "#", fieldsX - 3 - tr.getWidth("#"), - fieldsY + 6, 0xF0F0F0, false); - helper.drawText(tr, "R:", fieldsX - 3 - tr.getWidth("R:"), + context.drawText(tr, "#", fieldsX - 3 - tr.getWidth("#"), fieldsY + 6, + 0xF0F0F0, false); + context.drawText(tr, "R:", fieldsX - 3 - tr.getWidth("R:"), fieldsY + 6 + 35, 0xFF0000, false); - helper.drawText(tr, "G:", fieldsX + 75 - 3 - tr.getWidth("G:"), + context.drawText(tr, "G:", fieldsX + 75 - 3 - tr.getWidth("G:"), fieldsY + 6 + 35, 0x00FF00, false); - helper.drawText(tr, "B:", fieldsX + 150 - 3 - tr.getWidth("B:"), + context.drawText(tr, "B:", fieldsX + 150 - 3 - tr.getWidth("B:"), fieldsY + 6 + 35, 0x0000FF, false); - hexValueField.render(helper, mouseX, mouseY, partialTicks); - redValueField.render(helper, mouseX, mouseY, partialTicks); - greenValueField.render(helper, mouseX, mouseY, partialTicks); - blueValueField.render(helper, mouseX, mouseY, partialTicks); + hexValueField.render(context, mouseX, mouseY, partialTicks); + redValueField.render(context, mouseX, mouseY, partialTicks); + greenValueField.render(context, mouseX, mouseY, partialTicks); + blueValueField.render(context, mouseX, mouseY, partialTicks); // Color preview @@ -209,15 +209,15 @@ public void render(DrawContext helper, int mouseX, int mouseY, int boxY = fieldsY; // Border - helper.fill(boxX - borderSize, boxY - borderSize, + context.fill(boxX - borderSize, boxY - borderSize, boxX + boxWidth + borderSize, boxY + boxHeight + borderSize, 0xFFAAAAAA); // Color box - helper.fill(boxX, boxY, boxX + boxWidth, boxY + boxHeight, + context.fill(boxX, boxY, boxX + boxWidth, boxY + boxHeight, color.getRGB()); - super.render(helper, mouseX, mouseY, partialTicks); + super.render(context, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditItemListScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditItemListScreen.java index 57eb5fe879..be3fafc58a 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditItemListScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditItemListScreen.java @@ -163,21 +163,21 @@ public void tick() } @Override - public void render(DrawContext helper, int mouseX, int mouseY, + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.getMatrices(); - listGui.render(helper, mouseX, mouseY, partialTicks); + MatrixStack matrixStack = context.getMatrices(); + listGui.render(context, mouseX, mouseY, partialTicks); - helper.drawCenteredTextWithShadow(client.textRenderer, + context.drawCenteredTextWithShadow(client.textRenderer, itemList.getName() + " (" + listGui.getItemCount() + ")", width / 2, 12, 0xffffff); matrixStack.push(); matrixStack.translate(0, 0, 300); - itemNameField.render(helper, mouseX, mouseY, partialTicks); - super.render(helper, mouseX, mouseY, partialTicks); + itemNameField.render(context, mouseX, mouseY, partialTicks); + super.render(context, mouseX, mouseY, partialTicks); matrixStack.translate(-64 + width / 2 - 152, 0, 0); @@ -185,7 +185,7 @@ public void render(DrawContext helper, int mouseX, int mouseY, { matrixStack.push(); matrixStack.translate(0, 0, 300); - helper.drawTextWithShadow(client.textRenderer, "item name or ID", + context.drawTextWithShadow(client.textRenderer, "item name or ID", 68, height - 50, 0x808080); matrixStack.pop(); } @@ -193,19 +193,19 @@ public void render(DrawContext helper, int mouseX, int mouseY, int border = itemNameField.isFocused() ? 0xffffffff : 0xffa0a0a0; int black = 0xff000000; - helper.fill(48, height - 56, 64, height - 36, border); - helper.fill(49, height - 55, 64, height - 37, black); - helper.fill(214, height - 56, 244, height - 55, border); - helper.fill(214, height - 37, 244, height - 36, border); - helper.fill(244, height - 56, 246, height - 36, border); - helper.fill(214, height - 55, 243, height - 52, black); - helper.fill(214, height - 40, 243, height - 37, black); - helper.fill(215, height - 55, 216, height - 37, black); - helper.fill(242, height - 55, 245, height - 37, black); + context.fill(48, height - 56, 64, height - 36, border); + context.fill(49, height - 55, 64, height - 37, black); + context.fill(214, height - 56, 244, height - 55, border); + context.fill(214, height - 37, 244, height - 36, border); + context.fill(244, height - 56, 246, height - 36, border); + context.fill(214, height - 55, 243, height - 52, black); + context.fill(214, height - 40, 243, height - 37, black); + context.fill(215, height - 55, 216, height - 37, black); + context.fill(242, height - 55, 245, height - 37, black); matrixStack.pop(); - RenderUtils.drawItem(helper, + RenderUtils.drawItem(context, itemToAdd == null ? ItemStack.EMPTY : new ItemStack(itemToAdd), width / 2 - 164, height - 52, false); } @@ -265,20 +265,20 @@ protected void renderBackground() } @Override - protected void renderItem(DrawContext helper, int index, int x, - int y, int var4, int var5, int var6, float partialTicks) + protected void renderItem(DrawContext context, int index, int x, int y, + int var4, int var5, int var6, float partialTicks) { String name = list.get(index); Item item = Registries.ITEM.get(new Identifier(name)); ItemStack stack = new ItemStack(item); TextRenderer tr = mc.textRenderer; - RenderUtils.drawItem(helper, stack, x + 1, y + 1, true); + RenderUtils.drawItem(context, stack, x + 1, y + 1, true); String displayName = stack.isEmpty() ? "\u00a7ounknown item\u00a7r" : stack.getName().getString(); - helper.drawText(tr, displayName, x + 28, y, 0xf0f0f0, false); - helper.drawText(tr, name, x + 28, y + 9, 0xa0a0a0, false); - helper.drawText(tr, "ID: " + Registries.ITEM.getRawId(item), + context.drawText(tr, displayName, x + 28, y, 0xf0f0f0, false); + context.drawText(tr, name, x + 28, y + 9, 0xa0a0a0, false); + context.drawText(tr, "ID: " + Registries.ITEM.getRawId(item), x + 28, y + 18, 0xa0a0a0, false); } } diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditSliderScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditSliderScreen.java index 3cc1339354..29e70034fa 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditSliderScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditSliderScreen.java @@ -92,15 +92,15 @@ public void tick() } @Override - public void render(DrawContext helper, int mouseX, int mouseY, + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(helper); - helper.drawCenteredTextWithShadow(client.textRenderer, slider.getName(), - width / 2, 20, 0xFFFFFF); + renderBackground(context); + context.drawCenteredTextWithShadow(client.textRenderer, + slider.getName(), width / 2, 20, 0xFFFFFF); - valueField.render(helper, mouseX, mouseY, partialTicks); - super.render(helper, mouseX, mouseY, partialTicks); + valueField.render(context, mouseX, mouseY, partialTicks); + super.render(context, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/clickgui/screens/SelectFileScreen.java b/src/main/java/net/wurstclient/clickgui/screens/SelectFileScreen.java index b165b42ce8..231dfd5c6d 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/SelectFileScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/SelectFileScreen.java @@ -162,19 +162,19 @@ public void tick() } @Override - public void render(DrawContext helper, int mouseX, int mouseY, + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(helper); - listGui.render(helper, mouseX, mouseY, partialTicks); + renderBackground(context); + listGui.render(context, mouseX, mouseY, partialTicks); - helper.drawCenteredTextWithShadow(client.textRenderer, + context.drawCenteredTextWithShadow(client.textRenderer, setting.getName(), width / 2, 12, 0xffffff); - super.render(helper, mouseX, mouseY, partialTicks); + super.render(context, mouseX, mouseY, partialTicks); if(doneButton.isSelected() && !doneButton.active) - helper.drawTooltip(textRenderer, + context.drawTooltip(textRenderer, Arrays.asList(Text.literal("You must first select a file.")), mouseX, mouseY); } @@ -234,15 +234,15 @@ protected void renderBackground() } @Override - protected void renderItem(DrawContext helper, int index, int x, - int y, int var4, int var5, int var6, float partialTicks) + protected void renderItem(DrawContext context, int index, int x, int y, + int var4, int var5, int var6, float partialTicks) { TextRenderer tr = mc.textRenderer; Path path = list.get(index); - helper.drawText(tr, "" + path.getFileName(), x + 28, y, - 0xf0f0f0, false); - helper.drawText(tr, + context.drawText(tr, "" + path.getFileName(), x + 28, y, 0xf0f0f0, + false); + context.drawText(tr, "" + client.runDirectory.toPath().relativize(path), x + 28, y + 9, 0xa0a0a0, false); } diff --git a/src/main/java/net/wurstclient/commands/TacoCmd.java b/src/main/java/net/wurstclient/commands/TacoCmd.java index c91a524a0e..2a5745effe 100644 --- a/src/main/java/net/wurstclient/commands/TacoCmd.java +++ b/src/main/java/net/wurstclient/commands/TacoCmd.java @@ -10,6 +10,7 @@ import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.systems.RenderSystem; + import net.minecraft.client.gui.DrawContext; import net.minecraft.client.util.Window; import net.minecraft.util.Identifier; @@ -81,7 +82,7 @@ public void onUpdate() } @Override - public void onRenderGUI(DrawContext helper, float partialTicks) + public void onRenderGUI(DrawContext context, float partialTicks) { GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_CULL_FACE); @@ -100,7 +101,7 @@ public void onRenderGUI(DrawContext helper, float partialTicks) int y = sr.getScaledHeight() - 32 - 19; int w = 64; int h = 32; - helper.drawTexture(tacos[ticks / 8], x, y, 0, 0, w, h, w, h); + context.drawTexture(tacos[ticks / 8], x, y, 0, 0, w, h, w, h); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); diff --git a/src/main/java/net/wurstclient/events/GUIRenderListener.java b/src/main/java/net/wurstclient/events/GUIRenderListener.java index 94402380a1..8fd0a1704f 100644 --- a/src/main/java/net/wurstclient/events/GUIRenderListener.java +++ b/src/main/java/net/wurstclient/events/GUIRenderListener.java @@ -8,22 +8,23 @@ package net.wurstclient.events; import java.util.ArrayList; + import net.minecraft.client.gui.DrawContext; import net.wurstclient.event.Event; import net.wurstclient.event.Listener; public interface GUIRenderListener extends Listener { - public void onRenderGUI(DrawContext helper, float partialTicks); + public void onRenderGUI(DrawContext context, float partialTicks); public static class GUIRenderEvent extends Event { private final float partialTicks; - private final DrawContext helper; + private final DrawContext context; - public GUIRenderEvent(DrawContext helper, float partialTicks) + public GUIRenderEvent(DrawContext context, float partialTicks) { - this.helper = helper; + this.context = context; this.partialTicks = partialTicks; } @@ -31,7 +32,7 @@ public GUIRenderEvent(DrawContext helper, float partialTicks) public void fire(ArrayList listeners) { for(GUIRenderListener listener : listeners) - listener.onRenderGUI(helper, partialTicks); + listener.onRenderGUI(context, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/hacks/BowAimbotHack.java b/src/main/java/net/wurstclient/hacks/BowAimbotHack.java index 449e30539c..ac1b86cdff 100644 --- a/src/main/java/net/wurstclient/hacks/BowAimbotHack.java +++ b/src/main/java/net/wurstclient/hacks/BowAimbotHack.java @@ -17,6 +17,7 @@ import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.systems.RenderSystem; + import net.minecraft.client.gui.DrawContext; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.render.BufferBuilder; @@ -242,9 +243,9 @@ public void onRender(MatrixStack matrixStack, float partialTicks) } @Override - public void onRenderGUI(DrawContext helper, float partialTicks) + public void onRenderGUI(DrawContext context, float partialTicks) { - MatrixStack matrixStack = helper.getMatrices(); + MatrixStack matrixStack = context.getMatrices(); if(target == null) return; @@ -282,7 +283,7 @@ public void onRenderGUI(DrawContext helper, float partialTicks) tessellator.draw(); // text - helper.drawText(MC.textRenderer, message, 2, 1, 0xffffffff, false); + context.drawText(MC.textRenderer, message, 2, 1, 0xffffffff, false); matrixStack.pop(); diff --git a/src/main/java/net/wurstclient/hacks/ExcavatorHack.java b/src/main/java/net/wurstclient/hacks/ExcavatorHack.java index 4e61061592..0773b85f69 100644 --- a/src/main/java/net/wurstclient/hacks/ExcavatorHack.java +++ b/src/main/java/net/wurstclient/hacks/ExcavatorHack.java @@ -325,14 +325,14 @@ public void onRender(MatrixStack matrixStack, float partialTicks) } @Override - public void onRenderGUI(DrawContext helper, float partialTicks) + public void onRenderGUI(DrawContext context, float partialTicks) { // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_CULL_FACE); - MatrixStack matrixStack = helper.getMatrices(); + MatrixStack matrixStack = context.getMatrices(); matrixStack.push(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); @@ -365,7 +365,7 @@ public void onRenderGUI(DrawContext helper, float partialTicks) tessellator.draw(); // text - helper.drawText(tr, message, 2, 1, 0xffffffff, false); + context.drawText(tr, message, 2, 1, 0xffffffff, false); matrixStack.pop(); diff --git a/src/main/java/net/wurstclient/hacks/NewChunksHack.java b/src/main/java/net/wurstclient/hacks/NewChunksHack.java index 4fa0709ef9..cfa2218560 100644 --- a/src/main/java/net/wurstclient/hacks/NewChunksHack.java +++ b/src/main/java/net/wurstclient/hacks/NewChunksHack.java @@ -32,6 +32,7 @@ import net.wurstclient.settings.SliderSetting; import net.wurstclient.settings.SliderSetting.ValueDisplay; import net.wurstclient.util.BlockUtils; +import net.wurstclient.util.ChunkUtils; import net.wurstclient.util.RenderUtils; public final class NewChunksHack extends Hack @@ -184,7 +185,7 @@ private void checkLoadedChunk(WorldChunk chunk) int minY = chunk.getBottomY(); int minZ = chunkPos.getStartZ(); int maxX = chunkPos.getEndX(); - int maxY = chunk.getHighestNonEmptySectionYOffset() + 16; + int maxY = ChunkUtils.getHighestNonEmptySectionYOffset(chunk) + 16; int maxZ = chunkPos.getEndZ(); for(int x = minX; x <= maxX; x++) diff --git a/src/main/java/net/wurstclient/hud/HackListHUD.java b/src/main/java/net/wurstclient/hud/HackListHUD.java index c350b8f8a5..2386687c7d 100644 --- a/src/main/java/net/wurstclient/hud/HackListHUD.java +++ b/src/main/java/net/wurstclient/hud/HackListHUD.java @@ -34,7 +34,7 @@ public HackListHUD() WurstClient.INSTANCE.getEventManager().add(UpdateListener.class, this); } - public void render(DrawContext helper, float partialTicks) + public void render(DrawContext context, float partialTicks) { if(otf.getMode() == Mode.HIDDEN) return; @@ -59,26 +59,26 @@ public void render(DrawContext helper, float partialTicks) Window sr = WurstClient.MC.getWindow(); if(otf.getMode() == Mode.COUNT || height > sr.getScaledHeight()) - drawCounter(helper); + drawCounter(context); else - drawHackList(helper, partialTicks); + drawHackList(context, partialTicks); } - private void drawCounter(DrawContext helper) + private void drawCounter(DrawContext context) { long size = activeHax.stream().filter(e -> e.hack.isEnabled()).count(); String s = size + " hack" + (size != 1 ? "s" : "") + " active"; - drawString(helper, s); + drawString(context, s); } - private void drawHackList(DrawContext helper, float partialTicks) + private void drawHackList(DrawContext context, float partialTicks) { if(otf.isAnimations()) for(HackListEntry e : activeHax) - drawWithOffset(helper, e, partialTicks); + drawWithOffset(context, e, partialTicks); else for(HackListEntry e : activeHax) - drawString(helper, e.hack.getRenderName()); + drawString(context, e.hack.getRenderName()); } public void updateState(Hack hack) @@ -129,7 +129,7 @@ else if(!enabled && e.offset >= 4) } } - private void drawString(DrawContext helper, String s) + private void drawString(DrawContext context, String s) { TextRenderer tr = WurstClient.MC.textRenderer; int posX; @@ -144,13 +144,13 @@ private void drawString(DrawContext helper, String s) posX = screenWidth - stringWidth - 2; } - helper.drawText(tr, s, posX + 1, posY + 1, 0xff000000, false); - helper.drawText(tr, s, posX, posY, textColor | 0xff000000, false); + context.drawText(tr, s, posX + 1, posY + 1, 0xff000000, false); + context.drawText(tr, s, posX, posY, textColor | 0xff000000, false); posY += 9; } - private void drawWithOffset(DrawContext helper, HackListEntry e, + private void drawWithOffset(DrawContext context, HackListEntry e, float partialTicks) { TextRenderer tr = WurstClient.MC.textRenderer; @@ -171,9 +171,9 @@ private void drawWithOffset(DrawContext helper, HackListEntry e, } int alpha = (int)(255 * (1 - offset / 4)) << 24; - helper.drawText(tr, s, (int)posX + 1, posY + 1, 0x04000000 | alpha, + context.drawText(tr, s, (int)posX + 1, posY + 1, 0x04000000 | alpha, false); - helper.drawText(tr, s, (int)posX, posY, textColor | alpha, false); + context.drawText(tr, s, (int)posX, posY, textColor | alpha, false); posY += 9; } diff --git a/src/main/java/net/wurstclient/hud/IngameHUD.java b/src/main/java/net/wurstclient/hud/IngameHUD.java index b0aa82d982..81a577cc21 100644 --- a/src/main/java/net/wurstclient/hud/IngameHUD.java +++ b/src/main/java/net/wurstclient/hud/IngameHUD.java @@ -10,6 +10,7 @@ import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.systems.RenderSystem; + import net.minecraft.client.gui.DrawContext; import net.wurstclient.WurstClient; import net.wurstclient.clickgui.ClickGui; @@ -23,7 +24,7 @@ public final class IngameHUD implements GUIRenderListener private TabGui tabGui; @Override - public void onRenderGUI(DrawContext helper, float partialTicks) + public void onRenderGUI(DrawContext context, float partialTicks) { if(!WurstClient.INSTANCE.isEnabled()) return; @@ -39,13 +40,13 @@ public void onRenderGUI(DrawContext helper, float partialTicks) clickGui.updateColors(); - wurstLogo.render(helper); - hackList.render(helper, partialTicks); - tabGui.render(helper, partialTicks); + wurstLogo.render(context); + hackList.render(context, partialTicks); + tabGui.render(context, partialTicks); // pinned windows if(!(WurstClient.MC.currentScreen instanceof ClickGuiScreen)) - clickGui.renderPinnedWindows(helper, partialTicks); + clickGui.renderPinnedWindows(context, partialTicks); // GL resets GL11.glEnable(GL11.GL_DEPTH_TEST); diff --git a/src/main/java/net/wurstclient/hud/TabGui.java b/src/main/java/net/wurstclient/hud/TabGui.java index c9950f6e1a..f5b67fced9 100644 --- a/src/main/java/net/wurstclient/hud/TabGui.java +++ b/src/main/java/net/wurstclient/hud/TabGui.java @@ -15,6 +15,7 @@ import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.systems.RenderSystem; + import net.minecraft.client.gui.DrawContext; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GameRenderer; @@ -121,9 +122,9 @@ public void onKeyPress(KeyPressEvent event) } } - public void render(DrawContext helper, float partialTicks) + public void render(DrawContext context, float partialTicks) { - MatrixStack matrixStack = helper.getMatrices(); + MatrixStack matrixStack = context.getMatrices(); if(tabGuiOtf.isHidden()) return; @@ -157,7 +158,7 @@ public void render(DrawContext helper, float partialTicks) if(i == selected) tabName = (tabOpened ? "<" : ">") + tabName; - helper.drawText(WurstClient.MC.textRenderer, tabName, 2, textY, + context.drawText(WurstClient.MC.textRenderer, tabName, 2, textY, txtColor, false); textY += 10; } @@ -192,7 +193,7 @@ public void render(DrawContext helper, float partialTicks) if(i == tab.selected) fName = ">" + fName; - helper.drawText(WurstClient.MC.textRenderer, fName, 2, + context.drawText(WurstClient.MC.textRenderer, fName, 2, tabTextY, txtColor, false); tabTextY += 10; } diff --git a/src/main/java/net/wurstclient/hud/WurstLogo.java b/src/main/java/net/wurstclient/hud/WurstLogo.java index 670fabcbe0..1efea4e562 100644 --- a/src/main/java/net/wurstclient/hud/WurstLogo.java +++ b/src/main/java/net/wurstclient/hud/WurstLogo.java @@ -29,9 +29,9 @@ public final class WurstLogo private static final Identifier texture = new Identifier("wurst", "wurst_128.png"); - public void render(DrawContext helper) + public void render(DrawContext context) { - MatrixStack matrixStack = helper.getMatrices(); + MatrixStack matrixStack = context.getMatrices(); WurstLogoOtf otf = WurstClient.INSTANCE.getOtfs().wurstLogoOtf; if(!otf.isVisible()) return; @@ -55,12 +55,12 @@ public void render(DrawContext helper) // draw version string GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_DEPTH_TEST); - helper.drawText(tr, version, 74, 8, otf.getTextColor(), false); + context.drawText(tr, version, 74, 8, otf.getTextColor(), false); // draw Wurst logo RenderSystem.setShaderColor(1, 1, 1, 1); GL11.glEnable(GL11.GL_BLEND); - helper.drawTexture(texture, 0, 3, 0, 0, 72, 18, 72, 18); + context.drawTexture(texture, 0, 3, 0, 0, 72, 18, 72, 18); } private String getVersionString() diff --git a/src/main/java/net/wurstclient/mixin/GameMenuScreenMixin.java b/src/main/java/net/wurstclient/mixin/GameMenuScreenMixin.java index 4bafc9e68a..9a291f6aca 100644 --- a/src/main/java/net/wurstclient/mixin/GameMenuScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/GameMenuScreenMixin.java @@ -111,8 +111,8 @@ private void openWurstOptions() } @Inject(at = @At("TAIL"), - method = "render(Lnet/minecraft/client/gui/DrawableHelper;IIF)V") - private void onRender(DrawContext helper, int mouseX, int mouseY, + method = "render(Lnet/minecraft/client/gui/DrawContext;IIF)V") + private void onRender(DrawContext context, int mouseX, int mouseY, float partialTicks, CallbackInfo ci) { if(!WurstClient.INSTANCE.isEnabled() || wurstOptionsButton == null) @@ -133,6 +133,6 @@ private void onRender(DrawContext helper, int mouseX, int mouseY, int fh = 16; float u = 0; float v = 0; - helper.drawTexture(wurstTexture, x, y, u, v, w, h, fw, fh); + context.drawTexture(wurstTexture, x, y, u, v, w, h, fw, fh); } } diff --git a/src/main/java/net/wurstclient/mixin/IngameHudMixin.java b/src/main/java/net/wurstclient/mixin/IngameHudMixin.java index 81ca18f90a..76457ac4c6 100644 --- a/src/main/java/net/wurstclient/mixin/IngameHudMixin.java +++ b/src/main/java/net/wurstclient/mixin/IngameHudMixin.java @@ -11,6 +11,7 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.hud.InGameHud; import net.minecraft.util.Identifier; @@ -26,21 +27,21 @@ public class IngameHudMixin target = "Lcom/mojang/blaze3d/systems/RenderSystem;enableBlend()V", remap = false, ordinal = 3), - method = "render(Lnet/minecraft/client/gui/DrawableHelper;F)V") - private void onRender(DrawContext helper, float partialTicks, + method = "render(Lnet/minecraft/client/gui/DrawContext;F)V") + private void onRender(DrawContext context, float partialTicks, CallbackInfo ci) { if(WurstClient.MC.options.debugEnabled) return; - GUIRenderEvent event = new GUIRenderEvent(helper, partialTicks); + GUIRenderEvent event = new GUIRenderEvent(context, partialTicks); EventManager.fire(event); } @Inject(at = @At("HEAD"), - method = "renderOverlay(Lnet/minecraft/client/gui/DrawableHelper;Lnet/minecraft/util/Identifier;F)V", + method = "renderOverlay(Lnet/minecraft/client/gui/DrawContext;Lnet/minecraft/util/Identifier;F)V", cancellable = true) - private void onRenderOverlay(DrawContext helper, Identifier texture, + private void onRenderOverlay(DrawContext context, Identifier texture, float opacity, CallbackInfo ci) { if(texture == null || texture.getPath() == null) diff --git a/src/main/java/net/wurstclient/mixin/PlayerSkinProviderMixin.java b/src/main/java/net/wurstclient/mixin/PlayerSkinProviderMixin.java index 492b02531a..ebd56e0318 100644 --- a/src/main/java/net/wurstclient/mixin/PlayerSkinProviderMixin.java +++ b/src/main/java/net/wurstclient/mixin/PlayerSkinProviderMixin.java @@ -25,7 +25,7 @@ import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.mojang.authlib.GameProfile; -import com.mojang.authlib.minecraft.InsecureTextureException; +import com.mojang.authlib.minecraft.InsecurePublicKeyException; import com.mojang.authlib.minecraft.MinecraftProfileTexture; import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type; import com.mojang.authlib.minecraft.MinecraftSessionService; @@ -45,9 +45,8 @@ public class PlayerSkinProviderMixin private static JsonObject capes; - @Inject(at = {@At("HEAD")}, - method = { - "loadSkin(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/texture/PlayerSkinProvider$SkinTextureAvailableCallback;Z)V"}, + @Inject(at = @At("HEAD"), + method = "loadSkin(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/texture/PlayerSkinProvider$SkinTextureAvailableCallback;Z)V", cancellable = true) private void onLoadSkin(GameProfile profile, PlayerSkinProvider.SkinTextureAvailableCallback callback, @@ -59,15 +58,13 @@ private void onLoadSkin(GameProfile profile, Runnable runnable = () -> { HashMap map = Maps.newHashMap(); - try { map.putAll(sessionService.getTextures(profile, requireSecure)); - }catch(InsecureTextureException var7) + }catch(InsecurePublicKeyException e) { - + // empty catch block } - if(map.isEmpty()) { profile.getProperties().clear(); @@ -81,12 +78,11 @@ private void onLoadSkin(GameProfile profile, { sessionService.fillProfileProperties(profile, requireSecure); - try { map.putAll( sessionService.getTextures(profile, requireSecure)); - }catch(InsecureTextureException var6) + }catch(InsecurePublicKeyException e) { } diff --git a/src/main/java/net/wurstclient/mixin/ScreenMixin.java b/src/main/java/net/wurstclient/mixin/ScreenMixin.java index 070993fc95..31c44b1e5e 100644 --- a/src/main/java/net/wurstclient/mixin/ScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/ScreenMixin.java @@ -32,9 +32,9 @@ public abstract class ScreenMixin extends AbstractParentElement private List drawables; @Inject(at = @At("HEAD"), - method = "renderBackground(Lnet/minecraft/client/gui/DrawableHelper;)V", + method = "renderBackground(Lnet/minecraft/client/gui/DrawContext;)V", cancellable = true) - public void onRenderBackground(DrawContext helper, CallbackInfo ci) + public void onRenderBackground(DrawContext context, CallbackInfo ci) { if(WurstClient.INSTANCE.getHax().noBackgroundHack .shouldCancelBackground((Screen)(Object)this)) diff --git a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java index 5297484e74..187f0eeda4 100644 --- a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java @@ -55,7 +55,7 @@ private void onCreateButtons(CallbackInfo ci) .equals(I18n.translate("gui.done"))) continue; - button.method_46421(width / 2 + 2); + button.setX(width / 2 + 2); button.setWidth(150); } } diff --git a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java index 87f2248691..28488e077b 100644 --- a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java @@ -77,7 +77,7 @@ private void onTick(CallbackInfo ci) // adjust AltManager button if Realms button has been moved // happens when ModMenu is installed - altsButton.method_46419(realmsButton.getY()); + altsButton.setY(realmsButton.getY()); } /** diff --git a/src/main/java/net/wurstclient/navigator/NavigatorFeatureScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorFeatureScreen.java index a848dbb35e..99be6592fd 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorFeatureScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorFeatureScreen.java @@ -20,6 +20,7 @@ import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.systems.RenderSystem; + import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.widget.ButtonWidget; @@ -318,15 +319,15 @@ protected void onUpdate() } @Override - protected void onRender(DrawContext helper, int mouseX, int mouseY, + protected void onRender(DrawContext context, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.getMatrices(); + MatrixStack matrixStack = context.getMatrices(); ClickGui gui = WurstClient.INSTANCE.getGui(); int txtColor = gui.getTxtColor(); // title bar - helper.drawCenteredTextWithShadow(client.textRenderer, + context.drawCenteredTextWithShadow(client.textRenderer, feature.getName(), middleX, 32, txtColor); GL11.glEnable(GL11.GL_BLEND); @@ -432,7 +433,7 @@ protected void onRender(DrawContext helper, int mouseX, int mouseY, } for(int i = 0; i < window.countChildren(); i++) - window.getChild(i).render(helper, mouseX - bgx1, mouseY - windowY, + window.getChild(i).render(context, mouseX - bgx1, mouseY - windowY, partialTicks); matrixStack.pop(); @@ -464,7 +465,7 @@ else if(mouseX >= x1 && mouseX <= x2 && mouseY >= y1 drawBox(matrixStack, x1, y1, x2, y2); // text - helper.drawCenteredTextWithShadow(client.textRenderer, + context.drawCenteredTextWithShadow(client.textRenderer, buttonData.buttonText, (x1 + x2) / 2, y1 + (buttonData.height - 10) / 2 + 1, buttonData.isLocked() ? 0xaaaaaa : buttonData.textColor); @@ -475,7 +476,7 @@ else if(mouseX >= x1 && mouseX <= x2 && mouseY >= y1 int textY = bgy1 + scroll + 2; for(String line : text.split("\n")) { - helper.drawText(client.textRenderer, line, bgx1 + 2, textY, + context.drawText(client.textRenderer, line, bgx1 + 2, textY, txtColor, false); textY += client.textRenderer.fontHeight; } @@ -518,15 +519,15 @@ else if(hovering) // text String buttonText = button.getMessage().getString(); - helper.drawText(client.textRenderer, buttonText, + context.drawText(client.textRenderer, buttonText, (x1 + x2 - client.textRenderer.getWidth(buttonText)) / 2, y1 + 5, txtColor, false); GL11.glEnable(GL11.GL_BLEND); } // popups & tooltip - gui.renderPopups(helper, mouseX, mouseY); - gui.renderTooltip(helper, mouseX, mouseY); + gui.renderPopups(context, mouseX, mouseY); + gui.renderTooltip(context, mouseX, mouseY); // GL resets GL11.glEnable(GL11.GL_CULL_FACE); diff --git a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java index 98051679a3..70cd9d694c 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java @@ -74,7 +74,7 @@ protected void onResize() setFocused(searchBar); searchBar.setFocused(true); - searchBar.method_46421(middleX - 100); + searchBar.setX(middleX - 100); setContentHeight(navigatorDisplayList.size() / 3 * 20); } @@ -228,10 +228,10 @@ public void mouseMoved(double mouseX, double mouseY) } @Override - protected void onRender(DrawContext helper, int mouseX, int mouseY, + protected void onRender(DrawContext context, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.getMatrices(); + MatrixStack matrixStack = context.getMatrices(); ClickGui gui = WurstClient.INSTANCE.getGui(); float[] bgColor = gui.getBgColor(); float[] acColor = gui.getAcColor(); @@ -244,9 +244,9 @@ protected void onRender(DrawContext helper, int mouseX, int mouseY, if(!clickTimerRunning) { RenderSystem.setShaderColor(1, 1, 1, 1); - helper.drawTextWithShadow(WurstClient.MC.textRenderer, "Search: ", + context.drawTextWithShadow(WurstClient.MC.textRenderer, "Search: ", middleX - 150, 32, txtColor); - searchBar.render(helper, mouseX, mouseY, partialTicks); + searchBar.render(context, mouseX, mouseY, partialTicks); GL11.glEnable(GL11.GL_BLEND); } @@ -269,7 +269,7 @@ protected void onRender(DrawContext helper, int mouseX, int mouseY, if(featureY > height - 40) break; - renderFeature(helper, mouseX, mouseY, partialTicks, i, featureX, + renderFeature(context, mouseX, mouseY, partialTicks, i, featureX, featureY); } @@ -329,15 +329,15 @@ protected void onRender(DrawContext helper, int mouseX, int mouseY, // text for(int i = 0; i < lines.length; i++) - helper.drawText(tr, lines[i], xt1 + 2, + context.drawText(tr, lines[i], xt1 + 2, yt1 + 2 + i * tr.fontHeight, txtColor, false); } } - private void renderFeature(DrawContext helper, int mouseX, int mouseY, + private void renderFeature(DrawContext context, int mouseX, int mouseY, float partialTicks, int i, int x, int y) { - MatrixStack matrixStack = helper.getMatrices(); + MatrixStack matrixStack = context.getMatrices(); ClickGui gui = WurstClient.INSTANCE.getGui(); float[] bgColor = gui.getBgColor(); int txtColor = gui.getTxtColor(); @@ -475,7 +475,7 @@ else if(clickTimer == 0) RenderSystem.setShader(GameRenderer::getPositionProgram); RenderSystem.setShaderColor(1, 1, 1, 1); String buttonText = feature.getName(); - helper.drawText(client.textRenderer, buttonText, area.x + 4, + context.drawText(client.textRenderer, buttonText, area.x + 4, area.y + 4, txtColor, false); GL11.glEnable(GL11.GL_BLEND); } diff --git a/src/main/java/net/wurstclient/navigator/NavigatorNewKeybindScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorNewKeybindScreen.java index 71e1df6e87..2392e5c3e9 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorNewKeybindScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorNewKeybindScreen.java @@ -14,6 +14,7 @@ import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.systems.RenderSystem; + import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.widget.ButtonWidget; @@ -156,15 +157,15 @@ protected void onUpdate() } @Override - protected void onRender(DrawContext helper, int mouseX, int mouseY, + protected void onRender(DrawContext context, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.getMatrices(); + MatrixStack matrixStack = context.getMatrices(); ClickGui gui = WurstClient.INSTANCE.getGui(); int txtColor = gui.getTxtColor(); // title bar - helper.drawCenteredTextWithShadow(client.textRenderer, "New Keybind", + context.drawCenteredTextWithShadow(client.textRenderer, "New Keybind", middleX, 32, txtColor); GL11.glEnable(GL11.GL_BLEND); @@ -213,10 +214,11 @@ protected void onRender(DrawContext helper, int mouseX, int mouseY, drawBox(matrixStack, x1, y1, x2, y2); // text - helper.drawTextWithShadow(client.textRenderer, + context.drawTextWithShadow(client.textRenderer, pkb.getDescription(), x1 + 1, y1 + 1, txtColor); - helper.drawTextWithShadow(client.textRenderer, pkb.getCommand(), - x1 + 1, y1 + 1 + client.textRenderer.fontHeight, txtColor); + context.drawTextWithShadow(client.textRenderer, + pkb.getCommand(), x1 + 1, + y1 + 1 + client.textRenderer.fontHeight, txtColor); GL11.glEnable(GL11.GL_BLEND); } } @@ -225,7 +227,7 @@ protected void onRender(DrawContext helper, int mouseX, int mouseY, int textY = bgy1 + scroll + 2; for(String line : text.split("\n")) { - helper.drawTextWithShadow(client.textRenderer, line, bgx1 + 2, + context.drawTextWithShadow(client.textRenderer, line, bgx1 + 2, textY, txtColor); textY += client.textRenderer.fontHeight; } @@ -261,7 +263,7 @@ else if(mouseX >= x1 && mouseX <= x2 && mouseY >= y1 drawBox(matrixStack, x1, y1, x2, y2); // text - helper.drawCenteredTextWithShadow(client.textRenderer, + context.drawCenteredTextWithShadow(client.textRenderer, button.getMessage().getString(), (x1 + x2) / 2, y1 + 5, txtColor); GL11.glEnable(GL11.GL_BLEND); diff --git a/src/main/java/net/wurstclient/navigator/NavigatorRemoveKeybindScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorRemoveKeybindScreen.java index 521a902538..645bec4c49 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorRemoveKeybindScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorRemoveKeybindScreen.java @@ -16,6 +16,7 @@ import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.systems.RenderSystem; + import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.widget.ButtonWidget; @@ -128,16 +129,16 @@ protected void onUpdate() } @Override - protected void onRender(DrawContext helper, int mouseX, int mouseY, + protected void onRender(DrawContext context, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.getMatrices(); + MatrixStack matrixStack = context.getMatrices(); ClickGui gui = WurstClient.INSTANCE.getGui(); int txtColor = gui.getTxtColor(); // title bar - helper.drawCenteredTextWithShadow(client.textRenderer, "Remove Keybind", - middleX, 32, txtColor); + context.drawCenteredTextWithShadow(client.textRenderer, + "Remove Keybind", middleX, 32, txtColor); GL11.glEnable(GL11.GL_BLEND); // background @@ -183,12 +184,13 @@ protected void onRender(DrawContext helper, int mouseX, int mouseY, drawBox(matrixStack, x1, y1, x2, y2); // text - helper.drawTextWithShadow(client.textRenderer, + context.drawTextWithShadow(client.textRenderer, key.replace("key.keyboard.", "") + ": " + keybind.getDescription(), x1 + 1, y1 + 1, txtColor); - helper.drawTextWithShadow(client.textRenderer, keybind.getCommand(), - x1 + 1, y1 + 1 + client.textRenderer.fontHeight, txtColor); + context.drawTextWithShadow(client.textRenderer, + keybind.getCommand(), x1 + 1, + y1 + 1 + client.textRenderer.fontHeight, txtColor); GL11.glEnable(GL11.GL_BLEND); } @@ -196,7 +198,7 @@ protected void onRender(DrawContext helper, int mouseX, int mouseY, int textY = bgy1 + scroll + 2; for(String line : text.split("\n")) { - helper.drawTextWithShadow(client.textRenderer, line, bgx1 + 2, + context.drawTextWithShadow(client.textRenderer, line, bgx1 + 2, textY, txtColor); textY += client.textRenderer.fontHeight; } @@ -232,7 +234,7 @@ else if(mouseX >= x1 && mouseX <= x2 && mouseY >= y1 drawBox(matrixStack, x1, y1, x2, y2); // text - helper.drawCenteredTextWithShadow(client.textRenderer, + context.drawCenteredTextWithShadow(client.textRenderer, button.getMessage().getString(), (x1 + x2) / 2, y1 + 5, txtColor); GL11.glEnable(GL11.GL_BLEND); diff --git a/src/main/java/net/wurstclient/navigator/NavigatorScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorScreen.java index 3b7d48b05b..556bf174d0 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorScreen.java @@ -13,6 +13,7 @@ import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.systems.RenderSystem; + import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.render.BufferBuilder; @@ -142,10 +143,10 @@ public final void tick() } @Override - public final void render(DrawContext helper, int mouseX, int mouseY, + public final void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - MatrixStack matrixStack = helper.getMatrices(); + MatrixStack matrixStack = context.getMatrices(); // GL settings GL11.glEnable(GL11.GL_BLEND); @@ -182,7 +183,7 @@ public final void render(DrawContext helper, int mouseX, int mouseY, drawDownShadow(matrixStack, x1, y1, x2, y2); } - onRender(helper, mouseX, mouseY, partialTicks); + onRender(context, mouseX, mouseY, partialTicks); // GL resets GL11.glEnable(GL11.GL_CULL_FACE); @@ -208,7 +209,7 @@ protected abstract void onMouseDrag(double mouseX, double mouseY, protected abstract void onUpdate(); - protected abstract void onRender(DrawContext helper, int mouseX, + protected abstract void onRender(DrawContext context, int mouseX, int mouseY, float partialTicks); protected final int getStringHeight(String s) diff --git a/src/main/java/net/wurstclient/nochatreports/ForcedChatReportsScreen.java b/src/main/java/net/wurstclient/nochatreports/ForcedChatReportsScreen.java index f97bb64b14..88864e7cc1 100644 --- a/src/main/java/net/wurstclient/nochatreports/ForcedChatReportsScreen.java +++ b/src/main/java/net/wurstclient/nochatreports/ForcedChatReportsScreen.java @@ -101,20 +101,19 @@ private void toggleSignatures() } @Override - public void render(DrawContext helper, int mouseX, int mouseY, - float delta) + public void render(DrawContext context, int mouseX, int mouseY, float delta) { - renderBackground(helper); + renderBackground(context); int centerX = width / 2; int reasonY = (height - 68) / 2 - reasonHeight / 2; int titleY = reasonY - textRenderer.fontHeight * 2; - helper.drawCenteredTextWithShadow(textRenderer, title, centerX, titleY, + context.drawCenteredTextWithShadow(textRenderer, title, centerX, titleY, 0xAAAAAA); - reasonFormatted.drawCenterWithShadow(helper, centerX, reasonY); + reasonFormatted.drawCenterWithShadow(context, centerX, reasonY); - super.render(helper, mouseX, mouseY, delta); + super.render(context, mouseX, mouseY, delta); } @Override diff --git a/src/main/java/net/wurstclient/nochatreports/NcrModRequiredScreen.java b/src/main/java/net/wurstclient/nochatreports/NcrModRequiredScreen.java index 0db22a890e..fe212eb8e8 100644 --- a/src/main/java/net/wurstclient/nochatreports/NcrModRequiredScreen.java +++ b/src/main/java/net/wurstclient/nochatreports/NcrModRequiredScreen.java @@ -117,20 +117,19 @@ private void toggleVanillaSpoof() } @Override - public void render(DrawContext helper, int mouseX, int mouseY, - float delta) + public void render(DrawContext context, int mouseX, int mouseY, float delta) { - renderBackground(helper); + renderBackground(context); int centerX = width / 2; int reasonY = (height - 68) / 2 - reasonHeight / 2; int titleY = reasonY - textRenderer.fontHeight * 2; - helper.drawCenteredTextWithShadow(textRenderer, title, centerX, titleY, + context.drawCenteredTextWithShadow(textRenderer, title, centerX, titleY, 0xAAAAAA); - reasonFormatted.drawCenterWithShadow(helper, centerX, reasonY); + reasonFormatted.drawCenterWithShadow(context, centerX, reasonY); - super.render(helper, mouseX, mouseY, delta); + super.render(context, mouseX, mouseY, delta); } @Override diff --git a/src/main/java/net/wurstclient/options/EnterProfileNameScreen.java b/src/main/java/net/wurstclient/options/EnterProfileNameScreen.java index fb59d5064e..b8f8962cf5 100644 --- a/src/main/java/net/wurstclient/options/EnterProfileNameScreen.java +++ b/src/main/java/net/wurstclient/options/EnterProfileNameScreen.java @@ -88,15 +88,15 @@ public void tick() } @Override - public void render(DrawContext helper, int mouseX, int mouseY, + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(helper); - helper.drawCenteredTextWithShadow(client.textRenderer, + renderBackground(context); + context.drawCenteredTextWithShadow(client.textRenderer, "Name your new profile", width / 2, 20, 0xFFFFFF); - valueField.render(helper, mouseX, mouseY, partialTicks); - super.render(helper, mouseX, mouseY, partialTicks); + valueField.render(context, mouseX, mouseY, partialTicks); + super.render(context, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/options/KeybindEditorScreen.java b/src/main/java/net/wurstclient/options/KeybindEditorScreen.java index 9de18f5843..fe34616032 100644 --- a/src/main/java/net/wurstclient/options/KeybindEditorScreen.java +++ b/src/main/java/net/wurstclient/options/KeybindEditorScreen.java @@ -94,23 +94,23 @@ public void tick() } @Override - public void render(DrawContext helper, int mouseX, int mouseY, + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(helper); + renderBackground(context); - helper.drawCenteredTextWithShadow(textRenderer, + context.drawCenteredTextWithShadow(textRenderer, (oldKey != null ? "Edit" : "Add") + " Keybind", width / 2, 20, 0xffffff); - helper.drawTextWithShadow(textRenderer, + context.drawTextWithShadow(textRenderer, "Key: " + key.replace("key.keyboard.", ""), width / 2 - 100, 47, 0xa0a0a0); - helper.drawTextWithShadow(textRenderer, "Commands (separated by ';')", + context.drawTextWithShadow(textRenderer, "Commands (separated by ';')", width / 2 - 100, 87, 0xa0a0a0); - commandField.render(helper, mouseX, mouseY, partialTicks); - super.render(helper, mouseX, mouseY, partialTicks); + commandField.render(context, mouseX, mouseY, partialTicks); + super.render(context, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/options/KeybindManagerScreen.java b/src/main/java/net/wurstclient/options/KeybindManagerScreen.java index 41aef4b31b..43d5d7c4ea 100644 --- a/src/main/java/net/wurstclient/options/KeybindManagerScreen.java +++ b/src/main/java/net/wurstclient/options/KeybindManagerScreen.java @@ -163,18 +163,18 @@ public void tick() } @Override - public void render(DrawContext helper, int mouseX, int mouseY, + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(helper); - listGui.render(helper, mouseX, mouseY, partialTicks); + renderBackground(context); + listGui.render(context, mouseX, mouseY, partialTicks); - helper.drawCenteredTextWithShadow(textRenderer, "Keybind Manager", + context.drawCenteredTextWithShadow(textRenderer, "Keybind Manager", width / 2, 8, 0xffffff); - helper.drawCenteredTextWithShadow(textRenderer, + context.drawCenteredTextWithShadow(textRenderer, "Keybinds: " + listGui.getItemCount(), width / 2, 20, 0xffffff); - super.render(helper, mouseX, mouseY, partialTicks); + super.render(context, mouseX, mouseY, partialTicks); } @Override @@ -222,16 +222,16 @@ protected void renderBackground() } @Override - protected void renderItem(DrawContext helper, int index, int x, - int y, int slotHeight, int mouseX, int mouseY, float partialTicks) + protected void renderItem(DrawContext context, int index, int x, int y, + int slotHeight, int mouseX, int mouseY, float partialTicks) { Keybind keybind = WurstClient.INSTANCE.getKeybinds().getAllKeybinds().get(index); - helper.drawText(client.textRenderer, + context.drawText(client.textRenderer, "Key: " + keybind.getKey().replace("key.keyboard.", ""), x + 3, y + 3, 0xa0a0a0, false); - helper.drawText(client.textRenderer, + context.drawText(client.textRenderer, "Commands: " + keybind.getCommands(), x + 3, y + 15, 0xa0a0a0, false); } diff --git a/src/main/java/net/wurstclient/options/KeybindProfilesScreen.java b/src/main/java/net/wurstclient/options/KeybindProfilesScreen.java index 93eaeceef0..0946e70a38 100644 --- a/src/main/java/net/wurstclient/options/KeybindProfilesScreen.java +++ b/src/main/java/net/wurstclient/options/KeybindProfilesScreen.java @@ -170,19 +170,19 @@ public void tick() } @Override - public void render(DrawContext helper, int mouseX, int mouseY, + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(helper); - listGui.render(helper, mouseX, mouseY, partialTicks); + renderBackground(context); + listGui.render(context, mouseX, mouseY, partialTicks); - helper.drawCenteredTextWithShadow(client.textRenderer, + context.drawCenteredTextWithShadow(client.textRenderer, "Keybind Profiles", width / 2, 12, 0xffffff); - super.render(helper, mouseX, mouseY, partialTicks); + super.render(context, mouseX, mouseY, partialTicks); if(loadButton.isSelected() && !loadButton.active) - helper.drawTooltip(textRenderer, + context.drawTooltip(textRenderer, Arrays.asList(Text.literal("You must first select a file.")), mouseX, mouseY); } @@ -236,20 +236,20 @@ protected void renderBackground() } @Override - protected void renderItem(DrawContext helper, int index, int x, - int y, int var4, int var5, int var6, float partialTicks) + protected void renderItem(DrawContext context, int index, int x, int y, + int var4, int var5, int var6, float partialTicks) { TextRenderer tr = mc.textRenderer; Path path = list.get(index); // tr.draw(matrixStack, "" + path.getFileName(), x + 28, y, // 0xf0f0f0); - helper.drawTextWithShadow(tr, "" + path.getFileName(), x + 28, y, + context.drawTextWithShadow(tr, "" + path.getFileName(), x + 28, y, 0xf0f0f0); // tr.draw(matrixStack, "" + // client.runDirectory.toPath().relativize(path), x + 28, y + 9, // 0xa0a0a0); - helper.drawTextWithShadow(tr, + context.drawTextWithShadow(tr, "" + client.runDirectory.toPath().relativize(path), x + 28, y + 9, 0xa0a0a0); } diff --git a/src/main/java/net/wurstclient/options/PressAKeyScreen.java b/src/main/java/net/wurstclient/options/PressAKeyScreen.java index abc05feeea..da20905423 100644 --- a/src/main/java/net/wurstclient/options/PressAKeyScreen.java +++ b/src/main/java/net/wurstclient/options/PressAKeyScreen.java @@ -8,6 +8,7 @@ package net.wurstclient.options; import org.lwjgl.glfw.GLFW; + import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.util.InputUtil; @@ -49,12 +50,12 @@ public boolean shouldCloseOnEsc() } @Override - public void render(DrawContext helper, int mouseX, int mouseY, + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(helper); - helper.drawCenteredTextWithShadow(textRenderer, "Press a key", + renderBackground(context); + context.drawCenteredTextWithShadow(textRenderer, "Press a key", width / 2, height / 4 + 48, 16777215); - super.render(helper, mouseX, mouseY, partialTicks); + super.render(context, mouseX, mouseY, partialTicks); } } diff --git a/src/main/java/net/wurstclient/options/WurstOptionsScreen.java b/src/main/java/net/wurstclient/options/WurstOptionsScreen.java index 5dfd7eb707..6a3d9bc547 100644 --- a/src/main/java/net/wurstclient/options/WurstOptionsScreen.java +++ b/src/main/java/net/wurstclient/options/WurstOptionsScreen.java @@ -146,34 +146,34 @@ public void close() } @Override - public void render(DrawContext helper, int mouseX, int mouseY, + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(helper); - renderTitles(helper); - super.render(helper, mouseX, mouseY, partialTicks); - renderButtonTooltip(helper, mouseX, mouseY); + renderBackground(context); + renderTitles(context); + super.render(context, mouseX, mouseY, partialTicks); + renderButtonTooltip(context, mouseX, mouseY); } - private void renderTitles(DrawContext helper) + private void renderTitles(DrawContext context) { TextRenderer tr = client.textRenderer; int middleX = width / 2; int y1 = 40; int y2 = height / 4 + 24 - 28; - helper.drawCenteredTextWithShadow(tr, "Wurst Options", middleX, y1, + context.drawCenteredTextWithShadow(tr, "Wurst Options", middleX, y1, 0xffffff); - helper.drawCenteredTextWithShadow(tr, "Settings", middleX - 104, y2, + context.drawCenteredTextWithShadow(tr, "Settings", middleX - 104, y2, 0xcccccc); - helper.drawCenteredTextWithShadow(tr, "Managers", middleX, y2, + context.drawCenteredTextWithShadow(tr, "Managers", middleX, y2, 0xcccccc); - helper.drawCenteredTextWithShadow(tr, "Links", middleX + 104, y2, + context.drawCenteredTextWithShadow(tr, "Links", middleX + 104, y2, 0xcccccc); } - private void renderButtonTooltip(DrawContext helper, int mouseX, + private void renderButtonTooltip(DrawContext context, int mouseX, int mouseY) { for(Drawable d : ((IScreen)this).getButtons()) @@ -191,7 +191,7 @@ private void renderButtonTooltip(DrawContext helper, int mouseX, if(woButton.tooltip.isEmpty()) continue; - helper.drawTooltip(textRenderer, woButton.tooltip, mouseX, mouseY); + context.drawTooltip(textRenderer, woButton.tooltip, mouseX, mouseY); break; } } diff --git a/src/main/java/net/wurstclient/options/ZoomManagerScreen.java b/src/main/java/net/wurstclient/options/ZoomManagerScreen.java index 5d64483882..8f16145f06 100644 --- a/src/main/java/net/wurstclient/options/ZoomManagerScreen.java +++ b/src/main/java/net/wurstclient/options/ZoomManagerScreen.java @@ -94,20 +94,20 @@ public void close() } @Override - public void render(DrawContext helper, int mouseX, int mouseY, + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { ZoomOtf zoom = WurstClient.INSTANCE.getOtfs().zoomOtf; SliderSetting level = zoom.getLevelSetting(); - renderBackground(helper); - helper.drawCenteredTextWithShadow(textRenderer, "Zoom Manager", + renderBackground(context); + context.drawCenteredTextWithShadow(textRenderer, "Zoom Manager", width / 2, 40, 0xffffff); - helper.drawTextWithShadow(textRenderer, + context.drawTextWithShadow(textRenderer, "Zoom Level: " + level.getValueString(), width / 2 - 75, height / 4 + 44, 0xcccccc); - super.render(helper, mouseX, mouseY, partialTicks); + super.render(context, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/serverfinder/CleanUpScreen.java b/src/main/java/net/wurstclient/serverfinder/CleanUpScreen.java index 813031e0de..f706da3df2 100644 --- a/src/main/java/net/wurstclient/serverfinder/CleanUpScreen.java +++ b/src/main/java/net/wurstclient/serverfinder/CleanUpScreen.java @@ -201,21 +201,21 @@ public boolean keyPressed(int keyCode, int scanCode, int int_3) } @Override - public void render(DrawContext helper, int mouseX, int mouseY, + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(helper); - helper.drawCenteredTextWithShadow(textRenderer, "Clean Up", width / 2, + renderBackground(context); + context.drawCenteredTextWithShadow(textRenderer, "Clean Up", width / 2, 20, 16777215); - helper.drawCenteredTextWithShadow(textRenderer, + context.drawCenteredTextWithShadow(textRenderer, "Please select the servers you want to remove:", width / 2, 36, 10526880); - super.render(helper, mouseX, mouseY, partialTicks); - renderButtonTooltip(helper, mouseX, mouseY); + super.render(context, mouseX, mouseY, partialTicks); + renderButtonTooltip(context, mouseX, mouseY); } - private void renderButtonTooltip(DrawContext helper, int mouseX, + private void renderButtonTooltip(DrawContext context, int mouseX, int mouseY) { for(Drawable d : ((IScreen)this).getButtons()) @@ -233,7 +233,7 @@ private void renderButtonTooltip(DrawContext helper, int mouseX, if(cuButton.tooltip.isEmpty()) continue; - helper.drawTooltip(textRenderer, cuButton.tooltip, mouseX, mouseY); + context.drawTooltip(textRenderer, cuButton.tooltip, mouseX, mouseY); break; } } diff --git a/src/main/java/net/wurstclient/serverfinder/ServerFinderScreen.java b/src/main/java/net/wurstclient/serverfinder/ServerFinderScreen.java index cadec82f62..f8429ed6a1 100644 --- a/src/main/java/net/wurstclient/serverfinder/ServerFinderScreen.java +++ b/src/main/java/net/wurstclient/serverfinder/ServerFinderScreen.java @@ -12,6 +12,7 @@ import java.util.ArrayList; import org.lwjgl.glfw.GLFW; + import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen; @@ -213,41 +214,41 @@ public boolean keyPressed(int keyCode, int scanCode, int int_3) } @Override - public void render(DrawContext helper, int mouseX, int mouseY, + public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(helper); + renderBackground(context); - helper.drawCenteredTextWithShadow(textRenderer, "Server Finder", + context.drawCenteredTextWithShadow(textRenderer, "Server Finder", width / 2, 20, 16777215); - helper.drawCenteredTextWithShadow(textRenderer, + context.drawCenteredTextWithShadow(textRenderer, "This will search for servers with similar IPs", width / 2, 40, 10526880); - helper.drawCenteredTextWithShadow(textRenderer, + context.drawCenteredTextWithShadow(textRenderer, "to the IP you type into the field below.", width / 2, 50, 10526880); - helper.drawCenteredTextWithShadow(textRenderer, + context.drawCenteredTextWithShadow(textRenderer, "The servers it finds will be added to your server list.", width / 2, 60, 10526880); - helper.drawTextWithShadow(textRenderer, "Server address:", + context.drawTextWithShadow(textRenderer, "Server address:", width / 2 - 100, height / 4 + 24, 10526880); - ipBox.render(helper, mouseX, mouseY, partialTicks); + ipBox.render(context, mouseX, mouseY, partialTicks); - helper.drawTextWithShadow(textRenderer, "Max. threads:", + context.drawTextWithShadow(textRenderer, "Max. threads:", width / 2 - 100, height / 4 + 60, 10526880); - maxThreadsBox.render(helper, mouseX, mouseY, partialTicks); + maxThreadsBox.render(context, mouseX, mouseY, partialTicks); - helper.drawCenteredTextWithShadow(textRenderer, state.toString(), + context.drawCenteredTextWithShadow(textRenderer, state.toString(), width / 2, height / 4 + 73, 10526880); - helper.drawTextWithShadow(textRenderer, + context.drawTextWithShadow(textRenderer, "Checked: " + checked + " / 1792", width / 2 - 100, height / 4 + 84, 10526880); - helper.drawTextWithShadow(textRenderer, "Working: " + working, + context.drawTextWithShadow(textRenderer, "Working: " + working, width / 2 - 100, height / 4 + 94, 10526880); - super.render(helper, mouseX, mouseY, partialTicks); + super.render(context, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/util/ChunkUtils.java b/src/main/java/net/wurstclient/util/ChunkUtils.java index ba5d8aae38..7fed3a957a 100644 --- a/src/main/java/net/wurstclient/util/ChunkUtils.java +++ b/src/main/java/net/wurstclient/util/ChunkUtils.java @@ -13,6 +13,8 @@ import net.minecraft.block.entity.BlockEntity; import net.minecraft.client.MinecraftClient; import net.minecraft.util.math.ChunkPos; +import net.minecraft.util.math.ChunkSectionPos; +import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.WorldChunk; import net.wurstclient.WurstClient; @@ -62,4 +64,21 @@ public static Stream getLoadedChunks() return stream; } + /** + * Returns the y-coordinate of the highest non-empty section in the chunk. + * + *

+ * This is a re-implementation of + * {@link Chunk#getHighestNonEmptySectionYOffset()}, which has been + * deprecated and marked for removal in 23w17a with no apparent replacement + * provided by Mojang. + */ + public static int getHighestNonEmptySectionYOffset(Chunk chunk) + { + int i = chunk.getHighestNonEmptySection(); + if(i == -1) + return chunk.getBottomY(); + + return ChunkSectionPos.getBlockCoord(chunk.sectionIndexToCoord(i)); + } } diff --git a/src/main/java/net/wurstclient/util/ListWidget.java b/src/main/java/net/wurstclient/util/ListWidget.java index 1420112a4e..be6b52d57f 100644 --- a/src/main/java/net/wurstclient/util/ListWidget.java +++ b/src/main/java/net/wurstclient/util/ListWidget.java @@ -94,7 +94,7 @@ protected int getMaxPosition() protected void updateItemPosition(int index, int x, int y, float delta) {} - protected abstract void renderItem(DrawContext helper, int x, int y, + protected abstract void renderItem(DrawContext context, int x, int y, int itemHeight, int mouseX, int mouseY, int i, float f); protected void renderHeader(int x, int y, Tessellator tessellator) @@ -134,8 +134,7 @@ public boolean isMouseInList(double mouseX, double mouseY) } @Override - public void render(DrawContext helper, int mouseX, int mouseY, - float delta) + public void render(DrawContext context, int mouseX, int mouseY, float delta) { if(visible) { @@ -168,7 +167,7 @@ public void render(DrawContext helper, int mouseX, int mouseY, if(renderHeader) renderHeader(k, l, tessellator); - renderList(helper, k, l, mouseX, mouseY, delta); + renderList(context, k, l, mouseX, mouseY, delta); RenderSystem.disableDepthTest(); renderHoleBackground(0, top, 255, 255); renderHoleBackground(bottom, height, 255, 255); @@ -374,7 +373,7 @@ public int getRowWidth() return 220; } - protected void renderList(DrawContext helper, int i, int j, int k, int l, + protected void renderList(DrawContext context, int i, int j, int k, int l, float f) { int m = getItemCount(); @@ -414,7 +413,7 @@ protected void renderList(DrawContext helper, int i, int j, int k, int l, } RenderSystem.setShaderColor(1, 1, 1, 1); - renderItem(helper, n, i, o, p, k, l, f); + renderItem(context, n, i, o, p, k, l, f); } } diff --git a/src/main/java/net/wurstclient/util/RenderUtils.java b/src/main/java/net/wurstclient/util/RenderUtils.java index dd1e258367..4ea0a1e690 100644 --- a/src/main/java/net/wurstclient/util/RenderUtils.java +++ b/src/main/java/net/wurstclient/util/RenderUtils.java @@ -864,10 +864,10 @@ public static void drawArrow(Vec3d from, Vec3d to, bufferBuilder.vertex(matrix, 0, 2, 1).next(); } - public static void drawItem(DrawContext helper, ItemStack stack, int x, + public static void drawItem(DrawContext context, ItemStack stack, int x, int y, boolean large) { - MatrixStack matrixStack = helper.getMatrices(); + MatrixStack matrixStack = context.getMatrices(); matrixStack.push(); matrixStack.translate(x, y, 0); @@ -880,7 +880,7 @@ public static void drawItem(DrawContext helper, ItemStack stack, int x, ? new ItemStack(Blocks.GRASS_BLOCK) : stack; DiffuseLighting.enableGuiDepthLighting(); - helper.drawItem(renderStack, 0, 0); + context.drawItem(renderStack, 0, 0); DiffuseLighting.disableGuiDepthLighting(); matrixStack.pop(); @@ -894,7 +894,7 @@ public static void drawItem(DrawContext helper, ItemStack stack, int x, GL11.glDisable(GL11.GL_DEPTH_TEST); TextRenderer tr = WurstClient.MC.textRenderer; - helper.drawText(tr, "?", 3, 2, 0xf0f0f0, false); + context.drawText(tr, "?", 3, 2, 0xf0f0f0, false); GL11.glEnable(GL11.GL_DEPTH_TEST); matrixStack.pop(); diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 305d692446..0bfae0fbd6 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -31,7 +31,7 @@ "depends": { "fabricloader": ">=0.14.19", "fabric-api": ">=0.78.1", - "minecraft": "~1.20-alpha.23.16.a", + "minecraft": "~1.20-alpha.23.17.a", "java": ">=17" }, "suggests": { From 7168468cbf3c7c16290e25d2c6491e8bd7a5c226 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Thu, 27 Apr 2023 14:23:40 +0200 Subject: [PATCH 057/282] Update to Loom 1.2 --- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.jar | Bin 59821 -> 60756 bytes gradle/wrapper/gradle-wrapper.properties | 4 +- gradlew | 8 +- gradlew.bat | 180 ++++++++++++----------- 5 files changed, 101 insertions(+), 93 deletions(-) diff --git a/build.gradle b/build.gradle index 1c8e16ef2f..a009a9c92c 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { } plugins { - id 'fabric-loom' version '1.1-SNAPSHOT' + id 'fabric-loom' version '1.2-SNAPSHOT' id 'maven-publish' } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 41d9927a4d4fb3f96a785543079b8df6723c946b..249e5832f090a2944b7473328c07c9755baa3196 100644 GIT binary patch delta 10197 zcmaKS1ymhDwk=#NxVyW%y9U<)A-Dv)xI0|j{UX8L-JRg>5ZnnKAh;%chM6~S-g^K4 z>eZ{yK4;gd>gwvXs=Id8Jk-J}R4pT911;+{Jp9@aiz6!p1Oz9z&_kGLA%J5%3Ih@0 zQ|U}%$)3u|G`jIfPzMVfcWs?jV2BO^*3+q2><~>3j+Z`^Z%=;19VWg0XndJ zwJ~;f4$;t6pBKaWn}UNO-wLCFHBd^1)^v%$P)fJk1PbK5<;Z1K&>k~MUod6d%@Bq9 z>(44uiaK&sdhwTTxFJvC$JDnl;f}*Q-^01T508(8{+!WyquuyB7R!d!J)8Ni0p!cV6$CHsLLy6}7C zYv_$eD;)@L)tLj0GkGpBoa727hs%wH$>EhfuFy{_8Q8@1HI%ZAjlpX$ob{=%g6`Ox zLzM!d^zy`VV1dT9U9(^}YvlTO9Bf8v^wMK37`4wFNFzW?HWDY(U(k6@tp(crHD)X5>8S-# zW1qgdaZa*Sh6i%60e1+hty}34dD%vKgb?QmQiZ=-j+isA4={V_*R$oGN#j|#ia@n6 zuZx4e2Xx?^lUwYFn2&Tmbx0qA3Z8;y+zKoeQu;~k~FZGy!FU_TFxYd!Ck;5QvMx9gj5fI2@BLNp~Ps@ zf@k<&Q2GS5Ia9?_D?v~$I%_CLA4x~eiKIZ>9w^c#r|vB?wXxZ(vXd*vH(Fd%Me8p( z=_0)k=iRh%8i`FYRF>E97uOFTBfajv{IOz(7CU zv0Gd84+o&ciHlVtY)wn6yhZTQQO*4Mvc#dxa>h}82mEKKy7arOqU$enb9sgh#E=Lq zU;_RVm{)30{bw+|056%jMVcZRGEBSJ+JZ@jH#~DvaDQm92^TyUq=bY*+AkEakpK>8 zB{)CkK48&nE5AzTqT;WysOG|!y}5fshxR8Ek(^H6i>|Fd&wu?c&Q@N9ZrJ=?ABHI! z`*z8D`w=~AJ!P-9M=T}f`;76$qZRllB&8#9WgbuO$P7lVqdX1=g*t=7z6!0AQ^ux_ z9rcfUv^t}o_l-ZE+TqvqFsA*~W<^78!k;~!i8(eS+(+@u8FxK+Q7;mHZ<1}|4m<}vh@p`t%|@eM_J(P% zI>M7C)Ir{l|J;$G_EGGEhbP4?6{sYzMqBv+x95N&YWFH6UcE@b}B?q)G*4<4mR@sy1#vPnLMK51tb#ED(8TA1nE zYfhK7bo1!R5WJF$5Y?zG21)6+_(_5oSX9sGIW;(O&S?Rh(nydNQYzKjjJ54aDJ-1F zrJ=np8LsN?%?Rt7f~3aAX!2E{`fh_pb?2(;HOB3W+I*~A>W%iY+v45+^e$cE10fA} zXPvw9=Bd+(;+!rl)pkYj0HGB}+3Z!Mr;zr%gz~c-hFMv8b2VRE2R$8V=_XE zq$3=|Yg05(fmwrJ)QK2ptB4no`Y8Dg_vK2QDc6-6sXRQ5k78-+cPi-fH}vpgs|Ive zE=m*XNVs?EWgiNI!5AcD*3QMW)R`EqT!f0e1%hERO&?AT7HWnSf5@#AR{OGuXG3Zb zCnVWg7h|61lGV3k+>L<#d>)InG>ETn1DbOHCfztqzQ_fBiaUt@q6VMy={Fe-w#~2- z0?*f|z$zgjI9>+JVICObBaK=pU}AEOd@q(8d?j7zQFD@=6t`|KmolTr2MfBI$;EGh zD%W0cA_d#V6Lb$us5yIG(|d>r-QleC4;%hEu5W9hyY zY#+ESY&v`8(&mC~?*|e5WEhC!YU2>m_}`K+q9)a(d$bsS<=YkyZGp}YA%TXw>@abA zS_poVPoN+?<6?DAuCNt&5SHV(hp56PJ})swwVFZFXM->F zc|0c8<$H_OV%DR|y7e+s$12@Ac8SUClPg8_O9sTUjpv%6Jsn5vsZCg>wL+db4c+{+ zsg<#wOuV4jeOq`veckdi-1`dz;gvL)bZeH|D*x=8UwRU5&8W1@l>3$)8WzET0%;1J zM3(X<7tKK&9~kWRI{&FmwY5Gg!b5f4kI_vSm)H1#>l6M+OiReDXC{kPy!`%Ecq-+3yZTk=<` zm)pE6xum5q0Qkd#iny0Q-S}@I0;mDhxf>sX)Oiv)FdsAMnpx%oe8OQ`m%Xeozdzx!C1rQR>m1c_}+J4x)K}k{G zo68;oGG&Ox7w^-m7{g4a7NJu-B|~M;oIH~~#`RyUNm##feZH;E?pf}nshmoiIY52n z%pc%lnU4Q#C=RUz)RU6}E_j4#)jh<&a%JyJj$Fufc#&COaxFHtl}zJUGNLBu3~_@1 zn9F^JO9);Duxo&i@>X(kbYga1i>6p1fca8FzQ0>((Lb-aPUbC*d~a03V$y;*RBY!R ziEJ2IF^FjrvO}0Uy{cMn%u<+P5U!UO>pm9#ZYL5i6|xSC+np7IH$GfXs&uI;y4as@ z&AzJh>(S2?3PKKgab3Z(`xbx(C#46XIvVcW8eG_DjT~}Yz_8PWZ`uf6^Xr=vkvL_` zqmvfgJL+Zc`;iq~iP?%@G7}~fal-zqxa0yNyHBJJ5M)9bI>7S_cg?Ya&p(I)C5Ef4 zZ>YAF6x|U=?ec?g*|f2g5Tw3PgxaM_bi_5Az9MO$;_Byw(2d}2%-|bg4ShdQ;)Z|M z4K|tFv)qx*kKGKoyh!DQY<{n&UmAChq@DJrQP>EY7g1JF(ih*D8wCVWyQ z5Jj^|-NVFSh5T0vd1>hUvPV6?=`90^_)t(L9)XOW7jeP45NyA2lzOn&QAPTl&d#6P zSv%36uaN(9i9WlpcH#}rmiP#=L0q(dfhdxvFVaOwM;pY;KvNQ9wMyUKs6{d}29DZQ z{H3&Sosr6)9Z+C>Q5)iHSW~gGoWGgK-0;k~&dyr-bA3O|3PCNzgC?UKS_B=^i8Ri^ zd_*_qI4B07Cayq|p4{`U_E_P=K`N_~{F|+-+`sCgcNxs`%X!$=(?l2aAW}0M=~COb zf19oe^iuAUuDEf)4tgv<=WRPpK@IjToNNC*#&Ykw!)aqWU4h#|U@(cG_=Qx+&xt~a zvCz~Ds3F71dsjNLkfM%TqdVNu=RNMOzh7?b+%hICbFlOAPphrYy>7D-e7{%o_kPFn z;T!?ilE-LcKM0P(GKMseEeW57Vs`=FF}(y@^pQl;rL3fHs8icmA+!6YJt&8 ztSF?%Un35qkv>drkks&BNTJv~xK?vD;aBkp7eIkDYqn+G0%;sT4FcwAoO+vke{8CO z0d76sgg$CannW5T#q`z~L4id)9BCKRU0A!Z-{HpXr)QJrd9@iJB+l32Ql)Z}*v(St zE)Vp=BB=DDB4Pr}B(UHNe31<@!6d{U?XDoxJ@S)9QM)2L%SA0x^~^fb=bdsBy!uh& zU?M_^kvnt%FZzm+>~bEH{2o?v&Iogs`1t-b+Ml`J!ZPS(46YQJKxWE81O$HE5w;** z|8zM%bp`M7J8)4;%DqH`wVTmM0V@D}xd%tRE3_6>ioMJxyi5Hkb>85muF81&EY!73ei zA3e<#ug||EZJ=1GLXNJ)A z791&ge#lF;GVX6IU?iw0jX^1bYaU?+x{zPlpyX6zijyn*nEdZ$fxxkl!a-~*P3bkf zPd*pzu~3GBYkR_>ET`5UM^>>zTV>5m>)f=az{d0sg6a8VzUtXy$ZS?h#Gk-CA?7)c zI%Vu9DN6XSDQn6;?n9`>l$q&>s?K)R8*OsmI+$L_m z_~E`}w694Z*`Xk3Ne=497Si~=RWRqCM?6=88smrxle#s*W znwhTRsMRmg?37GLJ-)%nDZA7r$YG849j8mJWir1bWBy& zZPneYojSbooC8U@tkO`bWx4%E5*;p#Q^1^S3lsfy7(6A{jL0`A__0vm?>xC%1y8_m z57FfWr^@YG2I1K7MGYuYd>JC}@sT2n^rkrY3w%~$J$Y~HSoOHn?zpR$ zjLj_bq@Yj8kd~DXHh30KVbz@K)0S;hPKm+S&-o%IG+@x@MEcrxW2KFh;z^4dJDZix zGRGe&lQD$p)0JVF4NRgGYuh0bYLy)BCy~sbS3^b3 zHixT<%-Vwbht|25T{3^Hk;qZ^3s!OOgljHs+EIf~C%=_>R5%vQI4mQR9qOXThMXlU zS|oSH>0PjnCakb*js2{ObN`}%HYsT6=%(xA| znpUtG_TJ08kHgm5l@G|t?4E3tG2fq?wNtIp*Vqrb{9@bo^~Rx7+J&OnayrX`LDcF~ zd@0m0ZJ#Z@=T>4kTa5e2FjI&5c(F7S{gnRPoGpu9eIqrtSvnT_tk$8T)r%YwZw!gK zj*k@cG)V&@t+mtDi37#>LhVGTfRA^p%x0d#_P|Mktz3*KOoLIqFm`~KGoDDD4OOxe z?}ag_c08u%vu=5Vx=~uoS8Q;}+R2~?Uh|m-+`-2kDo$d6T!nD*hc#dB(*R{LXV=zo z`PJP0V=O!@3l-bw+d`X6(=@fq=4O#ETa8M^fOvO4qja9o3e8ANc9$sI=A4$zUut~w z4+JryRkI{9qWxU1CCMM$@Aj=6)P+z?vqa=UCv_4XyVNoBD{Xb~Oi4cjjhm8fRD!*U z2)zaS;AI78^Wq+5mDInKiMz|z#K`2emQfNH*U;{9^{NqSMVoq?RSo43<8YpJM^+W$ zxy!A5>5Zl16Vi#?nAYywu3w_=KWnd3*QetocWt`3pK67>)ZVwnT3h zbPdD&MZkD?q=-N`MpCCwpM74L+Tr1aa)zJ)8G;(Pg51@U&5W>aNu9rA`bh{vgfE={ zdJ>aKc|2Ayw_bop+dK?Y5$q--WM*+$9&3Q9BBiwU8L<-`T6E?ZC`mT0b}%HR*LPK} z!MCd_Azd{36?Y_>yN{U1w5yrN8q`z(Vh^RnEF+;4b|2+~lfAvPT!`*{MPiDioiix8 zY*GdCwJ{S(5(HId*I%8XF=pHFz<9tAe;!D5$Z(iN#jzSql4sqX5!7Y?q4_%$lH zz8ehZuyl0K=E&gYhlfFWabnSiGty$>md|PpU1VfaC5~kskDnZX&Yu}?-h;OSav=8u z=e3Yq=mi$4A|sB-J00;1d{Sd1+!v0NtU((Nz2;PFFlC}V{@p&4wGcVhU&nI($RAS! zwXn7)?8~1J3*4+VccRSg5JS<(bBhBM&{ELMD4C_NTpvzboH!{Zr*%HP;{UqxI#g&7 zOAqPSW5Qus$8-xtTvD%h{Tw<2!XR(lU54LZG{)Cah*LZbpJkA=PMawg!O>X@&%+5XiyeIf91n2E*hl$k-Y(3iW*E}Mz-h~H~7S9I1I zR#-j`|Hk?$MqFhE4C@=n!hN*o5+M%NxRqP+aLxDdt=wS6rAu6ECK*;AB%Nyg0uyAv zO^DnbVZZo*|Ef{nsYN>cjZC$OHzR_*g%T#oF zCky9HJS;NCi=7(07tQXq?V8I&OA&kPlJ_dfSRdL2bRUt;tA3yKZRMHMXH&#W@$l%-{vQd7y@~i*^qnj^`Z{)V$6@l&!qP_y zg2oOd!Wit#)2A~w-eqw3*Mbe)U?N|q6sXw~E~&$!!@QYX4b@%;3=>)@Z#K^`8~Aki z+LYKJu~Y$;F5%_0aF9$MsbGS9Bz2~VUG@i@3Fi2q(hG^+Ia44LrfSfqtg$4{%qBDM z_9-O#3V+2~W$dW0G)R7l_R_vw(KSkC--u&%Rs^Io&*?R=`)6BN64>6>)`TxyT_(Rd zUn+aIl1mPa#Jse9B3`!T=|e!pIp$(8ZOe0ao?nS7o?oKlj zypC-fMj1DHIDrh1unUI1vp=-Fln;I9e7Jvs3wj*^_1&W|X} zZSL|S|Bb@CV*YC_-T&2!Ht3b6?)d`tHOP?rA;;t#zaXa0Sc;vGnV0BLIf8f-r{QHh z*Zp`4_ItlOR7{u(K+!p_oLDmaAkNag*l4#29F2b_A*0oz0T|#-&f*;c#<`^)(W@gm z#k9k=t%u8<+C1fNUA{Fh7~wgPrEZZ#(6aBI%6bR4RO(e1(ZocjoDek4#MTgZD>1NG zy9~yoZfWYfwe&S-(zk4o6q6o?2*~DOrJ(%5wSnEJMVOKCzHd z=Yhm+HLzoDl{P*Ybro7@sk1!Ez3`hE+&qr7Rw^2glw^M(b(NS2!F|Q!mi|l~lF94o z!QiV)Q{Z>GO5;l1y!$O)=)got;^)%@v#B!ZEVQy1(BJApHr5%Zh&W|gweD+%Ky%CO ztr45vR*y(@*Dg_Qw5v~PJtm^@Lyh*zRuT6~(K+^HWEF{;R#L$vL2!_ndBxCtUvZ(_ zauI7Qq}ERUWjr&XW9SwMbU>*@p)(cuWXCxRK&?ZoOy>2VESII53iPDP64S1pl{NsC zD;@EGPxs&}$W1;P6BB9THF%xfoLX|4?S;cu@$)9OdFst-!A7T{(LXtdNQSx!*GUSIS_lyI`da8>!y_tpJb3Zuf0O*;2y?HCfH z5QT6@nL|%l3&u4;F!~XG9E%1YwF*Fgs5V&uFsx52*iag(?6O|gYCBY3R{qhxT-Etb zq(E%V=MgQnuDGEKOGsmBj9T0-nmI%zys8NSO>gfJT4bP>tI>|ol@ zDt(&SUKrg%cz>AmqtJKEMUM;f47FEOFc%Bbmh~|*#E zDd!Tl(wa)ZZIFwe^*)4>{T+zuRykc3^-=P1aI%0Mh}*x7%SP6wD{_? zisraq`Las#y-6{`y@CU3Ta$tOl|@>4qXcB;1bb)oH9kD6 zKym@d$ zv&PZSSAV1Gwwzqrc?^_1+-ZGY+3_7~a(L+`-WdcJMo>EWZN3%z4y6JyF4NR^urk`c z?osO|J#V}k_6*9*n2?j+`F{B<%?9cdTQyVNm8D}H~T}?HOCXt%r7#2hz97Gx#X%62hyaLbU z_ZepP0<`<;eABrHrJAc!_m?kmu#7j}{empH@iUIEk^jk}^EFwO)vd7NZB=&uk6JG^ zC>xad8X$h|eCAOX&MaX<$tA1~r|hW?-0{t4PkVygTc`yh39c;&efwY(-#;$W)+4Xb z$XFsdG&;@^X`aynAMxsq)J#KZXX!sI@g~YiJdHI~r z$4mj_?S29sIa4c$z)19JmJ;Uj?>Kq=0XuH#k#};I&-6zZ_&>)j>UR0XetRO!-sjF< zd_6b1A2vfi++?>cf}s{@#BvTD|a%{9si7G}T+8ZnwuA z1k8c%lgE<-7f~H`cqgF;qZ|$>R-xNPA$25N1WI3#n%gj}4Ix}vj|e=x)B^roGQpB) zO+^#nO2 zjzJ9kHI6nI5ni&V_#5> z!?<7Qd9{|xwIf4b0bRc;zb}V4>snRg6*wl$Xz`hRDN8laL5tg&+@Dv>U^IjGQ}*=XBnXWrwTy;2nX?<1rkvOs#u(#qJ=A zBy>W`N!?%@Ay=upXFI}%LS9bjw?$h)7Dry0%d}=v0YcCSXf9nnp0tBKT1eqZ-4LU` zyiXglKRX)gtT0VbX1}w0f2ce8{$WH?BQm@$`ua%YP8G@<$n13D#*(Yd5-bHfI8!on zf5q4CPdgJLl;BqIo#>CIkX)G;rh|bzGuz1N%rr+5seP${mEg$;uQ3jC$;TsR&{IX< z;}7j3LnV+xNn^$F1;QarDf6rNYj7He+VsjJk6R@0MAkcwrsq4?(~`GKy|mgkfkd1msc2>%B!HpZ~HOzj}kl|ZF(IqB=D6ZTVcKe=I7)LlAI=!XU?J*i#9VXeKeaG zwx_l@Z(w`)5Cclw`6kQKlS<;_Knj)^Dh2pL`hQo!=GPOMR0iqEtx12ORLpN(KBOm5 zontAH5X5!9WHS_=tJfbACz@Dnkuw|^7t=l&x8yb2a~q|aqE_W&0M|tI7@ilGXqE)MONI8p67OiQGqKEQWw;LGga=ZM1;{pSw1jJK_y$vhY6 ztFrV7-xf>lbeKH1U)j3R=?w*>(Yh~NNEPVmeQ8n}0x01$-o z2Jyjn+sXhgOz>AzcZ zAbJZ@f}MBS0lLKR=IE{z;Fav%tcb+`Yi*!`HTDPqSCsFr>;yt^^&SI2mhKJ8f*%ji zz%JkZGvOn{JFn;)5jf^21AvO-9nRzsg0&CPz;OEn07`CfT@gK4abFBT$Mu?8fCcscmRkK+ zbAVJZ~#_a z{|(FFX}~8d3;DW8zuY9?r#Dt>!aD>} zlYw>D7y#eDy+PLZ&XKIY&Df0hsLDDi(Yrq8O==d30RchrUw8a=Eex>Dd?)3+k=}Q> z-b85lun-V$I}86Vg#l1S@1%=$2BQD5_waAZKQfJ${3{b2SZ#w1u+jMr{dJMvI|Og= zpQ9D={XK|ggbe04zTUd}iF{`GO1dV%zWK~?sM9OM(= zVK9&y4F^w1WFW{$qi|xQk0F`@HG8oLI5|5$j~ci9xTMT69v5KS-Yym--raU5kn2#C z<~5q^Bf0rTXVhctG2%&MG(cUGaz(gC(rcG~>qgO$W6>!#NOVQJ;pIYe-lLy(S=HgI zPh;lkL$l+FfMHItHnw_^bj8}CKM19t(C_2vSrhX2$K@-gFlH};#C?1;kk&U1L%4S~ zR^h%h+O1WE7DI$~dly?-_C7>(!E`~#REJ~Xa7lyrB$T!`&qYV5QreAa^aKr%toUJR zPWh)J3iD`(P6BI5k$oE$us#%!4$>`iH2p-88?WV0M$-K)JDibvA4 zpef%_*txN$Ei3=Lt(BBxZ&mhl|mUz-z*OD1=r9nfN zc5vOMFWpi>K=!$6f{eb?5Ru4M3o;t9xLpry|C%j~`@$f)OFB5+xo8XM8g&US@UU-sB|dAoc20y(F@=-2Ggp_`SWjEb#>IG^@j zuQK}e^>So#W2%|-)~K!+)wdU#6l>w5wnZt2pRL5Dz#~N`*UyC9tYechBTc2`@(OI# zNvcE*+zZZjU-H`QOITK^tZwOyLo)ZCLk>>Wm+flMsr5X{A<|m`Y281n?8H_2Fkz5}X?i%Rfm5s+n`J zDB&->=U+LtOIJ|jdYXjQWSQZFEs>Rm{`knop4Sq)(}O_@gk{14y51)iOcGQ5J=b#e z2Yx^6^*F^F7q_m-AGFFgx5uqyw6_4w?yKCJKDGGprWyekr;X(!4CnM5_5?KgN=3qCm03 z##6k%kIU5%g!cCL(+aK>`Wd;dZ4h$h_jb7n?nqx5&o9cUJfr%h#m4+Bh)>HodKcDcsXDXwzJ3jR(sSFqWV(OKHC*cV8;;&bH=ZI0YbW3PgIHwTjiWy z?2MXWO2u0RAEEq(zv9e%Rsz|0(OKB?_3*kkXwHxEuazIZ7=JhaNV*P~hv57q55LoebmJpfHXA@yuS{Esg+ z*C}0V-`x^=0nOa@SPUJek>td~tJ{U1T&m)~`FLp*4DF77S^{|0g%|JIqd-=5)p6a` zpJOsEkKT(FPS@t^80V!I-YJbLE@{5KmVXjEq{QbCnir%}3 zB)-J379=wrBNK6rbUL7Mh^tVmQYn-BJJP=n?P&m-7)P#OZjQoK0{5?}XqJScV6>QX zPR>G{xvU_P;q!;S9Y7*07=Z!=wxIUorMQP(m?te~6&Z0PXQ@I=EYhD*XomZ^z;`Os z4>Uh4)Cg2_##mUa>i1Dxi+R~g#!!i{?SMj%9rfaBPlWj_Yk)lCV--e^&3INB>I?lu z9YXCY5(9U`3o?w2Xa5ErMbl5+pDVpu8v+KJzI9{KFk1H?(1`_W>Cu903Hg81vEX32l{nP2vROa1Fi!Wou0+ZX7Rp`g;B$*Ni3MC-vZ`f zFTi7}c+D)!4hz6NH2e%%t_;tkA0nfkmhLtRW%){TpIqD_ev>}#mVc)<$-1GKO_oK8 zy$CF^aV#x7>F4-J;P@tqWKG0|D1+7h+{ZHU5OVjh>#aa8+V;6BQ)8L5k9t`>)>7zr zfIlv77^`Fvm<)_+^z@ac%D&hnlUAFt8!x=jdaUo{)M9Ar;Tz5Dcd_|~Hl6CaRnK3R zYn${wZe8_BZ0l0c%qbP}>($jsNDay>8+JG@F!uV4F;#zGsBP0f$f3HqEHDz_sCr^q z1;1}7KJ9&`AX2Qdav1(nNzz+GPdEk5K3;hGXe{Hq13{)c zZy%fFEEH#nlJoG{f*M^#8yXuW%!9svN8ry-Vi7AOFnN~r&D`%6d#lvMXBgZkX^vFj z;tkent^62jUr$Cc^@y31Lka6hS>F?1tE8JW$iXO*n9CQMk}D*At3U(-W1E~z>tG?> z5f`5R5LbrhRNR8kv&5d9SL7ke2a*Xr)Qp#75 z6?-p035n2<7hK;sb>t9GAwG4{9v~iEIG>}7B5zcCgZhu$M0-z8?eUO^E?g)md^XT_ z2^~-u$yak>LBy(=*GsTj6p<>b5PO&un@5hGCxpBQlOB3DpsItKZRC*oXq-r{u}Wb; z&ko>#fbnl2Z;o@KqS-d6DTeCG?m1 z&E>p}SEc*)SD&QjZbs!Csjx~0+$@ekuzV_wAalnQvX3a^n~3ui)|rDO+9HW|JPEeBGP4 z)?zcZ<8qv47`EWA*_X~H^vr(lP|f%=%cWFM;u)OFHruKT<~?>5Y8l?56>&;=WdZU# zZEK4-C8s-3zPMA^&y~e*9z)!ZJghr3N^pJa2A$??Xqx-BR*TytGYor&l8Q+^^r%Yq02xay^f#;;wO6K7G!v>wRd6531WnDI~h$PN( z+4#08uX?r&zVKsQ;?5eBX=FxsXaGyH4Gth4a&L|{8LnNCHFr1M{KjJ!BfBS_aiy-E zxtmNcXq3}WTwQ7Dq-9YS5o758sT(5b`Sg-NcH>M9OH1oW6&sZ@|GYk|cJI`vm zO<$~q!3_$&GfWetudRc*mp8)M)q7DEY-#@8w=ItkApfq3sa)*GRqofuL7)dafznKf zLuembr#8gm*lIqKH)KMxSDqbik*B(1bFt%3Vv|ypehXLCa&wc7#u!cJNlUfWs8iQ` z$66(F=1fkxwg745-8_eqV>nWGY3DjB9gE23$R5g&w|C{|xvT@7j*@aZNB199scGchI7pINb5iyqYn)O=yJJX)Ca3&Ca+{n<=1w|(|f0)h<9gs$pVSV<<9Og-V z8ki@nKwE)x)^wmHBMk?mpMT=g{S#^8W|>&rI#Ceh;9za}io0k@0JxiCqi-jHlxbt3 zjJA?RihhRvhk6%G5-D{ePh1jare*fQS<328P-DcVAxPTrw=n6k?C6EV75f}cnBRPT zMYDqqKu(ND&aOtc!QRV`vzJSVxx8i~WB#5Ml{b#eQqNnSi7l-bS-`ITW<^zyYQA(b zbj4SuRK>q9o`_v%+C=S?h>2e4!66Ij(P5{7Uz$3u6YJJC$W%EoBa{-(=tQ|y1vov%ZkXVOV z##_UVg4V^4ne#4~<-1DkJqkKqgT+E_=&4Ue&eQ-JC+gi?7G@d6= zximz{zE)WW{b@QCJ!7l&N5x=dXS?$5RBU-VvN4Uec-GHK&jPa&P2z+qDdLhIB+HU) zu0CW&uLvE^4I5xtK-$+oe|58)7m6*PO%Xt<+-XEA%jG_BEachkF3e@pn?tl!`8lOF zbi2QOuNXX)YT*MCYflILO{VZ*9GiC%R4FO20zMK?p+&aCMm2oeMK7(aW=UDzr=AO0 z$5mJ%=qRsR8rZ>_YsL+vi{3*J_9Kzq(;ZwRj+4_f0-*wbkSMPWahX#Fj_a8BnrhJ6 zo^ZZ?Vah1@&6#r=JkuaYDBdp;J3@ii+CHM&@9*er&#P}$@wI$bfrH)&c!*|nkvhf%^*Y6b%dKz%QBSIo@U z{?V^qEs4`q<8@n+u8YiB^sc@6g>TncG<|GsmC3egwE6aO=EwLr~3-2 zNr`+)`i+-83?|1Xy0^8ps&pb}YT?w1eWVnC9Ps1=KM;Rw)bH6O!7Did1NwpnqVPZc z*%Qo~qkDL>@^<^fmIBtx$WUWQiNtAB2x-LO^BB=|w~-zTnJNEdm1Ou(?8PF&U88X@ z#8rdaTd||)dG^uJw~N_-%!XNbuAyh4`>Shea=pSj0TqP+w4!`nxsmVSv02kb`DBr% zyX=e>5IJ3JYPtdbCHvKMdhXUO_*E9jc_?se7%VJF#&ZaBD;7+eFN3x+hER7!u&`Wz z7zMvBPR4y`*$a250KYjFhAKS%*XG&c;R-kS0wNY1=836wL6q02mqx;IPcH(6ThA@2 zXKQF|9H>6AW$KUF#^A%l6y5{fel77_+cR_zZ0(7=6bmNXABv}R!B-{(E^O6Y?ZS)n zs1QEmh_Fm7p}oRyT3zxUNr4UV8NGs+2b8|4shO$OGFj3D&7_e?#yDi=TTe%$2QbG5 zk<;q7aQ;p!M-Osm{vFdmXZ@!z9uWh!;*%>(vTRggufuUGP9Hols@vhx z73pn$3u2;vzRvnXuT&$Os7J@6y12*j!{ix%3B4YU1466ItmJs0NsU(4ZYRYh7wEA6q{b*Hs6@k~ zi7Yq@Ax!et0cUMTvk7P%ym){MHpcliHEI~e3HP0NV=}7;xFv#IC?a<=`>~j_sk{e> z7vg-tK*p83HZ0=QK@ zRIHo^r{D8&Ms-^WZp+6US_Quqjh$Q66W^1}=Uz&XJ8AQE9&2}P zY|FXZzZ|0IiaBd2qdt6dIjQr(ZMIOU%NG1F&fu6Po9m^?BvLhI6T0R!H2d8;U(&p2 zYA|MFscMqcO(ye~Jp?F;0>Ke+5hzVr?aBNe>GsGgr$XrpS9uajN2kNQ3o$V5rp0T( z0$6TJC;3)26SNG#XcX7l^MKTn$ga?6r4Jzfb%ZgA(Zbwit0$kY=avSnI$@Gk%+^pu zS5mHrcRS8LFPC*uVWH4DDD1pY$H8N>X?KIJZuZ2SvTqc5Nr0GHdD8TCJcd$zIhOdC zZX0ErnsozQh;t^==4zTfrZO421AL?)O)l#GSxU#|LTTg4#&yeK=^w#;q63!Nv~1(@ zs^-RNRuF&qgcr+bIzc@7$h9L;_yjdifE*$j0Q&Np=1AuHL--zdkv@}`1 zo~LlDl_YAq*z?vmr4M`GjDkl9?p|-tl(DtX76oZv25_DtZutLS9Ez!5~p?th@4 zyc_uax4W#<(#)LMkvo)yp|5tKsC2=p#6PyhpH|449T<9Zdk|%CAb5cw?fhvQtBO&7 zpQ9$24yLqPHP;$N&fe2wm%8qdctwIna<3SwGtQA3{C77s%CW%LYxtK(SBGustL0<( zu~U9r0UOkr(c{OJxZS0Ntu3+cJlF7R`7k-Bsa&q?9Ae5{{|o~?cM+T7{lB1^#vT8R z?>c9fNWey`1dKDY%F3d2O*8^qYhjlB8*7HMKE<*=(A`{>=1%s1}Pm&#_t1xy!FkPk@%SMEka2@*= zxDuM|vJJ5s+xgDls{>*o!7eOcs|xuVBPWX&+y5vEiADK%hi`#Dbd>;;Pbk2H4*-X&R?_-6ZEutSd8hC+sSjhIo z;D(j4P;2EVpEj#UF7IjM6PC+X$C5T&=nL`*!*hm9U)#O?>wqOgC>jXKN3Slk_yaQX zLf|4D8T4k|wHW`;#ZQVocNF|3izi0sOqXzi7@KlYC3CXBG`94wD;tMI1bj|8Vm zY}9`VI9!plSfhAal$M_HlaYOVNU?9Z#0<$o?lXXbX3O(l_?f)i3_~r+GcO-x#+x^X zfsZl0>Rj2iP1rsT;+b;Mr? z4Vu&O)Q5ru4j;qaSP5gA{az@XTS1NpT0d9Xhl_FkkRpcEGA0(QQ~YMh#&zwDUkNzm z6cgkdgl9W{iL6ArJ1TQHqnQ^SQ1WGu?FT|93$Ba}mPCH~!$3}0Y0g zcoG%bdTd$bmBx9Y<`Jc+=Cp4}c@EUfjiz;Rcz101p z=?#i$wo>gBE9|szaZMt-d4nUIhBnYRuBVyx+p?5#aZQgUe(!ah`J#l1$%bl5avL27 zU2~@V`3Ic&!?FhDX@Cw!R4%xtWark#p8DLT)HCZ?VJxf^yr@AD*!ERK3#L$E^*Yr? zzN&uF9Roh4rP+r`Z#7U$tzl6>k!b~HgM$C<_crP=vC>6=q{j?(I}!9>g3rJU(&){o z`R^E*9%+kEa8H_fkD9VT7(Fks&Y-RcHaUJYf-|B+eMXMaRM;{FKRiTB>1(=Iij4k1(X__|WqAd-~t#2@UQ}Z&<1Th0azdXfoll!dd)6>1miA z!&=6sDJm=e$?L&06+Q3`D-HNSkK-3$3DdZMX-6Xjn;wd#9A{~ur!2NcX>(qY_oZL0~H7dnQ9sgLe!W>~2|RSW7|hWn<({Pg*xF$%B-!rKe^_R_vc z(LO!0agxxP;FWPV({8#lEv$&&GVakGus=@!3YVG`y^AO1m{2%Np;>HNA1e{=?ra1C}H zAwT0sbwG|!am;fl?*_t^^#yLDXZ*Nx)_FqueZi0c-G~omtpHW0Cu)mEJ`Z1X8brq$ z%vK##b~o*^b&Hz!hgrD=^6P8}aW40lhzMLB5T5*v`1QH?+L~-@CDi3+C@nRf2{7UE zyDIe{@LKw`Eu=Z%6<<_=#V|yxJIKiq_N?ZJ_v0$c)N4l07ZV_mIXG}glfBSPivOhw z-~+9GdckSpMBNR9eR`Y|9_)sXS+u_OiQ%!9rE(2AFjoxN8lk16Sb~^Sq6kRoEp3yD(mm`HsYIXcag_EAB8MHc}nahxVVUTts~U9P|f;7Ul$_` zStR4v&P4q_$KXOEni$lkxy8=9w8G&47VY0oDb^+jT+>ARe3NHUg~St`$RDxY)?;_F znqTujR&chZd2qHF7y8D$4&E3+e@J~!X3&BW4BF(Ebp#TEjrd+9SU!)j;qH+ZkL@AW z?J6Mj}v0_+D zH0qlbzCkHf|EZ`6c>5ig5NAFF%|La%M-}g(7&}Vx8K)qg30YD;H!S!??{;YivzrH0 z(M%2*b_S-)yh&Aiqai)GF^c!<1Xemj|13>dZ_M#)41SrP;OEMaRJ)bCeX*ZT7W`4Y zQ|8L@NHpD@Tf(5>1U(s5iW~Zdf7$@pAL`a3X@YUv1J>q-uJ_(Dy5nYTCUHC}1(dlI zt;5>DLcHh&jbysqt?G01MhXI3!8wgf){Hv}=0N|L$t8M#L7d6WscO8Om2|NBz2Ga^ zs86y%x$H18)~akOWD7@em7)ldlWgb?_sRN>-EcYQO_}aX@+b$dR{146>{kXWP4$nN{V0_+|3{Lt|8uX_fhKh~i{(x%cj*PU$i{PO(5$uA? zQzO>a6oPj-TUk&{zq?JD2MNb6Mf~V3g$ra+PB;ujLJ2JM(a7N*b`y{MX--!fAd}5C zF$D_b8S;+Np(!cW)(hnv5b@@|EMt*RLKF*wy>ykFhEhlPN~n_Bj>LT9B^_yj>z#fx z3JuE4H&?Cc!;G@}E*3k`HK#8ag`yE3Z1)5JUlSua%qkF zkTu|<9{w9OSi$qr)WD#7EzITnch=xnR63E*d~WGvi*Co9BBE?ETHud;!Z)7&wz+l6 zuKODYG1>I1U#a%&(GNJ`AqRfg=H!BtSl+_;CEeufF-#+*2EMMz-22@>18=8PH{PHd z);mN=aR0MPF>eutLiS#-AOX>#2%+pTGEOj!j4L(m0~&xR=0+g#HNpno6@veLhJp}e zyNVC$a>4;!9&iGvU_dj&xbKt@^t6r%f^)+}eV^suRTLP52+BVs0kOLwg6n`=NUv50E7My8XQUh?y%mW62OT1pMrKI3Q(r`7vU&@93=G~A?b(^pvC-8x=bSk zZ60BQR96WB1Z@9Df(M1IQh+YrU8sEjB=Tc2;(zBn-pete*icZE|M&Uc+oHg`|1o`g zH~m+k=D$o);{Rs)b<9Zo|9_Z6L6QHLNki(N>Dw^^i1LITprZeeqIaT#+)fw)PlllU zldphHC)t!0Gf(i9zgVm>`*TbmITF zH1FZ4{wrjRCx{t^26VK_2srZuWuY*EMAsMrJYFFCH35Ky7bq8<0K|ey2wHnrFMZyr z&^yEgX{{3i@&iE5>xKZ{Ads36G3a!i50D!C4?^~cLB<<|fc1!XN(HJRM)H^21sEs%vv+Mu0h*HkLHaEffMwc0n6)JhNXY#M5w@iO@dfXY z0c6dM2a4Hd1SA*#qYj@jK}uVgAZdaBj8t6uuhUNe>)ne9vfd#C6qLV9+@Q7{MnF#0 zJ7fd-ivG_~u3bVvOzpcw1u~ZSp8-kl(sunnX>L~*K-ByWDM2E8>;Si6kn^58AZQxI xVa^It*?521mj4+UJO?7%w*+`EfEcU=@KhDx-s^WzP+ae~{CgHDE&XryzW}Nww%-5% diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2d2fd7c74a..fae08049a6 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists \ No newline at end of file +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index a58591e97b..a69d9cb6c2 100644 --- a/gradlew +++ b/gradlew @@ -205,6 +205,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. @@ -231,4 +237,4 @@ eval "set -- $( tr '\n' ' ' )" '"$@"' -exec "$JAVACMD" "$@" \ No newline at end of file +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 477c896641..53a6b238d4 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,89 +1,91 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega \ No newline at end of file +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega From 932e6c8eedd96a949232fd0de3ab1b2459818f23 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Thu, 27 Apr 2023 18:12:27 +0200 Subject: [PATCH 058/282] Fix required Fabric API version --- src/main/resources/fabric.mod.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 0bfae0fbd6..ab54ad5529 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -30,7 +30,7 @@ "depends": { "fabricloader": ">=0.14.19", - "fabric-api": ">=0.78.1", + "fabric-api": ">=0.79.1", "minecraft": "~1.20-alpha.23.17.a", "java": ">=17" }, From 87aefef5a5ea6eaac1aec035a984de7ad072f789 Mon Sep 17 00:00:00 2001 From: duggavo Date: Fri, 28 Apr 2023 18:07:25 +0200 Subject: [PATCH 059/282] Change Trajectories color when hitting an entity --- .../wurstclient/hacks/TrajectoriesHack.java | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java b/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java index f15f13c434..bd7e328ae9 100644 --- a/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java +++ b/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java @@ -43,17 +43,22 @@ import net.wurstclient.util.RotationUtils; @SearchTags({"ArrowTrajectories", "ArrowPrediction", "aim assist", - "arrow trajectories"}) + "arrow trajectories", "bow trajectories"}) public final class TrajectoriesHack extends Hack implements RenderListener { private final ColorSetting color = new ColorSetting("Color", "Color of the trajectory.", Color.GREEN); - + private final ColorSetting colorHit = + new ColorSetting("Hit Color", "Color of the trajectory if it hits an entity.", Color.RED); + + private boolean hittingEntity = false; + public TrajectoriesHack() { super("Trajectories"); setCategory(Category.RENDER); addSetting(color); + addSetting(colorHit); } @Override @@ -109,7 +114,10 @@ private void drawLine(MatrixStack matrixStack, ArrayList path, bufferBuilder.begin(VertexFormat.DrawMode.DEBUG_LINE_STRIP, VertexFormats.POSITION); + float[] colorF = color.getColorF(); + if (hittingEntity) + colorF = colorHit.getColorF(); RenderSystem.setShaderColor(colorF[0], colorF[1], colorF[2], 0.75F); for(Vec3d point : path) @@ -126,7 +134,10 @@ private void drawEndOfLine(MatrixStack matrixStack, Vec3d end, Vec3d camPos) double renderX = end.x - camPos.x; double renderY = end.y - camPos.y; double renderZ = end.z - camPos.z; + float[] colorF = color.getColorF(); + if (hittingEntity) + colorF = colorHit.getColorF(); matrixStack.push(); matrixStack.translate(renderX - 0.5, renderY - 0.5, renderZ - 0.5); @@ -196,8 +207,10 @@ private ArrayList getPath(float partialTicks) RaycastContext bContext = new RaycastContext(lastPos, arrowPos, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.NONE, MC.player); - if(MC.world.raycast(bContext).getType() != HitResult.Type.MISS) + if(MC.world.raycast(bContext).getType() != HitResult.Type.MISS) { + hittingEntity = false; break; + } // check for entity collision Box box = new Box(lastPos, arrowPos); @@ -205,8 +218,10 @@ private ArrayList getPath(float partialTicks) double maxDistSq = 64 * 64; EntityHitResult eResult = ProjectileUtil.raycast(MC.player, lastPos, arrowPos, box, predicate, maxDistSq); - if(eResult != null && eResult.getType() != HitResult.Type.MISS) + if(eResult != null && eResult.getType() != HitResult.Type.MISS){ + hittingEntity = true; break; + } } return path; From 06be5359a274ec0bee08cff37b6c7cfdcacacc78 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 1 May 2023 00:39:18 +0200 Subject: [PATCH 060/282] Further improve Trajectories colors --- .../wurstclient/hacks/TrajectoriesHack.java | 71 +++++++++++-------- 1 file changed, 43 insertions(+), 28 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java b/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java index bd7e328ae9..d67df0fc56 100644 --- a/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java +++ b/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java @@ -46,19 +46,24 @@ "arrow trajectories", "bow trajectories"}) public final class TrajectoriesHack extends Hack implements RenderListener { - private final ColorSetting color = - new ColorSetting("Color", "Color of the trajectory.", Color.GREEN); - private final ColorSetting colorHit = - new ColorSetting("Hit Color", "Color of the trajectory if it hits an entity.", Color.RED); - - private boolean hittingEntity = false; - + private final ColorSetting missColor = new ColorSetting("Miss Color", + "Color of the trajectory when it doesn't hit anything.", Color.GRAY); + + private final ColorSetting entityHitColor = + new ColorSetting("Entity Hit Color", + "Color of the trajectory when it hits an entity.", Color.RED); + + private final ColorSetting blockHitColor = + new ColorSetting("Block Hit Color", + "Color of the trajectory when it hits a block.", Color.GREEN); + public TrajectoriesHack() { super("Trajectories"); setCategory(Category.RENDER); - addSetting(color); - addSetting(colorHit); + addSetting(missColor); + addSetting(entityHitColor); + addSetting(blockHitColor); } @Override @@ -85,15 +90,22 @@ public void onRender(MatrixStack matrixStack, float partialTicks) RenderUtils.applyCameraRotationOnly(); - ArrayList path = getPath(partialTicks); - Vec3d camPos = RenderUtils.getCameraPos(); + Trajectory trajectory = getTrajectory(partialTicks); + ArrayList path = trajectory.path; - drawLine(matrixStack, path, camPos); + ColorSetting color = switch(trajectory.type) + { + case MISS -> missColor; + case ENTITY -> entityHitColor; + case BLOCK -> blockHitColor; + }; + + drawLine(matrixStack, path, color); if(!path.isEmpty()) { Vec3d end = path.get(path.size() - 1); - drawEndOfLine(matrixStack, end, camPos); + drawEndOfLine(matrixStack, end, color); } RenderSystem.setShaderColor(1, 1, 1, 1); @@ -105,8 +117,9 @@ public void onRender(MatrixStack matrixStack, float partialTicks) } private void drawLine(MatrixStack matrixStack, ArrayList path, - Vec3d camPos) + ColorSetting color) { + Vec3d camPos = RenderUtils.getCameraPos(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); @@ -114,10 +127,7 @@ private void drawLine(MatrixStack matrixStack, ArrayList path, bufferBuilder.begin(VertexFormat.DrawMode.DEBUG_LINE_STRIP, VertexFormats.POSITION); - float[] colorF = color.getColorF(); - if (hittingEntity) - colorF = colorHit.getColorF(); RenderSystem.setShaderColor(colorF[0], colorF[1], colorF[2], 0.75F); for(Vec3d point : path) @@ -129,15 +139,14 @@ private void drawLine(MatrixStack matrixStack, ArrayList path, tessellator.draw(); } - private void drawEndOfLine(MatrixStack matrixStack, Vec3d end, Vec3d camPos) + private void drawEndOfLine(MatrixStack matrixStack, Vec3d end, + ColorSetting color) { + Vec3d camPos = RenderUtils.getCameraPos(); double renderX = end.x - camPos.x; double renderY = end.y - camPos.y; double renderZ = end.z - camPos.z; - float[] colorF = color.getColorF(); - if (hittingEntity) - colorF = colorHit.getColorF(); matrixStack.push(); matrixStack.translate(renderX - 0.5, renderY - 0.5, renderZ - 0.5); @@ -151,10 +160,14 @@ private void drawEndOfLine(MatrixStack matrixStack, Vec3d end, Vec3d camPos) matrixStack.pop(); } - private ArrayList getPath(float partialTicks) + private record Trajectory(ArrayList path, HitResult.Type type) + {} + + private Trajectory getTrajectory(float partialTicks) { ClientPlayerEntity player = MC.player; ArrayList path = new ArrayList<>(); + HitResult.Type type = HitResult.Type.MISS; // find the hand with a throwable item Hand hand = Hand.MAIN_HAND; @@ -166,7 +179,7 @@ private ArrayList getPath(float partialTicks) // if neither hand has a throwable item, return empty path if(!isThrowable(stack)) - return path; + return new Trajectory(path, type); } // calculate item-specific values @@ -207,8 +220,9 @@ private ArrayList getPath(float partialTicks) RaycastContext bContext = new RaycastContext(lastPos, arrowPos, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.NONE, MC.player); - if(MC.world.raycast(bContext).getType() != HitResult.Type.MISS) { - hittingEntity = false; + if(MC.world.raycast(bContext).getType() != HitResult.Type.MISS) + { + type = HitResult.Type.BLOCK; break; } @@ -218,13 +232,14 @@ private ArrayList getPath(float partialTicks) double maxDistSq = 64 * 64; EntityHitResult eResult = ProjectileUtil.raycast(MC.player, lastPos, arrowPos, box, predicate, maxDistSq); - if(eResult != null && eResult.getType() != HitResult.Type.MISS){ - hittingEntity = true; + if(eResult != null && eResult.getType() != HitResult.Type.MISS) + { + type = HitResult.Type.ENTITY; break; } } - return path; + return new Trajectory(path, type); } private Vec3d getHandOffset(Hand hand, double yaw) From e34e037576982273b07fb2f7da80192a70c7ef3b Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 3 May 2023 12:34:59 +0200 Subject: [PATCH 061/282] Improve the precision of Trajectories --- .../net/wurstclient/hacks/TrajectoriesHack.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java b/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java index d67df0fc56..b8efc9e5be 100644 --- a/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java +++ b/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java @@ -28,6 +28,7 @@ import net.minecraft.item.*; import net.minecraft.util.Arm; import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.EntityHitResult; import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.Box; @@ -217,12 +218,15 @@ private Trajectory getTrajectory(float partialTicks) : RotationUtils.getEyesPos(); // check for block collision - RaycastContext bContext = new RaycastContext(lastPos, arrowPos, - RaycastContext.ShapeType.COLLIDER, - RaycastContext.FluidHandling.NONE, MC.player); - if(MC.world.raycast(bContext).getType() != HitResult.Type.MISS) + BlockHitResult bResult = + MC.world.raycast(new RaycastContext(lastPos, arrowPos, + RaycastContext.ShapeType.COLLIDER, + RaycastContext.FluidHandling.NONE, MC.player)); + if(bResult.getType() != HitResult.Type.MISS) { + // replace last pos with the collision point type = HitResult.Type.BLOCK; + path.set(path.size() - 1, bResult.getPos()); break; } @@ -234,7 +238,9 @@ private Trajectory getTrajectory(float partialTicks) arrowPos, box, predicate, maxDistSq); if(eResult != null && eResult.getType() != HitResult.Type.MISS) { + // replace last pos with the collision point type = HitResult.Type.ENTITY; + path.set(path.size() - 1, eResult.getPos()); break; } } From b0c5754e8d343370aaacadb4fd770d76a3fb5a08 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 3 May 2023 16:18:10 +0200 Subject: [PATCH 062/282] Update ApiProviderSetting description --- .../net/wurstclient/hacks/autocomplete/ApiProviderSetting.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/wurstclient/hacks/autocomplete/ApiProviderSetting.java b/src/main/java/net/wurstclient/hacks/autocomplete/ApiProviderSetting.java index 940629a2ce..ec3d18cf23 100644 --- a/src/main/java/net/wurstclient/hacks/autocomplete/ApiProviderSetting.java +++ b/src/main/java/net/wurstclient/hacks/autocomplete/ApiProviderSetting.java @@ -15,7 +15,7 @@ public final class ApiProviderSetting public ApiProviderSetting() { super("API provider", - "\u00a7lOpenAI\u00a7r lets you use models like GPT-3, but requires an" + "\u00a7lOpenAI\u00a7r lets you use models like ChatGPT, but requires an" + " account with API access, costs money to use and sends your chat" + " history to their servers. The name is a lie - it's closed" + " source.\n\n" From 7eba22f51a3d770e617c9f0c589b830a6c8ed3fb Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 3 May 2023 16:51:27 +0200 Subject: [PATCH 063/282] Fix stop sequences in oobabooga mode --- .../hacks/autocomplete/ModelSettings.java | 6 +----- .../autocomplete/OobaboogaMessageCompleter.java | 12 +++++------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java b/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java index a02fe60479..517a4dfe1b 100644 --- a/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java +++ b/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java @@ -127,11 +127,7 @@ public boolean isChatModel() + " for most language models.\n\n" + "\u00a7lNext Message\u00a7r works better with certain" + " code-optimized language models, which have a tendency to insert" - + " line breaks in the middle of a chat message.\n\n" - + "\u00a7lNOTE:\u00a7r Due to a limitation in the oobabooga API, the" - + " stop sequence doesn't properly stop locally installed models." - + " Instead, it waits for the model to finish and then cuts off" - + " the rest of the text.", + + " line breaks in the middle of a chat message.", StopSequence.values(), StopSequence.LINE_BREAK); public enum StopSequence diff --git a/src/main/java/net/wurstclient/hacks/autocomplete/OobaboogaMessageCompleter.java b/src/main/java/net/wurstclient/hacks/autocomplete/OobaboogaMessageCompleter.java index e871a73c04..5424cfe771 100644 --- a/src/main/java/net/wurstclient/hacks/autocomplete/OobaboogaMessageCompleter.java +++ b/src/main/java/net/wurstclient/hacks/autocomplete/OobaboogaMessageCompleter.java @@ -12,6 +12,7 @@ import java.net.HttpURLConnection; import java.net.URL; +import com.google.gson.JsonArray; import com.google.gson.JsonObject; import net.wurstclient.util.json.JsonException; @@ -37,6 +38,10 @@ protected JsonObject buildParams(String prompt) modelSettings.repetitionPenalty.getValue()); params.addProperty("encoder_repetition_penalty", modelSettings.encoderRepetitionPenalty.getValue()); + JsonArray stoppingStrings = new JsonArray(); + stoppingStrings + .add(modelSettings.stopSequence.getSelected().getSequence()); + params.add("stopping_strings", stoppingStrings); return params; } @@ -73,13 +78,6 @@ protected String extractCompletion(WsonObject response) throws JsonException if(!completion.isEmpty()) completion = completion.substring(1); - // remove the next message - String stopSequence = - modelSettings.stopSequence.getSelected().getSequence(); - if(completion.contains(stopSequence)) - completion = - completion.substring(0, completion.indexOf(stopSequence)); - // remove newlines completion = completion.replace("\n", " "); From 7fcea55ab909de521dd79760efd4130d636dda6d Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Thu, 4 May 2023 11:31:00 +0200 Subject: [PATCH 064/282] Further improve AutoComplete --- .../hacks/autocomplete/MessageCompleter.java | 12 +++++++++- .../hacks/autocomplete/ModelSettings.java | 24 +++++++++++++++++-- .../OobaboogaMessageCompleter.java | 4 ---- 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/autocomplete/MessageCompleter.java b/src/main/java/net/wurstclient/hacks/autocomplete/MessageCompleter.java index 9da3a4339f..cf477e637a 100644 --- a/src/main/java/net/wurstclient/hacks/autocomplete/MessageCompleter.java +++ b/src/main/java/net/wurstclient/hacks/autocomplete/MessageCompleter.java @@ -61,6 +61,7 @@ protected String buildPrompt(String draftMessage) // add chat history List chatHistory = MC.inGameHud.getChatHud().visibleMessages; + int messages = 0; for(int i = chatHistory.size() - 1; i >= 0; i--) { // get message @@ -72,9 +73,18 @@ protected String buildPrompt(String draftMessage) // give non-player messages a sender to avoid confusing the model if(!message.startsWith("<")) - message = " " + message; + if(modelSettings.filterServerMessages.isChecked()) + continue; + else + message = " " + message; + + // limit context length to save tokens + if(messages >= modelSettings.contextLength.getValueI()) + break; + // add message to prompt prompt += message + "\n"; + messages++; } // if the chat history is empty, add a dummy system message diff --git a/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java b/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java index 517a4dfe1b..9e84ef9c65 100644 --- a/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java +++ b/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java @@ -12,6 +12,7 @@ import java.util.List; import java.util.function.Consumer; +import net.wurstclient.settings.CheckboxSetting; import net.wurstclient.settings.EnumSetting; import net.wurstclient.settings.Setting; import net.wurstclient.settings.SliderSetting; @@ -30,7 +31,7 @@ public final class ModelSettings + " powerful.\n\n" + "\u00a7lGPT-4\u00a7r is more powerful, but only works if OpenAI" + " has chosen you to be a beta tester. It can be anywhere from" - + " 15x to 60x more expensive than ChatGPT. Probably not worth it.", + + " 15x to 60x more expensive than ChatGPT.", OpenAiModel.values(), OpenAiModel.GPT_3_5_TURBO); public enum OpenAiModel @@ -156,10 +157,29 @@ public String toString() } } + public final SliderSetting contextLength = new SliderSetting( + "Context length", + "Controls how many messages from the chat history are used to generate" + + " predictions.\n\n" + + "Higher values improve the quality of predictions, but also" + + " increase the time it takes to generate them, as well as cost" + + " (for OpenAI API users) or RAM usage (for oobabooga users).", + 10, 0, 100, 1, ValueDisplay.INTEGER); + + public final CheckboxSetting filterServerMessages = + new CheckboxSetting("Filter server messages", + "Only shows player-made chat messages to the model.\n\n" + + "This can help you save tokens and get more out of a low" + + " context length, but it also means that the model will have" + + " no idea about events like players joining, leaving, dying," + + " etc.", + false); + private final List settings = Collections.unmodifiableList(Arrays.asList(openAiModel, maxTokens, temperature, topP, presencePenalty, frequencyPenalty, - repetitionPenalty, encoderRepetitionPenalty, stopSequence)); + repetitionPenalty, encoderRepetitionPenalty, stopSequence, + contextLength, filterServerMessages)); public void forEach(Consumer action) { diff --git a/src/main/java/net/wurstclient/hacks/autocomplete/OobaboogaMessageCompleter.java b/src/main/java/net/wurstclient/hacks/autocomplete/OobaboogaMessageCompleter.java index 5424cfe771..38b75202cb 100644 --- a/src/main/java/net/wurstclient/hacks/autocomplete/OobaboogaMessageCompleter.java +++ b/src/main/java/net/wurstclient/hacks/autocomplete/OobaboogaMessageCompleter.java @@ -74,10 +74,6 @@ protected String extractCompletion(WsonObject response) throws JsonException String completion = response.getArray("results").getObject(0).getString("text"); - // remove the extra character at the start - if(!completion.isEmpty()) - completion = completion.substring(1); - // remove newlines completion = completion.replace("\n", " "); From 302305a3fde219a36e93cf5af598aeb44be27a33 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Thu, 4 May 2023 12:06:27 +0200 Subject: [PATCH 065/282] Update to Loom 1.2 --- build.gradle | 2 +- gradle.properties | 6 +- gradle/wrapper/gradle-wrapper.jar | Bin 59821 -> 60756 bytes gradle/wrapper/gradle-wrapper.properties | 4 +- gradlew | 8 +- gradlew.bat | 180 ++++++++++++----------- 6 files changed, 104 insertions(+), 96 deletions(-) diff --git a/build.gradle b/build.gradle index 1c8e16ef2f..a009a9c92c 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { } plugins { - id 'fabric-loom' version '1.1-SNAPSHOT' + id 'fabric-loom' version '1.2-SNAPSHOT' id 'maven-publish' } diff --git a/gradle.properties b/gradle.properties index d320195683..fbaa569d8b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,11 +5,11 @@ org.gradle.jvmargs=-Xmx1G # check these at https://fabricmc.net/develop/ and # https://www.curseforge.com/minecraft/mc-mods/fabric-api minecraft_version=1.19.4 -yarn_mappings=1.19.4+build.1 -loader_version=0.14.18 +yarn_mappings=1.19.4+build.2 +loader_version=0.14.19 #Fabric api -fabric_version=0.76.0+1.19.4 +fabric_version=0.80.0+1.19.4 # Mod Properties mod_version = v7.33-MC1.19.4 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 41d9927a4d4fb3f96a785543079b8df6723c946b..249e5832f090a2944b7473328c07c9755baa3196 100644 GIT binary patch delta 10197 zcmaKS1ymhDwk=#NxVyW%y9U<)A-Dv)xI0|j{UX8L-JRg>5ZnnKAh;%chM6~S-g^K4 z>eZ{yK4;gd>gwvXs=Id8Jk-J}R4pT911;+{Jp9@aiz6!p1Oz9z&_kGLA%J5%3Ih@0 zQ|U}%$)3u|G`jIfPzMVfcWs?jV2BO^*3+q2><~>3j+Z`^Z%=;19VWg0XndJ zwJ~;f4$;t6pBKaWn}UNO-wLCFHBd^1)^v%$P)fJk1PbK5<;Z1K&>k~MUod6d%@Bq9 z>(44uiaK&sdhwTTxFJvC$JDnl;f}*Q-^01T508(8{+!WyquuyB7R!d!J)8Ni0p!cV6$CHsLLy6}7C zYv_$eD;)@L)tLj0GkGpBoa727hs%wH$>EhfuFy{_8Q8@1HI%ZAjlpX$ob{=%g6`Ox zLzM!d^zy`VV1dT9U9(^}YvlTO9Bf8v^wMK37`4wFNFzW?HWDY(U(k6@tp(crHD)X5>8S-# zW1qgdaZa*Sh6i%60e1+hty}34dD%vKgb?QmQiZ=-j+isA4={V_*R$oGN#j|#ia@n6 zuZx4e2Xx?^lUwYFn2&Tmbx0qA3Z8;y+zKoeQu;~k~FZGy!FU_TFxYd!Ck;5QvMx9gj5fI2@BLNp~Ps@ zf@k<&Q2GS5Ia9?_D?v~$I%_CLA4x~eiKIZ>9w^c#r|vB?wXxZ(vXd*vH(Fd%Me8p( z=_0)k=iRh%8i`FYRF>E97uOFTBfajv{IOz(7CU zv0Gd84+o&ciHlVtY)wn6yhZTQQO*4Mvc#dxa>h}82mEKKy7arOqU$enb9sgh#E=Lq zU;_RVm{)30{bw+|056%jMVcZRGEBSJ+JZ@jH#~DvaDQm92^TyUq=bY*+AkEakpK>8 zB{)CkK48&nE5AzTqT;WysOG|!y}5fshxR8Ek(^H6i>|Fd&wu?c&Q@N9ZrJ=?ABHI! z`*z8D`w=~AJ!P-9M=T}f`;76$qZRllB&8#9WgbuO$P7lVqdX1=g*t=7z6!0AQ^ux_ z9rcfUv^t}o_l-ZE+TqvqFsA*~W<^78!k;~!i8(eS+(+@u8FxK+Q7;mHZ<1}|4m<}vh@p`t%|@eM_J(P% zI>M7C)Ir{l|J;$G_EGGEhbP4?6{sYzMqBv+x95N&YWFH6UcE@b}B?q)G*4<4mR@sy1#vPnLMK51tb#ED(8TA1nE zYfhK7bo1!R5WJF$5Y?zG21)6+_(_5oSX9sGIW;(O&S?Rh(nydNQYzKjjJ54aDJ-1F zrJ=np8LsN?%?Rt7f~3aAX!2E{`fh_pb?2(;HOB3W+I*~A>W%iY+v45+^e$cE10fA} zXPvw9=Bd+(;+!rl)pkYj0HGB}+3Z!Mr;zr%gz~c-hFMv8b2VRE2R$8V=_XE zq$3=|Yg05(fmwrJ)QK2ptB4no`Y8Dg_vK2QDc6-6sXRQ5k78-+cPi-fH}vpgs|Ive zE=m*XNVs?EWgiNI!5AcD*3QMW)R`EqT!f0e1%hERO&?AT7HWnSf5@#AR{OGuXG3Zb zCnVWg7h|61lGV3k+>L<#d>)InG>ETn1DbOHCfztqzQ_fBiaUt@q6VMy={Fe-w#~2- z0?*f|z$zgjI9>+JVICObBaK=pU}AEOd@q(8d?j7zQFD@=6t`|KmolTr2MfBI$;EGh zD%W0cA_d#V6Lb$us5yIG(|d>r-QleC4;%hEu5W9hyY zY#+ESY&v`8(&mC~?*|e5WEhC!YU2>m_}`K+q9)a(d$bsS<=YkyZGp}YA%TXw>@abA zS_poVPoN+?<6?DAuCNt&5SHV(hp56PJ})swwVFZFXM->F zc|0c8<$H_OV%DR|y7e+s$12@Ac8SUClPg8_O9sTUjpv%6Jsn5vsZCg>wL+db4c+{+ zsg<#wOuV4jeOq`veckdi-1`dz;gvL)bZeH|D*x=8UwRU5&8W1@l>3$)8WzET0%;1J zM3(X<7tKK&9~kWRI{&FmwY5Gg!b5f4kI_vSm)H1#>l6M+OiReDXC{kPy!`%Ecq-+3yZTk=<` zm)pE6xum5q0Qkd#iny0Q-S}@I0;mDhxf>sX)Oiv)FdsAMnpx%oe8OQ`m%Xeozdzx!C1rQR>m1c_}+J4x)K}k{G zo68;oGG&Ox7w^-m7{g4a7NJu-B|~M;oIH~~#`RyUNm##feZH;E?pf}nshmoiIY52n z%pc%lnU4Q#C=RUz)RU6}E_j4#)jh<&a%JyJj$Fufc#&COaxFHtl}zJUGNLBu3~_@1 zn9F^JO9);Duxo&i@>X(kbYga1i>6p1fca8FzQ0>((Lb-aPUbC*d~a03V$y;*RBY!R ziEJ2IF^FjrvO}0Uy{cMn%u<+P5U!UO>pm9#ZYL5i6|xSC+np7IH$GfXs&uI;y4as@ z&AzJh>(S2?3PKKgab3Z(`xbx(C#46XIvVcW8eG_DjT~}Yz_8PWZ`uf6^Xr=vkvL_` zqmvfgJL+Zc`;iq~iP?%@G7}~fal-zqxa0yNyHBJJ5M)9bI>7S_cg?Ya&p(I)C5Ef4 zZ>YAF6x|U=?ec?g*|f2g5Tw3PgxaM_bi_5Az9MO$;_Byw(2d}2%-|bg4ShdQ;)Z|M z4K|tFv)qx*kKGKoyh!DQY<{n&UmAChq@DJrQP>EY7g1JF(ih*D8wCVWyQ z5Jj^|-NVFSh5T0vd1>hUvPV6?=`90^_)t(L9)XOW7jeP45NyA2lzOn&QAPTl&d#6P zSv%36uaN(9i9WlpcH#}rmiP#=L0q(dfhdxvFVaOwM;pY;KvNQ9wMyUKs6{d}29DZQ z{H3&Sosr6)9Z+C>Q5)iHSW~gGoWGgK-0;k~&dyr-bA3O|3PCNzgC?UKS_B=^i8Ri^ zd_*_qI4B07Cayq|p4{`U_E_P=K`N_~{F|+-+`sCgcNxs`%X!$=(?l2aAW}0M=~COb zf19oe^iuAUuDEf)4tgv<=WRPpK@IjToNNC*#&Ykw!)aqWU4h#|U@(cG_=Qx+&xt~a zvCz~Ds3F71dsjNLkfM%TqdVNu=RNMOzh7?b+%hICbFlOAPphrYy>7D-e7{%o_kPFn z;T!?ilE-LcKM0P(GKMseEeW57Vs`=FF}(y@^pQl;rL3fHs8icmA+!6YJt&8 ztSF?%Un35qkv>drkks&BNTJv~xK?vD;aBkp7eIkDYqn+G0%;sT4FcwAoO+vke{8CO z0d76sgg$CannW5T#q`z~L4id)9BCKRU0A!Z-{HpXr)QJrd9@iJB+l32Ql)Z}*v(St zE)Vp=BB=DDB4Pr}B(UHNe31<@!6d{U?XDoxJ@S)9QM)2L%SA0x^~^fb=bdsBy!uh& zU?M_^kvnt%FZzm+>~bEH{2o?v&Iogs`1t-b+Ml`J!ZPS(46YQJKxWE81O$HE5w;** z|8zM%bp`M7J8)4;%DqH`wVTmM0V@D}xd%tRE3_6>ioMJxyi5Hkb>85muF81&EY!73ei zA3e<#ug||EZJ=1GLXNJ)A z791&ge#lF;GVX6IU?iw0jX^1bYaU?+x{zPlpyX6zijyn*nEdZ$fxxkl!a-~*P3bkf zPd*pzu~3GBYkR_>ET`5UM^>>zTV>5m>)f=az{d0sg6a8VzUtXy$ZS?h#Gk-CA?7)c zI%Vu9DN6XSDQn6;?n9`>l$q&>s?K)R8*OsmI+$L_m z_~E`}w694Z*`Xk3Ne=497Si~=RWRqCM?6=88smrxle#s*W znwhTRsMRmg?37GLJ-)%nDZA7r$YG849j8mJWir1bWBy& zZPneYojSbooC8U@tkO`bWx4%E5*;p#Q^1^S3lsfy7(6A{jL0`A__0vm?>xC%1y8_m z57FfWr^@YG2I1K7MGYuYd>JC}@sT2n^rkrY3w%~$J$Y~HSoOHn?zpR$ zjLj_bq@Yj8kd~DXHh30KVbz@K)0S;hPKm+S&-o%IG+@x@MEcrxW2KFh;z^4dJDZix zGRGe&lQD$p)0JVF4NRgGYuh0bYLy)BCy~sbS3^b3 zHixT<%-Vwbht|25T{3^Hk;qZ^3s!OOgljHs+EIf~C%=_>R5%vQI4mQR9qOXThMXlU zS|oSH>0PjnCakb*js2{ObN`}%HYsT6=%(xA| znpUtG_TJ08kHgm5l@G|t?4E3tG2fq?wNtIp*Vqrb{9@bo^~Rx7+J&OnayrX`LDcF~ zd@0m0ZJ#Z@=T>4kTa5e2FjI&5c(F7S{gnRPoGpu9eIqrtSvnT_tk$8T)r%YwZw!gK zj*k@cG)V&@t+mtDi37#>LhVGTfRA^p%x0d#_P|Mktz3*KOoLIqFm`~KGoDDD4OOxe z?}ag_c08u%vu=5Vx=~uoS8Q;}+R2~?Uh|m-+`-2kDo$d6T!nD*hc#dB(*R{LXV=zo z`PJP0V=O!@3l-bw+d`X6(=@fq=4O#ETa8M^fOvO4qja9o3e8ANc9$sI=A4$zUut~w z4+JryRkI{9qWxU1CCMM$@Aj=6)P+z?vqa=UCv_4XyVNoBD{Xb~Oi4cjjhm8fRD!*U z2)zaS;AI78^Wq+5mDInKiMz|z#K`2emQfNH*U;{9^{NqSMVoq?RSo43<8YpJM^+W$ zxy!A5>5Zl16Vi#?nAYywu3w_=KWnd3*QetocWt`3pK67>)ZVwnT3h zbPdD&MZkD?q=-N`MpCCwpM74L+Tr1aa)zJ)8G;(Pg51@U&5W>aNu9rA`bh{vgfE={ zdJ>aKc|2Ayw_bop+dK?Y5$q--WM*+$9&3Q9BBiwU8L<-`T6E?ZC`mT0b}%HR*LPK} z!MCd_Azd{36?Y_>yN{U1w5yrN8q`z(Vh^RnEF+;4b|2+~lfAvPT!`*{MPiDioiix8 zY*GdCwJ{S(5(HId*I%8XF=pHFz<9tAe;!D5$Z(iN#jzSql4sqX5!7Y?q4_%$lH zz8ehZuyl0K=E&gYhlfFWabnSiGty$>md|PpU1VfaC5~kskDnZX&Yu}?-h;OSav=8u z=e3Yq=mi$4A|sB-J00;1d{Sd1+!v0NtU((Nz2;PFFlC}V{@p&4wGcVhU&nI($RAS! zwXn7)?8~1J3*4+VccRSg5JS<(bBhBM&{ELMD4C_NTpvzboH!{Zr*%HP;{UqxI#g&7 zOAqPSW5Qus$8-xtTvD%h{Tw<2!XR(lU54LZG{)Cah*LZbpJkA=PMawg!O>X@&%+5XiyeIf91n2E*hl$k-Y(3iW*E}Mz-h~H~7S9I1I zR#-j`|Hk?$MqFhE4C@=n!hN*o5+M%NxRqP+aLxDdt=wS6rAu6ECK*;AB%Nyg0uyAv zO^DnbVZZo*|Ef{nsYN>cjZC$OHzR_*g%T#oF zCky9HJS;NCi=7(07tQXq?V8I&OA&kPlJ_dfSRdL2bRUt;tA3yKZRMHMXH&#W@$l%-{vQd7y@~i*^qnj^`Z{)V$6@l&!qP_y zg2oOd!Wit#)2A~w-eqw3*Mbe)U?N|q6sXw~E~&$!!@QYX4b@%;3=>)@Z#K^`8~Aki z+LYKJu~Y$;F5%_0aF9$MsbGS9Bz2~VUG@i@3Fi2q(hG^+Ia44LrfSfqtg$4{%qBDM z_9-O#3V+2~W$dW0G)R7l_R_vw(KSkC--u&%Rs^Io&*?R=`)6BN64>6>)`TxyT_(Rd zUn+aIl1mPa#Jse9B3`!T=|e!pIp$(8ZOe0ao?nS7o?oKlj zypC-fMj1DHIDrh1unUI1vp=-Fln;I9e7Jvs3wj*^_1&W|X} zZSL|S|Bb@CV*YC_-T&2!Ht3b6?)d`tHOP?rA;;t#zaXa0Sc;vGnV0BLIf8f-r{QHh z*Zp`4_ItlOR7{u(K+!p_oLDmaAkNag*l4#29F2b_A*0oz0T|#-&f*;c#<`^)(W@gm z#k9k=t%u8<+C1fNUA{Fh7~wgPrEZZ#(6aBI%6bR4RO(e1(ZocjoDek4#MTgZD>1NG zy9~yoZfWYfwe&S-(zk4o6q6o?2*~DOrJ(%5wSnEJMVOKCzHd z=Yhm+HLzoDl{P*Ybro7@sk1!Ez3`hE+&qr7Rw^2glw^M(b(NS2!F|Q!mi|l~lF94o z!QiV)Q{Z>GO5;l1y!$O)=)got;^)%@v#B!ZEVQy1(BJApHr5%Zh&W|gweD+%Ky%CO ztr45vR*y(@*Dg_Qw5v~PJtm^@Lyh*zRuT6~(K+^HWEF{;R#L$vL2!_ndBxCtUvZ(_ zauI7Qq}ERUWjr&XW9SwMbU>*@p)(cuWXCxRK&?ZoOy>2VESII53iPDP64S1pl{NsC zD;@EGPxs&}$W1;P6BB9THF%xfoLX|4?S;cu@$)9OdFst-!A7T{(LXtdNQSx!*GUSIS_lyI`da8>!y_tpJb3Zuf0O*;2y?HCfH z5QT6@nL|%l3&u4;F!~XG9E%1YwF*Fgs5V&uFsx52*iag(?6O|gYCBY3R{qhxT-Etb zq(E%V=MgQnuDGEKOGsmBj9T0-nmI%zys8NSO>gfJT4bP>tI>|ol@ zDt(&SUKrg%cz>AmqtJKEMUM;f47FEOFc%Bbmh~|*#E zDd!Tl(wa)ZZIFwe^*)4>{T+zuRykc3^-=P1aI%0Mh}*x7%SP6wD{_? zisraq`Las#y-6{`y@CU3Ta$tOl|@>4qXcB;1bb)oH9kD6 zKym@d$ zv&PZSSAV1Gwwzqrc?^_1+-ZGY+3_7~a(L+`-WdcJMo>EWZN3%z4y6JyF4NR^urk`c z?osO|J#V}k_6*9*n2?j+`F{B<%?9cdTQyVNm8D}H~T}?HOCXt%r7#2hz97Gx#X%62hyaLbU z_ZepP0<`<;eABrHrJAc!_m?kmu#7j}{empH@iUIEk^jk}^EFwO)vd7NZB=&uk6JG^ zC>xad8X$h|eCAOX&MaX<$tA1~r|hW?-0{t4PkVygTc`yh39c;&efwY(-#;$W)+4Xb z$XFsdG&;@^X`aynAMxsq)J#KZXX!sI@g~YiJdHI~r z$4mj_?S29sIa4c$z)19JmJ;Uj?>Kq=0XuH#k#};I&-6zZ_&>)j>UR0XetRO!-sjF< zd_6b1A2vfi++?>cf}s{@#BvTD|a%{9si7G}T+8ZnwuA z1k8c%lgE<-7f~H`cqgF;qZ|$>R-xNPA$25N1WI3#n%gj}4Ix}vj|e=x)B^roGQpB) zO+^#nO2 zjzJ9kHI6nI5ni&V_#5> z!?<7Qd9{|xwIf4b0bRc;zb}V4>snRg6*wl$Xz`hRDN8laL5tg&+@Dv>U^IjGQ}*=XBnXWrwTy;2nX?<1rkvOs#u(#qJ=A zBy>W`N!?%@Ay=upXFI}%LS9bjw?$h)7Dry0%d}=v0YcCSXf9nnp0tBKT1eqZ-4LU` zyiXglKRX)gtT0VbX1}w0f2ce8{$WH?BQm@$`ua%YP8G@<$n13D#*(Yd5-bHfI8!on zf5q4CPdgJLl;BqIo#>CIkX)G;rh|bzGuz1N%rr+5seP${mEg$;uQ3jC$;TsR&{IX< z;}7j3LnV+xNn^$F1;QarDf6rNYj7He+VsjJk6R@0MAkcwrsq4?(~`GKy|mgkfkd1msc2>%B!HpZ~HOzj}kl|ZF(IqB=D6ZTVcKe=I7)LlAI=!XU?J*i#9VXeKeaG zwx_l@Z(w`)5Cclw`6kQKlS<;_Knj)^Dh2pL`hQo!=GPOMR0iqEtx12ORLpN(KBOm5 zontAH5X5!9WHS_=tJfbACz@Dnkuw|^7t=l&x8yb2a~q|aqE_W&0M|tI7@ilGXqE)MONI8p67OiQGqKEQWw;LGga=ZM1;{pSw1jJK_y$vhY6 ztFrV7-xf>lbeKH1U)j3R=?w*>(Yh~NNEPVmeQ8n}0x01$-o z2Jyjn+sXhgOz>AzcZ zAbJZ@f}MBS0lLKR=IE{z;Fav%tcb+`Yi*!`HTDPqSCsFr>;yt^^&SI2mhKJ8f*%ji zz%JkZGvOn{JFn;)5jf^21AvO-9nRzsg0&CPz;OEn07`CfT@gK4abFBT$Mu?8fCcscmRkK+ zbAVJZ~#_a z{|(FFX}~8d3;DW8zuY9?r#Dt>!aD>} zlYw>D7y#eDy+PLZ&XKIY&Df0hsLDDi(Yrq8O==d30RchrUw8a=Eex>Dd?)3+k=}Q> z-b85lun-V$I}86Vg#l1S@1%=$2BQD5_waAZKQfJ${3{b2SZ#w1u+jMr{dJMvI|Og= zpQ9D={XK|ggbe04zTUd}iF{`GO1dV%zWK~?sM9OM(= zVK9&y4F^w1WFW{$qi|xQk0F`@HG8oLI5|5$j~ci9xTMT69v5KS-Yym--raU5kn2#C z<~5q^Bf0rTXVhctG2%&MG(cUGaz(gC(rcG~>qgO$W6>!#NOVQJ;pIYe-lLy(S=HgI zPh;lkL$l+FfMHItHnw_^bj8}CKM19t(C_2vSrhX2$K@-gFlH};#C?1;kk&U1L%4S~ zR^h%h+O1WE7DI$~dly?-_C7>(!E`~#REJ~Xa7lyrB$T!`&qYV5QreAa^aKr%toUJR zPWh)J3iD`(P6BI5k$oE$us#%!4$>`iH2p-88?WV0M$-K)JDibvA4 zpef%_*txN$Ei3=Lt(BBxZ&mhl|mUz-z*OD1=r9nfN zc5vOMFWpi>K=!$6f{eb?5Ru4M3o;t9xLpry|C%j~`@$f)OFB5+xo8XM8g&US@UU-sB|dAoc20y(F@=-2Ggp_`SWjEb#>IG^@j zuQK}e^>So#W2%|-)~K!+)wdU#6l>w5wnZt2pRL5Dz#~N`*UyC9tYechBTc2`@(OI# zNvcE*+zZZjU-H`QOITK^tZwOyLo)ZCLk>>Wm+flMsr5X{A<|m`Y281n?8H_2Fkz5}X?i%Rfm5s+n`J zDB&->=U+LtOIJ|jdYXjQWSQZFEs>Rm{`knop4Sq)(}O_@gk{14y51)iOcGQ5J=b#e z2Yx^6^*F^F7q_m-AGFFgx5uqyw6_4w?yKCJKDGGprWyekr;X(!4CnM5_5?KgN=3qCm03 z##6k%kIU5%g!cCL(+aK>`Wd;dZ4h$h_jb7n?nqx5&o9cUJfr%h#m4+Bh)>HodKcDcsXDXwzJ3jR(sSFqWV(OKHC*cV8;;&bH=ZI0YbW3PgIHwTjiWy z?2MXWO2u0RAEEq(zv9e%Rsz|0(OKB?_3*kkXwHxEuazIZ7=JhaNV*P~hv57q55LoebmJpfHXA@yuS{Esg+ z*C}0V-`x^=0nOa@SPUJek>td~tJ{U1T&m)~`FLp*4DF77S^{|0g%|JIqd-=5)p6a` zpJOsEkKT(FPS@t^80V!I-YJbLE@{5KmVXjEq{QbCnir%}3 zB)-J379=wrBNK6rbUL7Mh^tVmQYn-BJJP=n?P&m-7)P#OZjQoK0{5?}XqJScV6>QX zPR>G{xvU_P;q!;S9Y7*07=Z!=wxIUorMQP(m?te~6&Z0PXQ@I=EYhD*XomZ^z;`Os z4>Uh4)Cg2_##mUa>i1Dxi+R~g#!!i{?SMj%9rfaBPlWj_Yk)lCV--e^&3INB>I?lu z9YXCY5(9U`3o?w2Xa5ErMbl5+pDVpu8v+KJzI9{KFk1H?(1`_W>Cu903Hg81vEX32l{nP2vROa1Fi!Wou0+ZX7Rp`g;B$*Ni3MC-vZ`f zFTi7}c+D)!4hz6NH2e%%t_;tkA0nfkmhLtRW%){TpIqD_ev>}#mVc)<$-1GKO_oK8 zy$CF^aV#x7>F4-J;P@tqWKG0|D1+7h+{ZHU5OVjh>#aa8+V;6BQ)8L5k9t`>)>7zr zfIlv77^`Fvm<)_+^z@ac%D&hnlUAFt8!x=jdaUo{)M9Ar;Tz5Dcd_|~Hl6CaRnK3R zYn${wZe8_BZ0l0c%qbP}>($jsNDay>8+JG@F!uV4F;#zGsBP0f$f3HqEHDz_sCr^q z1;1}7KJ9&`AX2Qdav1(nNzz+GPdEk5K3;hGXe{Hq13{)c zZy%fFEEH#nlJoG{f*M^#8yXuW%!9svN8ry-Vi7AOFnN~r&D`%6d#lvMXBgZkX^vFj z;tkent^62jUr$Cc^@y31Lka6hS>F?1tE8JW$iXO*n9CQMk}D*At3U(-W1E~z>tG?> z5f`5R5LbrhRNR8kv&5d9SL7ke2a*Xr)Qp#75 z6?-p035n2<7hK;sb>t9GAwG4{9v~iEIG>}7B5zcCgZhu$M0-z8?eUO^E?g)md^XT_ z2^~-u$yak>LBy(=*GsTj6p<>b5PO&un@5hGCxpBQlOB3DpsItKZRC*oXq-r{u}Wb; z&ko>#fbnl2Z;o@KqS-d6DTeCG?m1 z&E>p}SEc*)SD&QjZbs!Csjx~0+$@ekuzV_wAalnQvX3a^n~3ui)|rDO+9HW|JPEeBGP4 z)?zcZ<8qv47`EWA*_X~H^vr(lP|f%=%cWFM;u)OFHruKT<~?>5Y8l?56>&;=WdZU# zZEK4-C8s-3zPMA^&y~e*9z)!ZJghr3N^pJa2A$??Xqx-BR*TytGYor&l8Q+^^r%Yq02xay^f#;;wO6K7G!v>wRd6531WnDI~h$PN( z+4#08uX?r&zVKsQ;?5eBX=FxsXaGyH4Gth4a&L|{8LnNCHFr1M{KjJ!BfBS_aiy-E zxtmNcXq3}WTwQ7Dq-9YS5o758sT(5b`Sg-NcH>M9OH1oW6&sZ@|GYk|cJI`vm zO<$~q!3_$&GfWetudRc*mp8)M)q7DEY-#@8w=ItkApfq3sa)*GRqofuL7)dafznKf zLuembr#8gm*lIqKH)KMxSDqbik*B(1bFt%3Vv|ypehXLCa&wc7#u!cJNlUfWs8iQ` z$66(F=1fkxwg745-8_eqV>nWGY3DjB9gE23$R5g&w|C{|xvT@7j*@aZNB199scGchI7pINb5iyqYn)O=yJJX)Ca3&Ca+{n<=1w|(|f0)h<9gs$pVSV<<9Og-V z8ki@nKwE)x)^wmHBMk?mpMT=g{S#^8W|>&rI#Ceh;9za}io0k@0JxiCqi-jHlxbt3 zjJA?RihhRvhk6%G5-D{ePh1jare*fQS<328P-DcVAxPTrw=n6k?C6EV75f}cnBRPT zMYDqqKu(ND&aOtc!QRV`vzJSVxx8i~WB#5Ml{b#eQqNnSi7l-bS-`ITW<^zyYQA(b zbj4SuRK>q9o`_v%+C=S?h>2e4!66Ij(P5{7Uz$3u6YJJC$W%EoBa{-(=tQ|y1vov%ZkXVOV z##_UVg4V^4ne#4~<-1DkJqkKqgT+E_=&4Ue&eQ-JC+gi?7G@d6= zximz{zE)WW{b@QCJ!7l&N5x=dXS?$5RBU-VvN4Uec-GHK&jPa&P2z+qDdLhIB+HU) zu0CW&uLvE^4I5xtK-$+oe|58)7m6*PO%Xt<+-XEA%jG_BEachkF3e@pn?tl!`8lOF zbi2QOuNXX)YT*MCYflILO{VZ*9GiC%R4FO20zMK?p+&aCMm2oeMK7(aW=UDzr=AO0 z$5mJ%=qRsR8rZ>_YsL+vi{3*J_9Kzq(;ZwRj+4_f0-*wbkSMPWahX#Fj_a8BnrhJ6 zo^ZZ?Vah1@&6#r=JkuaYDBdp;J3@ii+CHM&@9*er&#P}$@wI$bfrH)&c!*|nkvhf%^*Y6b%dKz%QBSIo@U z{?V^qEs4`q<8@n+u8YiB^sc@6g>TncG<|GsmC3egwE6aO=EwLr~3-2 zNr`+)`i+-83?|1Xy0^8ps&pb}YT?w1eWVnC9Ps1=KM;Rw)bH6O!7Did1NwpnqVPZc z*%Qo~qkDL>@^<^fmIBtx$WUWQiNtAB2x-LO^BB=|w~-zTnJNEdm1Ou(?8PF&U88X@ z#8rdaTd||)dG^uJw~N_-%!XNbuAyh4`>Shea=pSj0TqP+w4!`nxsmVSv02kb`DBr% zyX=e>5IJ3JYPtdbCHvKMdhXUO_*E9jc_?se7%VJF#&ZaBD;7+eFN3x+hER7!u&`Wz z7zMvBPR4y`*$a250KYjFhAKS%*XG&c;R-kS0wNY1=836wL6q02mqx;IPcH(6ThA@2 zXKQF|9H>6AW$KUF#^A%l6y5{fel77_+cR_zZ0(7=6bmNXABv}R!B-{(E^O6Y?ZS)n zs1QEmh_Fm7p}oRyT3zxUNr4UV8NGs+2b8|4shO$OGFj3D&7_e?#yDi=TTe%$2QbG5 zk<;q7aQ;p!M-Osm{vFdmXZ@!z9uWh!;*%>(vTRggufuUGP9Hols@vhx z73pn$3u2;vzRvnXuT&$Os7J@6y12*j!{ix%3B4YU1466ItmJs0NsU(4ZYRYh7wEA6q{b*Hs6@k~ zi7Yq@Ax!et0cUMTvk7P%ym){MHpcliHEI~e3HP0NV=}7;xFv#IC?a<=`>~j_sk{e> z7vg-tK*p83HZ0=QK@ zRIHo^r{D8&Ms-^WZp+6US_Quqjh$Q66W^1}=Uz&XJ8AQE9&2}P zY|FXZzZ|0IiaBd2qdt6dIjQr(ZMIOU%NG1F&fu6Po9m^?BvLhI6T0R!H2d8;U(&p2 zYA|MFscMqcO(ye~Jp?F;0>Ke+5hzVr?aBNe>GsGgr$XrpS9uajN2kNQ3o$V5rp0T( z0$6TJC;3)26SNG#XcX7l^MKTn$ga?6r4Jzfb%ZgA(Zbwit0$kY=avSnI$@Gk%+^pu zS5mHrcRS8LFPC*uVWH4DDD1pY$H8N>X?KIJZuZ2SvTqc5Nr0GHdD8TCJcd$zIhOdC zZX0ErnsozQh;t^==4zTfrZO421AL?)O)l#GSxU#|LTTg4#&yeK=^w#;q63!Nv~1(@ zs^-RNRuF&qgcr+bIzc@7$h9L;_yjdifE*$j0Q&Np=1AuHL--zdkv@}`1 zo~LlDl_YAq*z?vmr4M`GjDkl9?p|-tl(DtX76oZv25_DtZutLS9Ez!5~p?th@4 zyc_uax4W#<(#)LMkvo)yp|5tKsC2=p#6PyhpH|449T<9Zdk|%CAb5cw?fhvQtBO&7 zpQ9$24yLqPHP;$N&fe2wm%8qdctwIna<3SwGtQA3{C77s%CW%LYxtK(SBGustL0<( zu~U9r0UOkr(c{OJxZS0Ntu3+cJlF7R`7k-Bsa&q?9Ae5{{|o~?cM+T7{lB1^#vT8R z?>c9fNWey`1dKDY%F3d2O*8^qYhjlB8*7HMKE<*=(A`{>=1%s1}Pm&#_t1xy!FkPk@%SMEka2@*= zxDuM|vJJ5s+xgDls{>*o!7eOcs|xuVBPWX&+y5vEiADK%hi`#Dbd>;;Pbk2H4*-X&R?_-6ZEutSd8hC+sSjhIo z;D(j4P;2EVpEj#UF7IjM6PC+X$C5T&=nL`*!*hm9U)#O?>wqOgC>jXKN3Slk_yaQX zLf|4D8T4k|wHW`;#ZQVocNF|3izi0sOqXzi7@KlYC3CXBG`94wD;tMI1bj|8Vm zY}9`VI9!plSfhAal$M_HlaYOVNU?9Z#0<$o?lXXbX3O(l_?f)i3_~r+GcO-x#+x^X zfsZl0>Rj2iP1rsT;+b;Mr? z4Vu&O)Q5ru4j;qaSP5gA{az@XTS1NpT0d9Xhl_FkkRpcEGA0(QQ~YMh#&zwDUkNzm z6cgkdgl9W{iL6ArJ1TQHqnQ^SQ1WGu?FT|93$Ba}mPCH~!$3}0Y0g zcoG%bdTd$bmBx9Y<`Jc+=Cp4}c@EUfjiz;Rcz101p z=?#i$wo>gBE9|szaZMt-d4nUIhBnYRuBVyx+p?5#aZQgUe(!ah`J#l1$%bl5avL27 zU2~@V`3Ic&!?FhDX@Cw!R4%xtWark#p8DLT)HCZ?VJxf^yr@AD*!ERK3#L$E^*Yr? zzN&uF9Roh4rP+r`Z#7U$tzl6>k!b~HgM$C<_crP=vC>6=q{j?(I}!9>g3rJU(&){o z`R^E*9%+kEa8H_fkD9VT7(Fks&Y-RcHaUJYf-|B+eMXMaRM;{FKRiTB>1(=Iij4k1(X__|WqAd-~t#2@UQ}Z&<1Th0azdXfoll!dd)6>1miA z!&=6sDJm=e$?L&06+Q3`D-HNSkK-3$3DdZMX-6Xjn;wd#9A{~ur!2NcX>(qY_oZL0~H7dnQ9sgLe!W>~2|RSW7|hWn<({Pg*xF$%B-!rKe^_R_vc z(LO!0agxxP;FWPV({8#lEv$&&GVakGus=@!3YVG`y^AO1m{2%Np;>HNA1e{=?ra1C}H zAwT0sbwG|!am;fl?*_t^^#yLDXZ*Nx)_FqueZi0c-G~omtpHW0Cu)mEJ`Z1X8brq$ z%vK##b~o*^b&Hz!hgrD=^6P8}aW40lhzMLB5T5*v`1QH?+L~-@CDi3+C@nRf2{7UE zyDIe{@LKw`Eu=Z%6<<_=#V|yxJIKiq_N?ZJ_v0$c)N4l07ZV_mIXG}glfBSPivOhw z-~+9GdckSpMBNR9eR`Y|9_)sXS+u_OiQ%!9rE(2AFjoxN8lk16Sb~^Sq6kRoEp3yD(mm`HsYIXcag_EAB8MHc}nahxVVUTts~U9P|f;7Ul$_` zStR4v&P4q_$KXOEni$lkxy8=9w8G&47VY0oDb^+jT+>ARe3NHUg~St`$RDxY)?;_F znqTujR&chZd2qHF7y8D$4&E3+e@J~!X3&BW4BF(Ebp#TEjrd+9SU!)j;qH+ZkL@AW z?J6Mj}v0_+D zH0qlbzCkHf|EZ`6c>5ig5NAFF%|La%M-}g(7&}Vx8K)qg30YD;H!S!??{;YivzrH0 z(M%2*b_S-)yh&Aiqai)GF^c!<1Xemj|13>dZ_M#)41SrP;OEMaRJ)bCeX*ZT7W`4Y zQ|8L@NHpD@Tf(5>1U(s5iW~Zdf7$@pAL`a3X@YUv1J>q-uJ_(Dy5nYTCUHC}1(dlI zt;5>DLcHh&jbysqt?G01MhXI3!8wgf){Hv}=0N|L$t8M#L7d6WscO8Om2|NBz2Ga^ zs86y%x$H18)~akOWD7@em7)ldlWgb?_sRN>-EcYQO_}aX@+b$dR{146>{kXWP4$nN{V0_+|3{Lt|8uX_fhKh~i{(x%cj*PU$i{PO(5$uA? zQzO>a6oPj-TUk&{zq?JD2MNb6Mf~V3g$ra+PB;ujLJ2JM(a7N*b`y{MX--!fAd}5C zF$D_b8S;+Np(!cW)(hnv5b@@|EMt*RLKF*wy>ykFhEhlPN~n_Bj>LT9B^_yj>z#fx z3JuE4H&?Cc!;G@}E*3k`HK#8ag`yE3Z1)5JUlSua%qkF zkTu|<9{w9OSi$qr)WD#7EzITnch=xnR63E*d~WGvi*Co9BBE?ETHud;!Z)7&wz+l6 zuKODYG1>I1U#a%&(GNJ`AqRfg=H!BtSl+_;CEeufF-#+*2EMMz-22@>18=8PH{PHd z);mN=aR0MPF>eutLiS#-AOX>#2%+pTGEOj!j4L(m0~&xR=0+g#HNpno6@veLhJp}e zyNVC$a>4;!9&iGvU_dj&xbKt@^t6r%f^)+}eV^suRTLP52+BVs0kOLwg6n`=NUv50E7My8XQUh?y%mW62OT1pMrKI3Q(r`7vU&@93=G~A?b(^pvC-8x=bSk zZ60BQR96WB1Z@9Df(M1IQh+YrU8sEjB=Tc2;(zBn-pete*icZE|M&Uc+oHg`|1o`g zH~m+k=D$o);{Rs)b<9Zo|9_Z6L6QHLNki(N>Dw^^i1LITprZeeqIaT#+)fw)PlllU zldphHC)t!0Gf(i9zgVm>`*TbmITF zH1FZ4{wrjRCx{t^26VK_2srZuWuY*EMAsMrJYFFCH35Ky7bq8<0K|ey2wHnrFMZyr z&^yEgX{{3i@&iE5>xKZ{Ads36G3a!i50D!C4?^~cLB<<|fc1!XN(HJRM)H^21sEs%vv+Mu0h*HkLHaEffMwc0n6)JhNXY#M5w@iO@dfXY z0c6dM2a4Hd1SA*#qYj@jK}uVgAZdaBj8t6uuhUNe>)ne9vfd#C6qLV9+@Q7{MnF#0 zJ7fd-ivG_~u3bVvOzpcw1u~ZSp8-kl(sunnX>L~*K-ByWDM2E8>;Si6kn^58AZQxI xVa^It*?521mj4+UJO?7%w*+`EfEcU=@KhDx-s^WzP+ae~{CgHDE&XryzW}Nww%-5% diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2d2fd7c74a..fae08049a6 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists \ No newline at end of file +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index a58591e97b..a69d9cb6c2 100644 --- a/gradlew +++ b/gradlew @@ -205,6 +205,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. @@ -231,4 +237,4 @@ eval "set -- $( tr '\n' ' ' )" '"$@"' -exec "$JAVACMD" "$@" \ No newline at end of file +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 477c896641..53a6b238d4 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,89 +1,91 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega \ No newline at end of file +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega From d89187b8c22eb032b265b008f764996166d5c924 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Thu, 4 May 2023 12:25:09 +0200 Subject: [PATCH 066/282] [Wurst-Bot] Update to 23w18a --- gradle.properties | 8 ++++---- src/main/java/net/wurstclient/WurstClient.java | 2 +- src/main/java/net/wurstclient/mixin/StatsScreenMixin.java | 2 +- src/main/java/net/wurstclient/mixin/TitleScreenMixin.java | 2 +- .../net/wurstclient/navigator/NavigatorMainScreen.java | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gradle.properties b/gradle.properties index c1c9d9aa5e..dfbb3c8b30 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,15 +4,15 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these at https://fabricmc.net/develop/ and # https://www.curseforge.com/minecraft/mc-mods/fabric-api -minecraft_version=23w17a -yarn_mappings=23w17a+build.4 +minecraft_version=23w18a +yarn_mappings=23w18a+build.1 loader_version=0.14.19 #Fabric api -fabric_version=0.79.1+1.20 +fabric_version=0.80.1+1.20 # Mod Properties -mod_version = v7.33-MC23w17a +mod_version = v7.33-MC23w18a maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index f4e1e151d4..f939002de8 100644 --- a/src/main/java/net/wurstclient/WurstClient.java +++ b/src/main/java/net/wurstclient/WurstClient.java @@ -57,7 +57,7 @@ public enum WurstClient public static IMinecraftClient IMC; public static final String VERSION = "7.33"; - public static final String MC_VERSION = "23w17a"; + public static final String MC_VERSION = "23w18a"; private WurstAnalytics analytics; private EventManager eventManager; diff --git a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java index 187f0eeda4..5297484e74 100644 --- a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java @@ -55,7 +55,7 @@ private void onCreateButtons(CallbackInfo ci) .equals(I18n.translate("gui.done"))) continue; - button.setX(width / 2 + 2); + button.method_46421(width / 2 + 2); button.setWidth(150); } } diff --git a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java index 28488e077b..87f2248691 100644 --- a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java @@ -77,7 +77,7 @@ private void onTick(CallbackInfo ci) // adjust AltManager button if Realms button has been moved // happens when ModMenu is installed - altsButton.setY(realmsButton.getY()); + altsButton.method_46419(realmsButton.getY()); } /** diff --git a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java index 70cd9d694c..723c4d909c 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java @@ -74,7 +74,7 @@ protected void onResize() setFocused(searchBar); searchBar.setFocused(true); - searchBar.setX(middleX - 100); + searchBar.method_46421(middleX - 100); setContentHeight(navigatorDisplayList.size() / 3 * 20); } From 6a45b9becdb67c8e34f5ee98862f51a4d2d4ee48 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Thu, 4 May 2023 13:34:26 +0200 Subject: [PATCH 067/282] Update to 23w18a --- src/main/java/net/wurstclient/hacks/AutoFarmHack.java | 6 +++--- .../java/net/wurstclient/hacks/BaseFinderHack.java | 2 +- .../java/net/wurstclient/hacks/CaveFinderHack.java | 2 +- src/main/java/net/wurstclient/hacks/MobEspHack.java | 2 +- .../java/net/wurstclient/hacks/MobSpawnEspHack.java | 2 +- src/main/java/net/wurstclient/hacks/SearchHack.java | 2 +- src/main/java/net/wurstclient/hacks/TunnellerHack.java | 10 +++++----- .../wurstclient/hacks/chestesp/ChestEspRenderer.java | 4 ++-- .../wurstclient/hacks/newchunks/NewChunksRenderer.java | 2 +- .../java/net/wurstclient/mixin/StatsScreenMixin.java | 2 +- .../java/net/wurstclient/mixin/TitleScreenMixin.java | 2 +- .../net/wurstclient/navigator/NavigatorMainScreen.java | 2 +- src/main/java/net/wurstclient/treebot/Tree.java | 2 +- src/main/resources/fabric.mod.json | 4 ++-- 14 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/AutoFarmHack.java b/src/main/java/net/wurstclient/hacks/AutoFarmHack.java index 01095fca84..2c33ad406b 100644 --- a/src/main/java/net/wurstclient/hacks/AutoFarmHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoFarmHack.java @@ -529,7 +529,7 @@ private void updateVertexBuffers(List blocksToHarvest, if(greenBuffer != null) greenBuffer.close(); - greenBuffer = new VertexBuffer(); + greenBuffer = new VertexBuffer(VertexBuffer.class_8555.STATIC); bufferBuilder.begin(VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION); @@ -552,7 +552,7 @@ private void updateVertexBuffers(List blocksToHarvest, if(cyanBuffer != null) cyanBuffer.close(); - cyanBuffer = new VertexBuffer(); + cyanBuffer = new VertexBuffer(VertexBuffer.class_8555.STATIC); bufferBuilder.begin(VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION); @@ -573,7 +573,7 @@ private void updateVertexBuffers(List blocksToHarvest, if(redBuffer != null) redBuffer.close(); - redBuffer = new VertexBuffer(); + redBuffer = new VertexBuffer(VertexBuffer.class_8555.STATIC); bufferBuilder.begin(VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION); diff --git a/src/main/java/net/wurstclient/hacks/BaseFinderHack.java b/src/main/java/net/wurstclient/hacks/BaseFinderHack.java index a724aee258..9b651b428d 100644 --- a/src/main/java/net/wurstclient/hacks/BaseFinderHack.java +++ b/src/main/java/net/wurstclient/hacks/BaseFinderHack.java @@ -208,7 +208,7 @@ public void onUpdate() if(vertexBuffer != null) vertexBuffer.close(); - vertexBuffer = new VertexBuffer(); + vertexBuffer = new VertexBuffer(VertexBuffer.class_8555.STATIC); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); diff --git a/src/main/java/net/wurstclient/hacks/CaveFinderHack.java b/src/main/java/net/wurstclient/hacks/CaveFinderHack.java index 700410ebb6..a85eff1aa1 100644 --- a/src/main/java/net/wurstclient/hacks/CaveFinderHack.java +++ b/src/main/java/net/wurstclient/hacks/CaveFinderHack.java @@ -462,7 +462,7 @@ private void setBufferFromTask() if(vertexBuffer != null) vertexBuffer.close(); - vertexBuffer = new VertexBuffer(); + vertexBuffer = new VertexBuffer(VertexBuffer.class_8555.STATIC); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); diff --git a/src/main/java/net/wurstclient/hacks/MobEspHack.java b/src/main/java/net/wurstclient/hacks/MobEspHack.java index 1a1f628b6c..11a3d853fb 100644 --- a/src/main/java/net/wurstclient/hacks/MobEspHack.java +++ b/src/main/java/net/wurstclient/hacks/MobEspHack.java @@ -75,7 +75,7 @@ public void onEnable() EVENTS.add(CameraTransformViewBobbingListener.class, this); EVENTS.add(RenderListener.class, this); - mobBox = new VertexBuffer(); + mobBox = new VertexBuffer(VertexBuffer.class_8555.STATIC); Box bb = new Box(-0.5, 0, -0.5, 0.5, 1, 0.5); RenderUtils.drawOutlinedBox(bb, mobBox); } diff --git a/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java b/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java index 658f81c20e..81dbdd3b33 100644 --- a/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java +++ b/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java @@ -337,7 +337,7 @@ private void compileBuffer() if(vertexBuffer != null) vertexBuffer.close(); - vertexBuffer = new VertexBuffer(); + vertexBuffer = new VertexBuffer(VertexBuffer.class_8555.STATIC); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); diff --git a/src/main/java/net/wurstclient/hacks/SearchHack.java b/src/main/java/net/wurstclient/hacks/SearchHack.java index f6f9d27eca..4702ffa6fd 100644 --- a/src/main/java/net/wurstclient/hacks/SearchHack.java +++ b/src/main/java/net/wurstclient/hacks/SearchHack.java @@ -429,7 +429,7 @@ private void setBufferFromTask() if(vertexBuffer != null) vertexBuffer.close(); - vertexBuffer = new VertexBuffer(); + vertexBuffer = new VertexBuffer(VertexBuffer.class_8555.STATIC); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); diff --git a/src/main/java/net/wurstclient/hacks/TunnellerHack.java b/src/main/java/net/wurstclient/hacks/TunnellerHack.java index dd9e41aa28..0e0b53f2a8 100644 --- a/src/main/java/net/wurstclient/hacks/TunnellerHack.java +++ b/src/main/java/net/wurstclient/hacks/TunnellerHack.java @@ -274,7 +274,7 @@ private void updateCyanBuffer() if(vertexBuffers[0] != null) vertexBuffers[0].close(); - vertexBuffers[0] = new VertexBuffer(); + vertexBuffers[0] = new VertexBuffer(VertexBuffer.class_8555.STATIC); BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; @@ -395,7 +395,7 @@ public void run() if(vertexBuffers[1] != null) vertexBuffers[1].close(); - vertexBuffers[1] = new VertexBuffer(); + vertexBuffers[1] = new VertexBuffer(VertexBuffer.class_8555.STATIC); BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; @@ -509,7 +509,7 @@ public boolean canRun() if(vertexBuffers[2] != null) vertexBuffers[2].close(); - vertexBuffers[2] = new VertexBuffer(); + vertexBuffers[2] = new VertexBuffer(VertexBuffer.class_8555.STATIC); BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; @@ -654,7 +654,7 @@ public boolean canRun() if(vertexBuffers[3] != null) vertexBuffers[3].close(); - vertexBuffers[3] = new VertexBuffer(); + vertexBuffers[3] = new VertexBuffer(VertexBuffer.class_8555.STATIC); BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; @@ -756,7 +756,7 @@ public boolean canRun() if(vertexBuffers[4] != null) vertexBuffers[4].close(); - vertexBuffers[4] = new VertexBuffer(); + vertexBuffers[4] = new VertexBuffer(VertexBuffer.class_8555.STATIC); BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; diff --git a/src/main/java/net/wurstclient/hacks/chestesp/ChestEspRenderer.java b/src/main/java/net/wurstclient/hacks/chestesp/ChestEspRenderer.java index 51a875f1ad..afedb68137 100644 --- a/src/main/java/net/wurstclient/hacks/chestesp/ChestEspRenderer.java +++ b/src/main/java/net/wurstclient/hacks/chestesp/ChestEspRenderer.java @@ -112,8 +112,8 @@ public void renderLines(ChestEspGroup group) public static void prepareBuffers() { closeBuffers(); - solidBox = new VertexBuffer(); - outlinedBox = new VertexBuffer(); + solidBox = new VertexBuffer(VertexBuffer.class_8555.STATIC); + outlinedBox = new VertexBuffer(VertexBuffer.class_8555.STATIC); Box box = new Box(BlockPos.ORIGIN); RenderUtils.drawSolidBox(box, solidBox); diff --git a/src/main/java/net/wurstclient/hacks/newchunks/NewChunksRenderer.java b/src/main/java/net/wurstclient/hacks/newchunks/NewChunksRenderer.java index 25fd7f4485..fda2147e51 100644 --- a/src/main/java/net/wurstclient/hacks/newchunks/NewChunksRenderer.java +++ b/src/main/java/net/wurstclient/hacks/newchunks/NewChunksRenderer.java @@ -41,7 +41,7 @@ public NewChunksRenderer(SliderSetting altitude, SliderSetting opacity, public void updateBuffer(int i, BuiltBuffer buffer) { - vertexBuffers[i] = new VertexBuffer(); + vertexBuffers[i] = new VertexBuffer(VertexBuffer.class_8555.STATIC); vertexBuffers[i].bind(); vertexBuffers[i].upload(buffer); VertexBuffer.unbind(); diff --git a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java index 5297484e74..187f0eeda4 100644 --- a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java @@ -55,7 +55,7 @@ private void onCreateButtons(CallbackInfo ci) .equals(I18n.translate("gui.done"))) continue; - button.method_46421(width / 2 + 2); + button.setX(width / 2 + 2); button.setWidth(150); } } diff --git a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java index 87f2248691..28488e077b 100644 --- a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java @@ -77,7 +77,7 @@ private void onTick(CallbackInfo ci) // adjust AltManager button if Realms button has been moved // happens when ModMenu is installed - altsButton.method_46419(realmsButton.getY()); + altsButton.setY(realmsButton.getY()); } /** diff --git a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java index 723c4d909c..70cd9d694c 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java @@ -74,7 +74,7 @@ protected void onResize() setFocused(searchBar); searchBar.setFocused(true); - searchBar.method_46421(middleX - 100); + searchBar.setX(middleX - 100); setContentHeight(navigatorDisplayList.size() / 3 * 20); } diff --git a/src/main/java/net/wurstclient/treebot/Tree.java b/src/main/java/net/wurstclient/treebot/Tree.java index d5cfe540f5..b455eb1f26 100644 --- a/src/main/java/net/wurstclient/treebot/Tree.java +++ b/src/main/java/net/wurstclient/treebot/Tree.java @@ -39,7 +39,7 @@ public void compileBuffer() if(vertexBuffer != null) vertexBuffer.close(); - vertexBuffer = new VertexBuffer(); + vertexBuffer = new VertexBuffer(VertexBuffer.class_8555.STATIC); int regionX = (stump.getX() >> 9) * 512; int regionZ = (stump.getZ() >> 9) * 512; diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index ab54ad5529..17bdcddd9f 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -30,8 +30,8 @@ "depends": { "fabricloader": ">=0.14.19", - "fabric-api": ">=0.79.1", - "minecraft": "~1.20-alpha.23.17.a", + "fabric-api": ">=0.80.1", + "minecraft": "~1.20-alpha.23.18.a", "java": ">=17" }, "suggests": { From 88711cf1a5270b5f9c0e9ba2cf9d9148e7b58743 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Fri, 5 May 2023 19:37:56 +0200 Subject: [PATCH 068/282] Fix Parkour not working with boats --- src/main/java/net/wurstclient/hacks/ParkourHack.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/ParkourHack.java b/src/main/java/net/wurstclient/hacks/ParkourHack.java index 8be84195a7..c5cfb79292 100644 --- a/src/main/java/net/wurstclient/hacks/ParkourHack.java +++ b/src/main/java/net/wurstclient/hacks/ParkourHack.java @@ -7,10 +7,7 @@ */ package net.wurstclient.hacks; -import java.util.stream.Stream; - import net.minecraft.util.math.Box; -import net.minecraft.util.shape.VoxelShape; import net.wurstclient.Category; import net.wurstclient.events.UpdateListener; import net.wurstclient.hack.Hack; @@ -64,10 +61,7 @@ public void onUpdate() Box adjustedBox = box.stretch(0, -minDepth.getValue(), 0) .expand(-edgeDistance.getValue(), 0, -edgeDistance.getValue()); - Stream blockCollisions = - IMC.getWorld().getBlockCollisionsStream(MC.player, adjustedBox); - - if(blockCollisions.findAny().isPresent()) + if(!MC.world.isSpaceEmpty(MC.player, adjustedBox)) return; MC.player.jump(); From 51e8e2d148f03fdc47b1e35bf14ee1dd715380d1 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Fri, 5 May 2023 21:43:47 +0200 Subject: [PATCH 069/282] Add edge distance setting to SafeWalk --- .../net/wurstclient/hacks/SafeWalkHack.java | 29 +++++++++++++------ .../mixin/ClientPlayerEntityMixin.java | 7 +++++ 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/SafeWalkHack.java b/src/main/java/net/wurstclient/hacks/SafeWalkHack.java index a94acccfb2..745d59657c 100644 --- a/src/main/java/net/wurstclient/hacks/SafeWalkHack.java +++ b/src/main/java/net/wurstclient/hacks/SafeWalkHack.java @@ -15,6 +15,8 @@ import net.wurstclient.hack.Hack; import net.wurstclient.mixinterface.IKeyBinding; import net.wurstclient.settings.CheckboxSetting; +import net.wurstclient.settings.SliderSetting; +import net.wurstclient.settings.SliderSetting.ValueDisplay; @SearchTags({"safe walk"}) public final class SafeWalkHack extends Hack @@ -22,6 +24,12 @@ public final class SafeWalkHack extends Hack private final CheckboxSetting sneak = new CheckboxSetting("Sneak at edges", "Visibly sneak at edges.", false); + private final SliderSetting edgeDistance = new SliderSetting( + "Sneak edge distance", + "How close SafeWalk will let you get to the edge before sneaking.\n\n" + + "This setting is only used when \"Sneak at edges\" is enabled.", + 0.05, 0.05, 0.25, 0.001, ValueDisplay.DECIMAL.withSuffix("m")); + private boolean sneaking; public SafeWalkHack() @@ -29,6 +37,7 @@ public SafeWalkHack() super("SafeWalk"); setCategory(Category.MOVEMENT); addSetting(sneak); + addSetting(edgeDistance); } @Override @@ -47,7 +56,9 @@ protected void onDisable() public void onClipAtLedge(boolean clipping) { - if(!isEnabled() || !sneak.isChecked() || !MC.player.isOnGround()) + ClientPlayerEntity player = MC.player; + + if(!isEnabled() || !sneak.isChecked() || !player.isOnGround()) { if(sneaking) setSneaking(false); @@ -55,15 +66,13 @@ public void onClipAtLedge(boolean clipping) return; } - ClientPlayerEntity player = MC.player; - Box bb = player.getBoundingBox(); - float stepHeight = player.stepHeight; + Box box = player.getBoundingBox(); + Box adjustedBox = box.stretch(0, -player.stepHeight, 0) + .expand(-edgeDistance.getValue(), 0, -edgeDistance.getValue()); + + if(MC.world.isSpaceEmpty(player, adjustedBox)) + clipping = true; - for(double x = -0.05; x <= 0.05; x += 0.05) - for(double z = -0.05; z <= 0.05; z += 0.05) - if(MC.world.isSpaceEmpty(player, bb.offset(x, -stepHeight, z))) - clipping = true; - setSneaking(clipping); } @@ -78,4 +87,6 @@ private void setSneaking(boolean sneaking) this.sneaking = sneaking; } + + // See ClientPlayerEntityMixin } diff --git a/src/main/java/net/wurstclient/mixin/ClientPlayerEntityMixin.java b/src/main/java/net/wurstclient/mixin/ClientPlayerEntityMixin.java index b673fc7b49..005bde80ad 100644 --- a/src/main/java/net/wurstclient/mixin/ClientPlayerEntityMixin.java +++ b/src/main/java/net/wurstclient/mixin/ClientPlayerEntityMixin.java @@ -201,6 +201,9 @@ protected float getJumpVelocity() .getAdditionalJumpMotion(); } + /** + * This is the part that makes SafeWalk work. + */ @Override protected boolean clipAtLedge() { @@ -208,6 +211,10 @@ protected boolean clipAtLedge() || WurstClient.INSTANCE.getHax().safeWalkHack.isEnabled(); } + /** + * This mixin allows SafeWalk to sneak visibly when the player is + * near a ledge. + */ @Override protected Vec3d adjustMovementForSneaking(Vec3d movement, MovementType type) { From d67acaa238bb63dc03239ba3cb271c6ff72eb873 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Fri, 5 May 2023 21:57:18 +0200 Subject: [PATCH 070/282] Change version to 7.34 --- gradle.properties | 2 +- src/main/java/net/wurstclient/WurstClient.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index fbaa569d8b..5ef3bc12ae 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ loader_version=0.14.19 fabric_version=0.80.0+1.19.4 # Mod Properties -mod_version = v7.33-MC1.19.4 +mod_version = v7.34-MC1.19.4 maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index 2015ea67d6..443d865010 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 MinecraftClient MC; public static IMinecraftClient IMC; - public static final String VERSION = "7.33"; + public static final String VERSION = "7.34"; public static final String MC_VERSION = "1.19.4"; private WurstAnalytics analytics; From 9ab8243b293e0c3e59b2229771847ede0bfc688b Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 7 May 2023 17:47:34 +0200 Subject: [PATCH 071/282] Fix Step legit mode not working below y=-2 --- src/main/java/net/wurstclient/hacks/StepHack.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/wurstclient/hacks/StepHack.java b/src/main/java/net/wurstclient/hacks/StepHack.java index b67f69cea2..0a50087cfc 100644 --- a/src/main/java/net/wurstclient/hacks/StepHack.java +++ b/src/main/java/net/wurstclient/hacks/StepHack.java @@ -87,7 +87,7 @@ public void onUpdate() if(!MC.world.isSpaceEmpty(player, box.offset(0, 1, 0))) return; - double stepHeight = -1; + double stepHeight = Double.NEGATIVE_INFINITY; ArrayList blockCollisions = IMC.getWorld().getBlockCollisionsStream(player, box) From cc6c2cc70103e2fd8c3e3ebb94937fb88ad60d47 Mon Sep 17 00:00:00 2001 From: IUDevman <58370012+IUDevman@users.noreply.github.com> Date: Sun, 7 May 2023 17:47:29 -0500 Subject: [PATCH 072/282] Added AntiEntityPush --- .../VelocityFromEntityCollisionListener.java | 54 +++++++++++++++++++ .../java/net/wurstclient/hack/HackList.java | 1 + .../wurstclient/hacks/AntiEntityPushHack.java | 43 +++++++++++++++ .../net/wurstclient/mixin/EntityMixin.java | 17 ++++++ .../resources/assets/wurst/lang/en_us.json | 3 +- 5 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 src/main/java/net/wurstclient/events/VelocityFromEntityCollisionListener.java create mode 100644 src/main/java/net/wurstclient/hacks/AntiEntityPushHack.java diff --git a/src/main/java/net/wurstclient/events/VelocityFromEntityCollisionListener.java b/src/main/java/net/wurstclient/events/VelocityFromEntityCollisionListener.java new file mode 100644 index 0000000000..876a8fbe28 --- /dev/null +++ b/src/main/java/net/wurstclient/events/VelocityFromEntityCollisionListener.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.events; + +import net.minecraft.entity.Entity; +import net.wurstclient.event.CancellableEvent; +import net.wurstclient.event.Listener; + +import java.util.ArrayList; + +public interface VelocityFromEntityCollisionListener extends Listener +{ + + public void onVelocityFromEntityCollision(VelocityFromEntityCollisionEvent event); + + public static class VelocityFromEntityCollisionEvent + extends CancellableEvent + { + private final Entity entity; + + public VelocityFromEntityCollisionEvent(Entity entity) + { + this.entity = entity; + } + + public Entity getEntity() + { + return entity; + } + + @Override + public void fire(ArrayList listeners) + { + for (VelocityFromEntityCollisionListener listener : listeners) + { + listener.onVelocityFromEntityCollision(this); + + if (isCancelled()) + break; + } + } + + @Override + public Class getListenerType() + { + return VelocityFromEntityCollisionListener.class; + } + } +} diff --git a/src/main/java/net/wurstclient/hack/HackList.java b/src/main/java/net/wurstclient/hack/HackList.java index a43ce41658..dca3082a0b 100644 --- a/src/main/java/net/wurstclient/hack/HackList.java +++ b/src/main/java/net/wurstclient/hack/HackList.java @@ -34,6 +34,7 @@ public final class HackList implements UpdateListener public final AntiAfkHack antiAfkHack = new AntiAfkHack(); public final AntiBlindHack antiBlindHack = new AntiBlindHack(); public final AntiCactusHack antiCactusHack = new AntiCactusHack(); + public final AntiEntityPushHack antiEntityPushHack = new AntiEntityPushHack(); public final AntiHungerHack antiHungerHack = new AntiHungerHack(); public final AntiKnockbackHack antiKnockbackHack = new AntiKnockbackHack(); public final AntiSpamHack antiSpamHack = new AntiSpamHack(); diff --git a/src/main/java/net/wurstclient/hacks/AntiEntityPushHack.java b/src/main/java/net/wurstclient/hacks/AntiEntityPushHack.java new file mode 100644 index 0000000000..833c59665b --- /dev/null +++ b/src/main/java/net/wurstclient/hacks/AntiEntityPushHack.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.hacks; + +import net.wurstclient.Category; +import net.wurstclient.SearchTags; +import net.wurstclient.events.VelocityFromEntityCollisionListener; +import net.wurstclient.hack.Hack; + +@SearchTags({"anti entity push", "NoEntityPush", "no entity push"}) +public final class AntiEntityPushHack extends Hack implements VelocityFromEntityCollisionListener +{ + + public AntiEntityPushHack() + { + super("AntiEntityPush"); + setCategory(Category.MOVEMENT); + } + + @Override + protected void onEnable() + { + EVENTS.add(VelocityFromEntityCollisionListener.class, this); + } + + @Override + protected void onDisable() + { + EVENTS.remove(VelocityFromEntityCollisionListener.class, this); + } + + @Override + public void onVelocityFromEntityCollision(VelocityFromEntityCollisionEvent event) + { + if (event.getEntity() == MC.player) + event.cancel(); + } +} diff --git a/src/main/java/net/wurstclient/mixin/EntityMixin.java b/src/main/java/net/wurstclient/mixin/EntityMixin.java index c02a15b502..dc8c712d2c 100644 --- a/src/main/java/net/wurstclient/mixin/EntityMixin.java +++ b/src/main/java/net/wurstclient/mixin/EntityMixin.java @@ -10,6 +10,7 @@ import org.objectweb.asm.Opcodes; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; import net.minecraft.entity.Entity; @@ -18,6 +19,9 @@ import net.minecraft.util.math.Vec3d; import net.wurstclient.event.EventManager; import net.wurstclient.events.VelocityFromFluidListener.VelocityFromFluidEvent; +import net.wurstclient.events.VelocityFromEntityCollisionListener.VelocityFromEntityCollisionEvent; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(Entity.class) public abstract class EntityMixin implements Nameable, CommandOutput @@ -36,4 +40,17 @@ private void setVelocityFromFluid(Entity entity, Vec3d velocity) if(!event.isCancelled()) entity.setVelocity(velocity); } + + @Inject(at = @At("HEAD"), + method = "Lnet/minecraft/entity/Entity;pushAwayFrom(Lnet/minecraft/entity/Entity;)V", + cancellable = true) + private void onPushAwayFrom(Entity entity, CallbackInfo ci) + { + VelocityFromEntityCollisionEvent event = + new VelocityFromEntityCollisionEvent((Entity)(Object)this); + EventManager.fire(event); + + if(event.isCancelled()) + ci.cancel(); + } } diff --git a/src/main/resources/assets/wurst/lang/en_us.json b/src/main/resources/assets/wurst/lang/en_us.json index 3a7c630d5c..5cdc338a11 100644 --- a/src/main/resources/assets/wurst/lang/en_us.json +++ b/src/main/resources/assets/wurst/lang/en_us.json @@ -5,8 +5,9 @@ "description.wurst.hack.antiafk": "Walks around randomly to hide you from AFK detectors.\nNeeds at least 3x3 blocks of free space.", "description.wurst.hack.antiblind": "Prevents blindness and darkness effects.\nIncompatible with OptiFine.", "description.wurst.hack.anticactus": "Protects you from cactus damage.", + "description.wurst.hack.antientitypush": "Prevents you from getting pushed by players and mobs.", "description.wurst.hack.antihunger": "Slows down your hunger when you are walking.", - "description.wurst.hack.antiknockback": "Prevents you from getting pushed by players and mobs.", + "description.wurst.hack.antiknockback": "Prevents you from taking knockback from players and mobs.", "description.wurst.hack.antispam": "Blocks chat spam by adding a counter to repeated messages.", "description.wurst.hack.antiwaterpush": "Prevents you from getting pushed by water.", "description.wurst.hack.antiwobble": "Disables the wobble effect caused by nausea and portals.", From 38324034de8ee7a0172ba64c5fde5e8f21fbd55b Mon Sep 17 00:00:00 2001 From: IUDevman <58370012+IUDevman@users.noreply.github.com> Date: Sun, 7 May 2023 17:53:16 -0500 Subject: [PATCH 073/282] Update EntityMixin.java --- src/main/java/net/wurstclient/mixin/EntityMixin.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/net/wurstclient/mixin/EntityMixin.java b/src/main/java/net/wurstclient/mixin/EntityMixin.java index dc8c712d2c..8315220220 100644 --- a/src/main/java/net/wurstclient/mixin/EntityMixin.java +++ b/src/main/java/net/wurstclient/mixin/EntityMixin.java @@ -21,7 +21,6 @@ import net.wurstclient.events.VelocityFromFluidListener.VelocityFromFluidEvent; import net.wurstclient.events.VelocityFromEntityCollisionListener.VelocityFromEntityCollisionEvent; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(Entity.class) public abstract class EntityMixin implements Nameable, CommandOutput From ca85c8ab34f40d98c9adcecfa7de116b1e69292f Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 8 May 2023 20:47:34 +0200 Subject: [PATCH 074/282] Clean up --- .../VelocityFromEntityCollisionListener.java | 77 ++++++++++--------- .../java/net/wurstclient/hack/HackList.java | 3 +- .../wurstclient/hacks/AntiEntityPushHack.java | 53 ++++++------- .../net/wurstclient/mixin/EntityMixin.java | 10 +-- 4 files changed, 73 insertions(+), 70 deletions(-) diff --git a/src/main/java/net/wurstclient/events/VelocityFromEntityCollisionListener.java b/src/main/java/net/wurstclient/events/VelocityFromEntityCollisionListener.java index 876a8fbe28..9e08a725a7 100644 --- a/src/main/java/net/wurstclient/events/VelocityFromEntityCollisionListener.java +++ b/src/main/java/net/wurstclient/events/VelocityFromEntityCollisionListener.java @@ -7,48 +7,49 @@ */ package net.wurstclient.events; +import java.util.ArrayList; + import net.minecraft.entity.Entity; import net.wurstclient.event.CancellableEvent; import net.wurstclient.event.Listener; -import java.util.ArrayList; - public interface VelocityFromEntityCollisionListener extends Listener { - - public void onVelocityFromEntityCollision(VelocityFromEntityCollisionEvent event); - - public static class VelocityFromEntityCollisionEvent - extends CancellableEvent - { - private final Entity entity; - - public VelocityFromEntityCollisionEvent(Entity entity) - { - this.entity = entity; - } - - public Entity getEntity() - { - return entity; - } - - @Override - public void fire(ArrayList listeners) - { - for (VelocityFromEntityCollisionListener listener : listeners) - { - listener.onVelocityFromEntityCollision(this); - - if (isCancelled()) - break; - } - } - - @Override - public Class getListenerType() - { - return VelocityFromEntityCollisionListener.class; - } - } + public void onVelocityFromEntityCollision( + VelocityFromEntityCollisionEvent event); + + public static class VelocityFromEntityCollisionEvent + extends CancellableEvent + { + private final Entity entity; + + public VelocityFromEntityCollisionEvent(Entity entity) + { + this.entity = entity; + } + + public Entity getEntity() + { + return entity; + } + + @Override + public void fire( + ArrayList listeners) + { + for(VelocityFromEntityCollisionListener listener : listeners) + { + listener.onVelocityFromEntityCollision(this); + + if(isCancelled()) + break; + } + } + + @Override + public Class getListenerType() + { + return VelocityFromEntityCollisionListener.class; + } + } } diff --git a/src/main/java/net/wurstclient/hack/HackList.java b/src/main/java/net/wurstclient/hack/HackList.java index dca3082a0b..97a2c38639 100644 --- a/src/main/java/net/wurstclient/hack/HackList.java +++ b/src/main/java/net/wurstclient/hack/HackList.java @@ -34,7 +34,8 @@ public final class HackList implements UpdateListener public final AntiAfkHack antiAfkHack = new AntiAfkHack(); public final AntiBlindHack antiBlindHack = new AntiBlindHack(); public final AntiCactusHack antiCactusHack = new AntiCactusHack(); - public final AntiEntityPushHack antiEntityPushHack = new AntiEntityPushHack(); + public final AntiEntityPushHack antiEntityPushHack = + new AntiEntityPushHack(); public final AntiHungerHack antiHungerHack = new AntiHungerHack(); public final AntiKnockbackHack antiKnockbackHack = new AntiKnockbackHack(); public final AntiSpamHack antiSpamHack = new AntiSpamHack(); diff --git a/src/main/java/net/wurstclient/hacks/AntiEntityPushHack.java b/src/main/java/net/wurstclient/hacks/AntiEntityPushHack.java index 833c59665b..cb71438371 100644 --- a/src/main/java/net/wurstclient/hacks/AntiEntityPushHack.java +++ b/src/main/java/net/wurstclient/hacks/AntiEntityPushHack.java @@ -13,31 +13,32 @@ import net.wurstclient.hack.Hack; @SearchTags({"anti entity push", "NoEntityPush", "no entity push"}) -public final class AntiEntityPushHack extends Hack implements VelocityFromEntityCollisionListener +public final class AntiEntityPushHack extends Hack + implements VelocityFromEntityCollisionListener { - - public AntiEntityPushHack() - { - super("AntiEntityPush"); - setCategory(Category.MOVEMENT); - } - - @Override - protected void onEnable() - { - EVENTS.add(VelocityFromEntityCollisionListener.class, this); - } - - @Override - protected void onDisable() - { - EVENTS.remove(VelocityFromEntityCollisionListener.class, this); - } - - @Override - public void onVelocityFromEntityCollision(VelocityFromEntityCollisionEvent event) - { - if (event.getEntity() == MC.player) - event.cancel(); - } + public AntiEntityPushHack() + { + super("AntiEntityPush"); + setCategory(Category.MOVEMENT); + } + + @Override + protected void onEnable() + { + EVENTS.add(VelocityFromEntityCollisionListener.class, this); + } + + @Override + protected void onDisable() + { + EVENTS.remove(VelocityFromEntityCollisionListener.class, this); + } + + @Override + public void onVelocityFromEntityCollision( + VelocityFromEntityCollisionEvent event) + { + if(event.getEntity() == MC.player) + event.cancel(); + } } diff --git a/src/main/java/net/wurstclient/mixin/EntityMixin.java b/src/main/java/net/wurstclient/mixin/EntityMixin.java index 8315220220..a0de47701a 100644 --- a/src/main/java/net/wurstclient/mixin/EntityMixin.java +++ b/src/main/java/net/wurstclient/mixin/EntityMixin.java @@ -12,15 +12,15 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import net.minecraft.entity.Entity; import net.minecraft.server.command.CommandOutput; import net.minecraft.util.Nameable; import net.minecraft.util.math.Vec3d; import net.wurstclient.event.EventManager; -import net.wurstclient.events.VelocityFromFluidListener.VelocityFromFluidEvent; import net.wurstclient.events.VelocityFromEntityCollisionListener.VelocityFromEntityCollisionEvent; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import net.wurstclient.events.VelocityFromFluidListener.VelocityFromFluidEvent; @Mixin(Entity.class) public abstract class EntityMixin implements Nameable, CommandOutput @@ -39,16 +39,16 @@ private void setVelocityFromFluid(Entity entity, Vec3d velocity) if(!event.isCancelled()) entity.setVelocity(velocity); } - + @Inject(at = @At("HEAD"), method = "Lnet/minecraft/entity/Entity;pushAwayFrom(Lnet/minecraft/entity/Entity;)V", cancellable = true) private void onPushAwayFrom(Entity entity, CallbackInfo ci) { VelocityFromEntityCollisionEvent event = - new VelocityFromEntityCollisionEvent((Entity)(Object)this); + new VelocityFromEntityCollisionEvent((Entity)(Object)this); EventManager.fire(event); - + if(event.isCancelled()) ci.cancel(); } From aee8e75e79e7a8cdc737201b95a0fa86b37e0c9f Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 8 May 2023 20:52:22 +0200 Subject: [PATCH 075/282] ContainerScreen54 -> GenericContainerScreen --- ...nerScreen54Mixin.java => GenericContainerScreenMixin.java} | 4 ++-- src/main/resources/wurst.mixins.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename src/main/java/net/wurstclient/mixin/{ContainerScreen54Mixin.java => GenericContainerScreenMixin.java} (96%) diff --git a/src/main/java/net/wurstclient/mixin/ContainerScreen54Mixin.java b/src/main/java/net/wurstclient/mixin/GenericContainerScreenMixin.java similarity index 96% rename from src/main/java/net/wurstclient/mixin/ContainerScreen54Mixin.java rename to src/main/java/net/wurstclient/mixin/GenericContainerScreenMixin.java index 4f29aafb6c..4ef08b158c 100644 --- a/src/main/java/net/wurstclient/mixin/ContainerScreen54Mixin.java +++ b/src/main/java/net/wurstclient/mixin/GenericContainerScreenMixin.java @@ -24,7 +24,7 @@ import net.wurstclient.hacks.AutoStealHack; @Mixin(GenericContainerScreen.class) -public abstract class ContainerScreen54Mixin +public abstract class GenericContainerScreenMixin extends HandledScreen implements ScreenHandlerProvider { @@ -36,7 +36,7 @@ public abstract class ContainerScreen54Mixin WurstClient.INSTANCE.getHax().autoStealHack; private int mode; - public ContainerScreen54Mixin(WurstClient wurst, + public GenericContainerScreenMixin(WurstClient wurst, GenericContainerScreenHandler container, PlayerInventory playerInventory, Text name) { diff --git a/src/main/resources/wurst.mixins.json b/src/main/resources/wurst.mixins.json index 0bdd327da2..e8a7224bcc 100644 --- a/src/main/resources/wurst.mixins.json +++ b/src/main/resources/wurst.mixins.json @@ -23,7 +23,6 @@ "ClientPlayerEntityMixin", "ClientPlayerInteractionManagerMixin", "ClientPlayNetworkHandlerMixin", - "ContainerScreen54Mixin", "CreativeInventoryScreenMixin", "CustomPayloadC2SPacketAccessor", "DeathScreenMixin", @@ -36,6 +35,7 @@ "FluidRendererMixin", "GameMenuScreenMixin", "GameRendererMixin", + "GenericContainerScreenMixin", "IngameHudMixin", "InGameOverlayRendererMixin", "KeyBindingMixin", From b29c38bc26ce83e413a315a09f189a0e1849e8d0 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 10 May 2023 12:27:36 +0200 Subject: [PATCH 076/282] Revert FeedAura change --- .../java/net/wurstclient/hacks/FeedAuraHack.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/FeedAuraHack.java b/src/main/java/net/wurstclient/hacks/FeedAuraHack.java index 9bdc80b9b7..74173699d0 100644 --- a/src/main/java/net/wurstclient/hacks/FeedAuraHack.java +++ b/src/main/java/net/wurstclient/hacks/FeedAuraHack.java @@ -20,6 +20,7 @@ import net.minecraft.client.network.ClientPlayerInteractionManager; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.entity.LivingEntity; import net.minecraft.entity.passive.AbstractHorseEntity; import net.minecraft.entity.passive.AnimalEntity; import net.minecraft.entity.passive.TameableEntity; @@ -198,6 +199,11 @@ public void onRender(MatrixStack matrixStack, float partialTicks) int regionZ = (camPos.getZ() >> 9) * 512; Box box = new Box(BlockPos.ORIGIN); + float p = 1; + LivingEntity le = renderTarget; + p = (le.getMaxHealth() - le.getHealth()) / le.getMaxHealth(); + float green = p * 2F; + float red = 2 - green; matrixStack.translate( MathHelper.lerp(partialTicks, renderTarget.prevX, @@ -212,12 +218,16 @@ public void onRender(MatrixStack matrixStack, float partialTicks) renderTarget.getWidth()); matrixStack.translate(-0.5, 0, -0.5); + matrixStack.translate(0.5, 0.5, 0.5); + matrixStack.scale(p, p, p); + matrixStack.translate(-0.5, -0.5, -0.5); + RenderSystem.setShader(GameRenderer::getPositionProgram); - RenderSystem.setShaderColor(1, 0, 0, 0.25F); + RenderSystem.setShaderColor(red, green, 0, 0.25F); RenderUtils.drawSolidBox(box, matrixStack); - RenderSystem.setShaderColor(1, 0, 0, 0.5F); + RenderSystem.setShaderColor(red, green, 0, 0.5F); RenderUtils.drawOutlinedBox(box, matrixStack); matrixStack.pop(); From f8a6274db34220be1197e47a2d9f8ddaab4cd5bc Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 10 May 2023 12:27:47 +0200 Subject: [PATCH 077/282] Revert RenderUtils --- src/main/java/net/wurstclient/util/RenderUtils.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/net/wurstclient/util/RenderUtils.java b/src/main/java/net/wurstclient/util/RenderUtils.java index 6f8a00d25a..06674d9715 100644 --- a/src/main/java/net/wurstclient/util/RenderUtils.java +++ b/src/main/java/net/wurstclient/util/RenderUtils.java @@ -53,6 +53,14 @@ public static void scissorBox(int startX, int startY, int endX, int endY) GL11.glScissor(scissorX, scissorY, scissorWidth, scissorHeight); } + public static void applyRenderOffset(MatrixStack matrixStack) + { + applyCameraRotationOnly(); + Vec3d camPos = getCameraPos(); + + matrixStack.translate(-camPos.x, -camPos.y, -camPos.z); + } + public static void applyRegionalRenderOffset(MatrixStack matrixStack) { applyCameraRotationOnly(); From 861a16218faae235d0e8109ae5315ea087a1d81f Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 10 May 2023 12:35:24 +0200 Subject: [PATCH 078/282] Clean up --- .../java/net/wurstclient/ai/PathRenderer.java | 3 ++- .../net/wurstclient/hacks/BowAimbotHack.java | 4 ++-- .../net/wurstclient/hacks/ExcavatorHack.java | 20 +++++++++---------- .../net/wurstclient/hacks/FreecamHack.java | 9 +++++---- .../wurstclient/hacks/InstantBunkerHack.java | 5 +++-- .../net/wurstclient/hacks/ItemEspHack.java | 13 +++++++----- .../wurstclient/hacks/PlayerFinderHack.java | 5 +++-- 7 files changed, 33 insertions(+), 26 deletions(-) diff --git a/src/main/java/net/wurstclient/ai/PathRenderer.java b/src/main/java/net/wurstclient/ai/PathRenderer.java index a0414b874f..909abae070 100644 --- a/src/main/java/net/wurstclient/ai/PathRenderer.java +++ b/src/main/java/net/wurstclient/ai/PathRenderer.java @@ -98,7 +98,8 @@ public static void renderArrow(MatrixStack matrixStack, BlockPos start, tessellator.draw(); } - public static void renderNode(MatrixStack matrixStack, BlockPos pos, int regionX, int regionZ) + public static void renderNode(MatrixStack matrixStack, BlockPos pos, + int regionX, int regionZ) { matrixStack.push(); diff --git a/src/main/java/net/wurstclient/hacks/BowAimbotHack.java b/src/main/java/net/wurstclient/hacks/BowAimbotHack.java index 06581ccf3a..7e014ad332 100644 --- a/src/main/java/net/wurstclient/hacks/BowAimbotHack.java +++ b/src/main/java/net/wurstclient/hacks/BowAimbotHack.java @@ -217,8 +217,8 @@ public void onRender(MatrixStack matrixStack, float partialTicks) int regionZ = (camPos.getZ() >> 9) * 512; // set position - matrixStack.translate(target.getX() - regionX, - target.getY(), target.getZ() - regionZ); + matrixStack.translate(target.getX() - regionX, target.getY(), + target.getZ() - regionZ); // set size float boxWidth = target.getWidth() + 0.1F; diff --git a/src/main/java/net/wurstclient/hacks/ExcavatorHack.java b/src/main/java/net/wurstclient/hacks/ExcavatorHack.java index 1a4752e8e3..e5367c4f63 100644 --- a/src/main/java/net/wurstclient/hacks/ExcavatorHack.java +++ b/src/main/java/net/wurstclient/hacks/ExcavatorHack.java @@ -181,8 +181,8 @@ public void onRender(MatrixStack matrixStack, float partialTicks) BlockPos pos = area.blocksList.get(i); matrixStack.push(); - matrixStack.translate(pos.getX() - regionX, - pos.getY(), pos.getZ() - regionZ); + matrixStack.translate(pos.getX() - regionX, pos.getY(), + pos.getZ() - regionZ); matrixStack.translate(-0.005, -0.005, -0.005); matrixStack.scale(1.01F, 1.01F, 1.01F); @@ -196,8 +196,8 @@ public void onRender(MatrixStack matrixStack, float partialTicks) } matrixStack.push(); - matrixStack.translate(area.minX + offset - regionX, area.minY + offset, - area.minZ + offset - regionZ); + matrixStack.translate(area.minX + offset - regionX, + area.minY + offset, area.minZ + offset - regionZ); matrixStack.scale(area.sizeX + scale, area.sizeY + scale, area.sizeZ + scale); @@ -256,8 +256,8 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // area box matrixStack.push(); - matrixStack.translate(preview.minX + offset - regionX, preview.minY + offset, - preview.minZ + offset - regionZ); + matrixStack.translate(preview.minX + offset - regionX, + preview.minY + offset, preview.minZ + offset - regionZ); matrixStack.scale(preview.sizeX + scale, preview.sizeY + scale, preview.sizeZ + scale); RenderSystem.setShaderColor(0F, 0F, 0F, 0.5F); @@ -271,8 +271,8 @@ public void onRender(MatrixStack matrixStack, float partialTicks) if(posLookingAt != null) { matrixStack.push(); - matrixStack.translate(posLookingAt.getX() - regionX, posLookingAt.getY(), - posLookingAt.getZ() - regionZ); + matrixStack.translate(posLookingAt.getX() - regionX, + posLookingAt.getY(), posLookingAt.getZ() - regionZ); matrixStack.translate(offset, offset, offset); matrixStack.scale(scale, scale, scale); @@ -290,8 +290,8 @@ public void onRender(MatrixStack matrixStack, float partialTicks) if(currentBlock != null) { // set position - matrixStack.translate(currentBlock.getX() - regionX, currentBlock.getY(), - currentBlock.getZ() - regionZ); + matrixStack.translate(currentBlock.getX() - regionX, + currentBlock.getY(), currentBlock.getZ() - regionZ); // get progress float progress; diff --git a/src/main/java/net/wurstclient/hacks/FreecamHack.java b/src/main/java/net/wurstclient/hacks/FreecamHack.java index a9220a1ebd..a8f2271c72 100644 --- a/src/main/java/net/wurstclient/hacks/FreecamHack.java +++ b/src/main/java/net/wurstclient/hacks/FreecamHack.java @@ -208,10 +208,10 @@ public void onRender(MatrixStack matrixStack, float partialTicks) matrixStack.pop(); // line - Vec3d start = RotationUtils.getClientLookVec(). - add(RenderUtils.getCameraPos()).subtract(regionX, 0, regionZ); - Vec3d end = fakePlayer.getBoundingBox().getCenter() - .subtract(regionX, 0, regionZ); + Vec3d start = RotationUtils.getClientLookVec() + .add(RenderUtils.getCameraPos()).subtract(regionX, 0, regionZ); + Vec3d end = fakePlayer.getBoundingBox().getCenter().subtract(regionX, 0, + regionZ); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); @@ -230,6 +230,7 @@ public void onRender(MatrixStack matrixStack, float partialTicks) matrixStack.pop(); // GL resets + RenderSystem.setShaderColor(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LINE_SMOOTH); diff --git a/src/main/java/net/wurstclient/hacks/InstantBunkerHack.java b/src/main/java/net/wurstclient/hacks/InstantBunkerHack.java index 1cd38109eb..8feb68f622 100644 --- a/src/main/java/net/wurstclient/hacks/InstantBunkerHack.java +++ b/src/main/java/net/wurstclient/hacks/InstantBunkerHack.java @@ -291,8 +291,8 @@ public void onRender(MatrixStack matrixStack, float partialTicks) BlockPos pos = positions.get(i); matrixStack.push(); - matrixStack.translate(pos.getX() - regionX, - pos.getY(), pos.getZ() - regionZ); + matrixStack.translate(pos.getX() - regionX, pos.getY(), + pos.getZ() - regionZ); matrixStack.translate(offset, offset, offset); matrixStack.scale(scale, scale, scale); @@ -304,6 +304,7 @@ public void onRender(MatrixStack matrixStack, float partialTicks) matrixStack.pop(); // GL resets + RenderSystem.setShaderColor(1, 1, 1, 1); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LINE_SMOOTH); } diff --git a/src/main/java/net/wurstclient/hacks/ItemEspHack.java b/src/main/java/net/wurstclient/hacks/ItemEspHack.java index 0242d375e4..986816b677 100644 --- a/src/main/java/net/wurstclient/hacks/ItemEspHack.java +++ b/src/main/java/net/wurstclient/hacks/ItemEspHack.java @@ -183,12 +183,15 @@ private void renderTracers(MatrixStack matrixStack, double 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(regionX, 0, regionZ); + .multiply(1 - partialTicks)) + .subtract(regionX, 0, regionZ); - bufferBuilder.vertex(matrix, (float)start.x, (float)start.y, - (float)start.z).next(); - bufferBuilder.vertex(matrix, (float)end.x, (float)end.y, - (float)end.z).next(); + bufferBuilder + .vertex(matrix, (float)start.x, (float)start.y, (float)start.z) + .next(); + bufferBuilder + .vertex(matrix, (float)end.x, (float)end.y, (float)end.z) + .next(); } tessellator.draw(); } diff --git a/src/main/java/net/wurstclient/hacks/PlayerFinderHack.java b/src/main/java/net/wurstclient/hacks/PlayerFinderHack.java index 55848362dc..d088b0c27e 100644 --- a/src/main/java/net/wurstclient/hacks/PlayerFinderHack.java +++ b/src/main/java/net/wurstclient/hacks/PlayerFinderHack.java @@ -108,8 +108,8 @@ public void onRender(MatrixStack matrixStack, float partialTicks) VertexFormats.POSITION); // set start position - Vec3d start = RotationUtils.getClientLookVec(). - add(RenderUtils.getCameraPos()).subtract(regionX, 0, regionZ); + Vec3d start = RotationUtils.getClientLookVec() + .add(RenderUtils.getCameraPos()).subtract(regionX, 0, regionZ); // set end position Vec3d end = Vec3d.ofCenter(pos).subtract(regionX, 0, regionZ); @@ -141,6 +141,7 @@ public void onRender(MatrixStack matrixStack, float partialTicks) matrixStack.pop(); // GL resets + RenderSystem.setShaderColor(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LINE_SMOOTH); From 42e130a9f67adb2630deb4dcbd469347b42b60ab Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 10 May 2023 14:03:46 +0200 Subject: [PATCH 079/282] Add region offset method with X & Z params --- src/main/java/net/wurstclient/ai/PathFinder.java | 3 ++- src/main/java/net/wurstclient/hacks/AutoBuildHack.java | 2 +- src/main/java/net/wurstclient/hacks/AutoFarmHack.java | 2 +- .../java/net/wurstclient/hacks/AutoLibrarianHack.java | 2 +- src/main/java/net/wurstclient/hacks/BowAimbotHack.java | 2 +- .../java/net/wurstclient/hacks/BuildRandomHack.java | 2 +- src/main/java/net/wurstclient/hacks/ExcavatorHack.java | 2 +- src/main/java/net/wurstclient/hacks/FeedAuraHack.java | 2 +- src/main/java/net/wurstclient/hacks/FreecamHack.java | 2 +- .../java/net/wurstclient/hacks/InstantBunkerHack.java | 2 +- src/main/java/net/wurstclient/hacks/ItemEspHack.java | 2 +- src/main/java/net/wurstclient/hacks/KillauraHack.java | 2 +- .../java/net/wurstclient/hacks/KillauraLegitHack.java | 2 +- src/main/java/net/wurstclient/hacks/MobEspHack.java | 2 +- src/main/java/net/wurstclient/hacks/NukerHack.java | 2 +- .../java/net/wurstclient/hacks/NukerLegitHack.java | 2 +- src/main/java/net/wurstclient/hacks/OverlayHack.java | 2 +- src/main/java/net/wurstclient/hacks/PlayerEspHack.java | 2 +- .../java/net/wurstclient/hacks/PlayerFinderHack.java | 2 +- .../java/net/wurstclient/hacks/ProphuntEspHack.java | 2 +- src/main/java/net/wurstclient/hacks/TreeBotHack.java | 3 +-- src/main/java/net/wurstclient/hacks/TunnellerHack.java | 10 +++++----- .../wurstclient/hacks/autofish/AutoFishDebugDraw.java | 5 ++--- src/main/java/net/wurstclient/util/RenderUtils.java | 10 ++++++++++ 24 files changed, 39 insertions(+), 30 deletions(-) diff --git a/src/main/java/net/wurstclient/ai/PathFinder.java b/src/main/java/net/wurstclient/ai/PathFinder.java index d88963bb04..f39dbbef2c 100644 --- a/src/main/java/net/wurstclient/ai/PathFinder.java +++ b/src/main/java/net/wurstclient/ai/PathFinder.java @@ -563,11 +563,12 @@ public void renderPath(MatrixStack matrixStack, boolean debugMode, GL11.glDepthMask(false); matrixStack.push(); - RenderUtils.applyRegionalRenderOffset(matrixStack); BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; int regionZ = (camPos.getZ() >> 9) * 512; + RenderUtils.applyRegionalRenderOffset(matrixStack, regionX, regionZ); + matrixStack.translate(0.5, 0.5, 0.5); if(debugMode) diff --git a/src/main/java/net/wurstclient/hacks/AutoBuildHack.java b/src/main/java/net/wurstclient/hacks/AutoBuildHack.java index 8b9d0dcb99..6f8d11ad05 100644 --- a/src/main/java/net/wurstclient/hacks/AutoBuildHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoBuildHack.java @@ -362,11 +362,11 @@ public void onRender(MatrixStack matrixStack, float partialTicks) RenderSystem.setShaderColor(0F, 0F, 0F, 0.5F); matrixStack.push(); - RenderUtils.applyRegionalRenderOffset(matrixStack); BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; int regionZ = (camPos.getZ() >> 9) * 512; + RenderUtils.applyRegionalRenderOffset(matrixStack, regionX, regionZ); int blocksDrawn = 0; RenderSystem.setShader(GameRenderer::getPositionProgram); diff --git a/src/main/java/net/wurstclient/hacks/AutoFarmHack.java b/src/main/java/net/wurstclient/hacks/AutoFarmHack.java index 5b8dc055fe..5ab5ac8ef2 100644 --- a/src/main/java/net/wurstclient/hacks/AutoFarmHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoFarmHack.java @@ -198,11 +198,11 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glDisable(GL11.GL_DEPTH_TEST); matrixStack.push(); - RenderUtils.applyRegionalRenderOffset(matrixStack); BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; int regionZ = (camPos.getZ() >> 9) * 512; + RenderUtils.applyRegionalRenderOffset(matrixStack, regionX, regionZ); RenderSystem.setShader(GameRenderer::getPositionProgram); Matrix4f viewMatrix = matrixStack.peek().getPositionMatrix(); diff --git a/src/main/java/net/wurstclient/hacks/AutoLibrarianHack.java b/src/main/java/net/wurstclient/hacks/AutoLibrarianHack.java index bef0519a84..3b9dd0d4f6 100644 --- a/src/main/java/net/wurstclient/hacks/AutoLibrarianHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoLibrarianHack.java @@ -525,11 +525,11 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glDisable(GL11.GL_DEPTH_TEST); matrixStack.push(); - RenderUtils.applyRegionalRenderOffset(matrixStack); BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; int regionZ = (camPos.getZ() >> 9) * 512; + RenderUtils.applyRegionalRenderOffset(matrixStack, regionX, regionZ); RenderSystem.setShaderColor(0, 1, 0, 0.75F); diff --git a/src/main/java/net/wurstclient/hacks/BowAimbotHack.java b/src/main/java/net/wurstclient/hacks/BowAimbotHack.java index 7e014ad332..f8f3e3ef63 100644 --- a/src/main/java/net/wurstclient/hacks/BowAimbotHack.java +++ b/src/main/java/net/wurstclient/hacks/BowAimbotHack.java @@ -210,11 +210,11 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glDisable(GL11.GL_DEPTH_TEST); matrixStack.push(); - RenderUtils.applyRegionalRenderOffset(matrixStack); BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; int regionZ = (camPos.getZ() >> 9) * 512; + RenderUtils.applyRegionalRenderOffset(matrixStack, regionX, regionZ); // set position matrixStack.translate(target.getX() - regionX, target.getY(), diff --git a/src/main/java/net/wurstclient/hacks/BuildRandomHack.java b/src/main/java/net/wurstclient/hacks/BuildRandomHack.java index 18c371e1df..8ab78e7604 100644 --- a/src/main/java/net/wurstclient/hacks/BuildRandomHack.java +++ b/src/main/java/net/wurstclient/hacks/BuildRandomHack.java @@ -140,11 +140,11 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glDisable(GL11.GL_DEPTH_TEST); matrixStack.push(); - RenderUtils.applyRegionalRenderOffset(matrixStack); BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; int regionZ = (camPos.getZ() >> 9) * 512; + RenderUtils.applyRegionalRenderOffset(matrixStack, regionX, regionZ); // set position matrixStack.translate(lastPos.getX() - regionX, lastPos.getY(), diff --git a/src/main/java/net/wurstclient/hacks/ExcavatorHack.java b/src/main/java/net/wurstclient/hacks/ExcavatorHack.java index e5367c4f63..de21456bcc 100644 --- a/src/main/java/net/wurstclient/hacks/ExcavatorHack.java +++ b/src/main/java/net/wurstclient/hacks/ExcavatorHack.java @@ -160,11 +160,11 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glDisable(GL11.GL_DEPTH_TEST); matrixStack.push(); - RenderUtils.applyRegionalRenderOffset(matrixStack); BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; int regionZ = (camPos.getZ() >> 9) * 512; + RenderUtils.applyRegionalRenderOffset(matrixStack, regionX, regionZ); RenderSystem.setShader(GameRenderer::getPositionProgram); diff --git a/src/main/java/net/wurstclient/hacks/FeedAuraHack.java b/src/main/java/net/wurstclient/hacks/FeedAuraHack.java index 74173699d0..66d40727fa 100644 --- a/src/main/java/net/wurstclient/hacks/FeedAuraHack.java +++ b/src/main/java/net/wurstclient/hacks/FeedAuraHack.java @@ -192,11 +192,11 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glDisable(GL11.GL_DEPTH_TEST); matrixStack.push(); - RenderUtils.applyRegionalRenderOffset(matrixStack); BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; int regionZ = (camPos.getZ() >> 9) * 512; + RenderUtils.applyRegionalRenderOffset(matrixStack, regionX, regionZ); Box box = new Box(BlockPos.ORIGIN); float p = 1; diff --git a/src/main/java/net/wurstclient/hacks/FreecamHack.java b/src/main/java/net/wurstclient/hacks/FreecamHack.java index a8f2271c72..469c110f92 100644 --- a/src/main/java/net/wurstclient/hacks/FreecamHack.java +++ b/src/main/java/net/wurstclient/hacks/FreecamHack.java @@ -188,11 +188,11 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glDisable(GL11.GL_DEPTH_TEST); matrixStack.push(); - RenderUtils.applyRegionalRenderOffset(matrixStack); BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; int regionZ = (camPos.getZ() >> 9) * 512; + RenderUtils.applyRegionalRenderOffset(matrixStack, regionX, regionZ); float[] colorF = color.getColorF(); RenderSystem.setShaderColor(colorF[0], colorF[1], colorF[2], 0.5F); diff --git a/src/main/java/net/wurstclient/hacks/InstantBunkerHack.java b/src/main/java/net/wurstclient/hacks/InstantBunkerHack.java index 8feb68f622..346eb176e5 100644 --- a/src/main/java/net/wurstclient/hacks/InstantBunkerHack.java +++ b/src/main/java/net/wurstclient/hacks/InstantBunkerHack.java @@ -260,11 +260,11 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glDisable(GL11.GL_CULL_FACE); matrixStack.push(); - RenderUtils.applyRegionalRenderOffset(matrixStack); BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; int regionZ = (camPos.getZ() >> 9) * 512; + RenderUtils.applyRegionalRenderOffset(matrixStack, regionX, regionZ); // green box { diff --git a/src/main/java/net/wurstclient/hacks/ItemEspHack.java b/src/main/java/net/wurstclient/hacks/ItemEspHack.java index 986816b677..08ee430094 100644 --- a/src/main/java/net/wurstclient/hacks/ItemEspHack.java +++ b/src/main/java/net/wurstclient/hacks/ItemEspHack.java @@ -105,11 +105,11 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glEnable(GL11.GL_LINE_SMOOTH); matrixStack.push(); - RenderUtils.applyRegionalRenderOffset(matrixStack); BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; int regionZ = (camPos.getZ() >> 9) * 512; + RenderUtils.applyRegionalRenderOffset(matrixStack, regionX, regionZ); renderBoxes(matrixStack, partialTicks, regionX, regionZ); diff --git a/src/main/java/net/wurstclient/hacks/KillauraHack.java b/src/main/java/net/wurstclient/hacks/KillauraHack.java index f0b0b94de4..cc675f7352 100644 --- a/src/main/java/net/wurstclient/hacks/KillauraHack.java +++ b/src/main/java/net/wurstclient/hacks/KillauraHack.java @@ -204,11 +204,11 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glDisable(GL11.GL_DEPTH_TEST); matrixStack.push(); - RenderUtils.applyRegionalRenderOffset(matrixStack); BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; int regionZ = (camPos.getZ() >> 9) * 512; + RenderUtils.applyRegionalRenderOffset(matrixStack, regionX, regionZ); Box box = new Box(BlockPos.ORIGIN); float p = 1; diff --git a/src/main/java/net/wurstclient/hacks/KillauraLegitHack.java b/src/main/java/net/wurstclient/hacks/KillauraLegitHack.java index e55119990a..0b34f1439d 100644 --- a/src/main/java/net/wurstclient/hacks/KillauraLegitHack.java +++ b/src/main/java/net/wurstclient/hacks/KillauraLegitHack.java @@ -219,11 +219,11 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glDisable(GL11.GL_DEPTH_TEST); matrixStack.push(); - RenderUtils.applyRegionalRenderOffset(matrixStack); BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; int regionZ = (camPos.getZ() >> 9) * 512; + RenderUtils.applyRegionalRenderOffset(matrixStack, regionX, regionZ); Box box = new Box(BlockPos.ORIGIN); float p = 1; diff --git a/src/main/java/net/wurstclient/hacks/MobEspHack.java b/src/main/java/net/wurstclient/hacks/MobEspHack.java index 1a1f628b6c..6ec69801b1 100644 --- a/src/main/java/net/wurstclient/hacks/MobEspHack.java +++ b/src/main/java/net/wurstclient/hacks/MobEspHack.java @@ -125,11 +125,11 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glDisable(GL11.GL_DEPTH_TEST); matrixStack.push(); - RenderUtils.applyRegionalRenderOffset(matrixStack); BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; int regionZ = (camPos.getZ() >> 9) * 512; + RenderUtils.applyRegionalRenderOffset(matrixStack, regionX, regionZ); if(style.getSelected().boxes) renderBoxes(matrixStack, partialTicks, regionX, regionZ); diff --git a/src/main/java/net/wurstclient/hacks/NukerHack.java b/src/main/java/net/wurstclient/hacks/NukerHack.java index be32300301..f8caac2ce1 100644 --- a/src/main/java/net/wurstclient/hacks/NukerHack.java +++ b/src/main/java/net/wurstclient/hacks/NukerHack.java @@ -249,11 +249,11 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glDisable(GL11.GL_DEPTH_TEST); matrixStack.push(); - RenderUtils.applyRegionalRenderOffset(matrixStack); BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; int regionZ = (camPos.getZ() >> 9) * 512; + RenderUtils.applyRegionalRenderOffset(matrixStack, regionX, regionZ); Box box = new Box(BlockPos.ORIGIN); float p = prevProgress + (progress - prevProgress) * partialTicks; diff --git a/src/main/java/net/wurstclient/hacks/NukerLegitHack.java b/src/main/java/net/wurstclient/hacks/NukerLegitHack.java index 85a1e0a52f..bf50b7f945 100644 --- a/src/main/java/net/wurstclient/hacks/NukerLegitHack.java +++ b/src/main/java/net/wurstclient/hacks/NukerLegitHack.java @@ -290,11 +290,11 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glDisable(GL11.GL_DEPTH_TEST); matrixStack.push(); - RenderUtils.applyRegionalRenderOffset(matrixStack); BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; int regionZ = (camPos.getZ() >> 9) * 512; + RenderUtils.applyRegionalRenderOffset(matrixStack, regionX, regionZ); // set position matrixStack.translate(currentBlock.getX() - regionX, diff --git a/src/main/java/net/wurstclient/hacks/OverlayHack.java b/src/main/java/net/wurstclient/hacks/OverlayHack.java index 7675841d9e..496cebcb65 100644 --- a/src/main/java/net/wurstclient/hacks/OverlayHack.java +++ b/src/main/java/net/wurstclient/hacks/OverlayHack.java @@ -63,11 +63,11 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glDisable(GL11.GL_DEPTH_TEST); matrixStack.push(); - RenderUtils.applyRegionalRenderOffset(matrixStack); BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; int regionZ = (camPos.getZ() >> 9) * 512; + RenderUtils.applyRegionalRenderOffset(matrixStack, regionX, regionZ); // set position matrixStack.translate(pos.getX() - regionX, pos.getY(), diff --git a/src/main/java/net/wurstclient/hacks/PlayerEspHack.java b/src/main/java/net/wurstclient/hacks/PlayerEspHack.java index 29b2f4e36a..9e1671060b 100644 --- a/src/main/java/net/wurstclient/hacks/PlayerEspHack.java +++ b/src/main/java/net/wurstclient/hacks/PlayerEspHack.java @@ -123,11 +123,11 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glDisable(GL11.GL_DEPTH_TEST); matrixStack.push(); - RenderUtils.applyRegionalRenderOffset(matrixStack); BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; int regionZ = (camPos.getZ() >> 9) * 512; + RenderUtils.applyRegionalRenderOffset(matrixStack, regionX, regionZ); // draw boxes if(style.getSelected().boxes) diff --git a/src/main/java/net/wurstclient/hacks/PlayerFinderHack.java b/src/main/java/net/wurstclient/hacks/PlayerFinderHack.java index d088b0c27e..ed9a696d7d 100644 --- a/src/main/java/net/wurstclient/hacks/PlayerFinderHack.java +++ b/src/main/java/net/wurstclient/hacks/PlayerFinderHack.java @@ -89,11 +89,11 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glDisable(GL11.GL_DEPTH_TEST); matrixStack.push(); - RenderUtils.applyRegionalRenderOffset(matrixStack); BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; int regionZ = (camPos.getZ() >> 9) * 512; + RenderUtils.applyRegionalRenderOffset(matrixStack, regionX, regionZ); float[] rainbow = RenderUtils.getRainbowColor(); RenderSystem.setShaderColor(rainbow[0], rainbow[1], rainbow[2], 0.5F); diff --git a/src/main/java/net/wurstclient/hacks/ProphuntEspHack.java b/src/main/java/net/wurstclient/hacks/ProphuntEspHack.java index 9ab37befd7..9e0b5f5c56 100644 --- a/src/main/java/net/wurstclient/hacks/ProphuntEspHack.java +++ b/src/main/java/net/wurstclient/hacks/ProphuntEspHack.java @@ -58,11 +58,11 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glDisable(GL11.GL_DEPTH_TEST); matrixStack.push(); - RenderUtils.applyRegionalRenderOffset(matrixStack); BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; int regionZ = (camPos.getZ() >> 9) * 512; + RenderUtils.applyRegionalRenderOffset(matrixStack, regionX, regionZ); // set color float alpha = 0.5F + 0.25F * MathHelper diff --git a/src/main/java/net/wurstclient/hacks/TreeBotHack.java b/src/main/java/net/wurstclient/hacks/TreeBotHack.java index 5810e5c006..db70d9643f 100644 --- a/src/main/java/net/wurstclient/hacks/TreeBotHack.java +++ b/src/main/java/net/wurstclient/hacks/TreeBotHack.java @@ -334,11 +334,10 @@ private void drawCurrentBlock(MatrixStack matrixStack, float partialTicks) { matrixStack.push(); - RenderUtils.applyRegionalRenderOffset(matrixStack); - BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; int regionZ = (camPos.getZ() >> 9) * 512; + RenderUtils.applyRegionalRenderOffset(matrixStack, regionX, regionZ); Box box = new Box(BlockPos.ORIGIN); float p = prevProgress + (progress - prevProgress) * partialTicks; diff --git a/src/main/java/net/wurstclient/hacks/TunnellerHack.java b/src/main/java/net/wurstclient/hacks/TunnellerHack.java index e87c57a654..146a6996ec 100644 --- a/src/main/java/net/wurstclient/hacks/TunnellerHack.java +++ b/src/main/java/net/wurstclient/hacks/TunnellerHack.java @@ -207,7 +207,11 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glDisable(GL11.GL_DEPTH_TEST); matrixStack.push(); - RenderUtils.applyRegionalRenderOffset(matrixStack); + + BlockPos camPos = RenderUtils.getCameraBlockPos(); + int regionX = (camPos.getX() >> 9) * 512; + int regionZ = (camPos.getZ() >> 9) * 512; + RenderUtils.applyRegionalRenderOffset(matrixStack, regionX, regionZ); RenderSystem.setShader(GameRenderer::getPositionProgram); @@ -240,10 +244,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) float red = p * 2F; float green = 2 - red; - BlockPos camPos = RenderUtils.getCameraBlockPos(); - int regionX = (camPos.getX() >> 9) * 512; - int regionZ = (camPos.getZ() >> 9) * 512; - matrixStack.translate(currentBlock.getX() - regionX, currentBlock.getY(), currentBlock.getZ() - regionZ); if(p < 1) diff --git a/src/main/java/net/wurstclient/hacks/autofish/AutoFishDebugDraw.java b/src/main/java/net/wurstclient/hacks/autofish/AutoFishDebugDraw.java index f52fa3d461..7d843536ab 100644 --- a/src/main/java/net/wurstclient/hacks/autofish/AutoFishDebugDraw.java +++ b/src/main/java/net/wurstclient/hacks/autofish/AutoFishDebugDraw.java @@ -79,14 +79,13 @@ public void render(MatrixStack matrixStack, float partialTicks) GL11.glDisable(GL11.GL_DEPTH_TEST); matrixStack.push(); - RenderUtils.applyRegionalRenderOffset(matrixStack); - - FishingBobberEntity bobber = WurstClient.MC.player.fishHook; BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; int regionZ = (camPos.getZ() >> 9) * 512; + RenderUtils.applyRegionalRenderOffset(matrixStack, regionX, regionZ); + FishingBobberEntity bobber = WurstClient.MC.player.fishHook; if(bobber != null && validRangeBox != null) drawValidRange(matrixStack, bobber, regionX, regionZ); diff --git a/src/main/java/net/wurstclient/util/RenderUtils.java b/src/main/java/net/wurstclient/util/RenderUtils.java index 06674d9715..5f6830a7b5 100644 --- a/src/main/java/net/wurstclient/util/RenderUtils.java +++ b/src/main/java/net/wurstclient/util/RenderUtils.java @@ -75,6 +75,16 @@ public static void applyRegionalRenderOffset(MatrixStack matrixStack) regionZ - camPos.z); } + public static void applyRegionalRenderOffset(MatrixStack matrixStack, + int regionX, int regionZ) + { + applyCameraRotationOnly(); + + Vec3d camPos = getCameraPos(); + matrixStack.translate(regionX - camPos.x, -camPos.y, + regionZ - camPos.z); + } + public static void applyRegionalRenderOffset(MatrixStack matrixStack, Chunk chunk) { From 28a7156b39152971ce4b820c1f63c6306460b25c Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 10 May 2023 14:23:37 +0200 Subject: [PATCH 080/282] Remove PlayerFinder It no longer works in modern Minecraft versions and there doesn't seem to be a new way of detecting lightning bolts at a distance. --- .../java/net/wurstclient/hack/HackList.java | 1 - .../wurstclient/hacks/PlayerFinderHack.java | 179 ------------------ 2 files changed, 180 deletions(-) delete mode 100644 src/main/java/net/wurstclient/hacks/PlayerFinderHack.java diff --git a/src/main/java/net/wurstclient/hack/HackList.java b/src/main/java/net/wurstclient/hack/HackList.java index 97a2c38639..e55ca896dc 100644 --- a/src/main/java/net/wurstclient/hack/HackList.java +++ b/src/main/java/net/wurstclient/hack/HackList.java @@ -147,7 +147,6 @@ public final class HackList implements UpdateListener public final PanicHack panicHack = new PanicHack(); public final ParkourHack parkourHack = new ParkourHack(); public final PlayerEspHack playerEspHack = new PlayerEspHack(); - public final PlayerFinderHack playerFinderHack = new PlayerFinderHack(); public final PortalGuiHack portalGuiHack = new PortalGuiHack(); public final PotionSaverHack potionSaverHack = new PotionSaverHack(); public final ProphuntEspHack prophuntEspHack = new ProphuntEspHack(); diff --git a/src/main/java/net/wurstclient/hacks/PlayerFinderHack.java b/src/main/java/net/wurstclient/hacks/PlayerFinderHack.java deleted file mode 100644 index ed9a696d7d..0000000000 --- a/src/main/java/net/wurstclient/hacks/PlayerFinderHack.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (c) 2014-2023 Wurst-Imperium and contributors. - * - * This source code is subject to the terms of the GNU General Public - * License, version 3. If a copy of the GPL was not distributed with this - * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt - */ -package net.wurstclient.hacks; - -import org.joml.Matrix4f; -import org.lwjgl.opengl.GL11; - -import com.mojang.blaze3d.systems.RenderSystem; - -import net.minecraft.client.render.BufferBuilder; -import net.minecraft.client.render.GameRenderer; -import net.minecraft.client.render.Tessellator; -import net.minecraft.client.render.VertexFormat; -import net.minecraft.client.render.VertexFormats; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.s2c.play.PlaySoundS2CPacket; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.wurstclient.Category; -import net.wurstclient.SearchTags; -import net.wurstclient.events.PacketInputListener; -import net.wurstclient.events.RenderListener; -import net.wurstclient.events.UpdateListener; -import net.wurstclient.hack.Hack; -import net.wurstclient.util.ChatUtils; -import net.wurstclient.util.RenderUtils; -import net.wurstclient.util.RotationUtils; - -@SearchTags({"player finder"}) -public final class PlayerFinderHack extends Hack - implements UpdateListener, PacketInputListener, RenderListener -{ - private BlockPos pos; - private BlockPos lastPos; - - public PlayerFinderHack() - { - super("PlayerFinder"); - setCategory(Category.RENDER); - } - - @Override - public void onEnable() - { - pos = null; - lastPos = null; - - EVENTS.add(UpdateListener.class, this); - EVENTS.add(PacketInputListener.class, this); - EVENTS.add(RenderListener.class, this); - } - - @Override - public void onDisable() - { - EVENTS.remove(UpdateListener.class, this); - EVENTS.remove(PacketInputListener.class, this); - EVENTS.remove(RenderListener.class, this); - } - - @Override - public void onUpdate() - { - if(pos == null || pos.equals(lastPos)) - return; - - ChatUtils.message("PlayerFinder has detected a player near " - + pos.toShortString() + "."); - lastPos = pos; - } - - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) - { - if(pos == null) - return; - - // GL settings - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_LINE_SMOOTH); - GL11.glEnable(GL11.GL_CULL_FACE); - GL11.glDisable(GL11.GL_DEPTH_TEST); - - matrixStack.push(); - - BlockPos camPos = RenderUtils.getCameraBlockPos(); - int regionX = (camPos.getX() >> 9) * 512; - int regionZ = (camPos.getZ() >> 9) * 512; - RenderUtils.applyRegionalRenderOffset(matrixStack, regionX, regionZ); - - float[] rainbow = RenderUtils.getRainbowColor(); - RenderSystem.setShaderColor(rainbow[0], rainbow[1], rainbow[2], 0.5F); - - Matrix4f matrix = matrixStack.peek().getPositionMatrix(); - Tessellator tessellator = RenderSystem.renderThreadTesselator(); - BufferBuilder bufferBuilder = tessellator.getBuffer(); - RenderSystem.setShader(GameRenderer::getPositionProgram); - - // tracer line - bufferBuilder.begin(VertexFormat.DrawMode.DEBUG_LINES, - VertexFormats.POSITION); - - // set start position - Vec3d start = RotationUtils.getClientLookVec() - .add(RenderUtils.getCameraPos()).subtract(regionX, 0, regionZ); - - // set end position - Vec3d end = Vec3d.ofCenter(pos).subtract(regionX, 0, regionZ); - - // draw line - bufferBuilder - .vertex(matrix, (float)start.x, (float)start.y, (float)start.z) - .next(); - bufferBuilder.vertex(matrix, (float)end.x, (float)end.y, (float)end.z) - .next(); - - tessellator.draw(); - - // block box - { - matrixStack.push(); - matrixStack.translate(pos.getX() - regionX, pos.getY(), - pos.getZ() - regionZ); - - RenderUtils.drawOutlinedBox(matrixStack); - - RenderSystem.setShaderColor(rainbow[0], rainbow[1], rainbow[2], - 0.25F); - RenderUtils.drawSolidBox(matrixStack); - - matrixStack.pop(); - } - - matrixStack.pop(); - - // GL resets - RenderSystem.setShaderColor(1, 1, 1, 1); - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_LINE_SMOOTH); - } - - @Override - public void onReceivedPacket(PacketInputEvent event) - { - if(MC.player == null) - return; - - Packet packet = event.getPacket(); - - // get packet position - BlockPos newPos = null; - // if(packet instanceof SPacketEffect) - // { - // SPacketEffect effect = (SPacketEffect)packet; - // newPos = effect.getSoundPos(); - // - // }else - if(packet instanceof PlaySoundS2CPacket sound) - newPos = - BlockPos.ofFloored(sound.getX(), sound.getY(), sound.getZ()); - - if(newPos == null) - return; - - // check distance to player - BlockPos playerPos = BlockPos.ofFloored(MC.player.getPos()); - if(Math.abs(playerPos.getX() - newPos.getX()) > 256 - || Math.abs(playerPos.getZ() - newPos.getZ()) > 256) - pos = newPos; - } -} From d1ada5dbc89a9316eef4a747c31d015b01464c61 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 10 May 2023 14:42:04 +0200 Subject: [PATCH 081/282] Manage GL_LINE_SMOOTH in RenderListener --- src/main/java/net/wurstclient/ai/PathFinder.java | 2 -- src/main/java/net/wurstclient/events/RenderListener.java | 6 ++++++ src/main/java/net/wurstclient/hacks/AutoBuildHack.java | 2 -- src/main/java/net/wurstclient/hacks/AutoFarmHack.java | 2 -- src/main/java/net/wurstclient/hacks/AutoLibrarianHack.java | 2 -- src/main/java/net/wurstclient/hacks/BowAimbotHack.java | 2 -- src/main/java/net/wurstclient/hacks/BuildRandomHack.java | 2 -- src/main/java/net/wurstclient/hacks/CaveFinderHack.java | 2 -- src/main/java/net/wurstclient/hacks/ChestEspHack.java | 2 -- src/main/java/net/wurstclient/hacks/ExcavatorHack.java | 2 -- src/main/java/net/wurstclient/hacks/FeedAuraHack.java | 2 -- src/main/java/net/wurstclient/hacks/FreecamHack.java | 2 -- src/main/java/net/wurstclient/hacks/InstantBunkerHack.java | 2 -- src/main/java/net/wurstclient/hacks/ItemEspHack.java | 2 -- src/main/java/net/wurstclient/hacks/KillauraHack.java | 2 -- src/main/java/net/wurstclient/hacks/KillauraLegitHack.java | 2 -- src/main/java/net/wurstclient/hacks/MobEspHack.java | 2 -- src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java | 2 -- src/main/java/net/wurstclient/hacks/NukerHack.java | 3 --- src/main/java/net/wurstclient/hacks/NukerLegitHack.java | 2 -- src/main/java/net/wurstclient/hacks/OpenWaterEspHack.java | 2 -- src/main/java/net/wurstclient/hacks/OverlayHack.java | 2 -- src/main/java/net/wurstclient/hacks/PlayerEspHack.java | 2 -- src/main/java/net/wurstclient/hacks/ProphuntEspHack.java | 2 -- src/main/java/net/wurstclient/hacks/SearchHack.java | 2 -- src/main/java/net/wurstclient/hacks/TrajectoriesHack.java | 2 -- src/main/java/net/wurstclient/hacks/TreeBotHack.java | 2 -- src/main/java/net/wurstclient/hacks/TunnellerHack.java | 2 -- .../net/wurstclient/hacks/autofish/AutoFishDebugDraw.java | 2 -- .../net/wurstclient/hacks/newchunks/NewChunksRenderer.java | 2 -- 30 files changed, 6 insertions(+), 59 deletions(-) diff --git a/src/main/java/net/wurstclient/ai/PathFinder.java b/src/main/java/net/wurstclient/ai/PathFinder.java index f39dbbef2c..f666e12498 100644 --- a/src/main/java/net/wurstclient/ai/PathFinder.java +++ b/src/main/java/net/wurstclient/ai/PathFinder.java @@ -557,7 +557,6 @@ public void renderPath(MatrixStack matrixStack, boolean debugMode, GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_CULL_FACE); - GL11.glEnable(GL11.GL_LINE_SMOOTH); if(!depthTest) GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDepthMask(false); @@ -618,7 +617,6 @@ public void renderPath(MatrixStack matrixStack, boolean debugMode, RenderSystem.setShaderColor(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_LINE_SMOOTH); GL11.glDepthMask(true); } diff --git a/src/main/java/net/wurstclient/events/RenderListener.java b/src/main/java/net/wurstclient/events/RenderListener.java index 805b9c600c..4981451638 100644 --- a/src/main/java/net/wurstclient/events/RenderListener.java +++ b/src/main/java/net/wurstclient/events/RenderListener.java @@ -9,6 +9,8 @@ import java.util.ArrayList; +import org.lwjgl.opengl.GL11; + import net.minecraft.client.util.math.MatrixStack; import net.wurstclient.event.Event; import net.wurstclient.event.Listener; @@ -31,8 +33,12 @@ public RenderEvent(MatrixStack matrixStack, float partialTicks) @Override public void fire(ArrayList listeners) { + GL11.glEnable(GL11.GL_LINE_SMOOTH); + for(RenderListener listener : listeners) listener.onRender(matrixStack, partialTicks); + + GL11.glDisable(GL11.GL_LINE_SMOOTH); } @Override diff --git a/src/main/java/net/wurstclient/hacks/AutoBuildHack.java b/src/main/java/net/wurstclient/hacks/AutoBuildHack.java index 6f8d11ad05..e2a1757ff8 100644 --- a/src/main/java/net/wurstclient/hacks/AutoBuildHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoBuildHack.java @@ -357,7 +357,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glDisable(GL11.GL_CULL_FACE); RenderSystem.setShaderColor(0F, 0F, 0F, 0.5F); @@ -398,7 +397,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // GL resets GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_LINE_SMOOTH); RenderSystem.setShaderColor(1, 1, 1, 1); } diff --git a/src/main/java/net/wurstclient/hacks/AutoFarmHack.java b/src/main/java/net/wurstclient/hacks/AutoFarmHack.java index 5ab5ac8ef2..4b1de48bca 100644 --- a/src/main/java/net/wurstclient/hacks/AutoFarmHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoFarmHack.java @@ -193,7 +193,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_DEPTH_TEST); @@ -266,7 +265,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) RenderSystem.setShaderColor(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_LINE_SMOOTH); } private Stream getBlockStream(BlockPos center, int range) diff --git a/src/main/java/net/wurstclient/hacks/AutoLibrarianHack.java b/src/main/java/net/wurstclient/hacks/AutoLibrarianHack.java index 3b9dd0d4f6..33a8610d79 100644 --- a/src/main/java/net/wurstclient/hacks/AutoLibrarianHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoLibrarianHack.java @@ -520,7 +520,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_DEPTH_TEST); @@ -584,6 +583,5 @@ public void onRender(MatrixStack matrixStack, float partialTicks) RenderSystem.setShaderColor(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_LINE_SMOOTH); } } diff --git a/src/main/java/net/wurstclient/hacks/BowAimbotHack.java b/src/main/java/net/wurstclient/hacks/BowAimbotHack.java index f8f3e3ef63..4b6cf48bb5 100644 --- a/src/main/java/net/wurstclient/hacks/BowAimbotHack.java +++ b/src/main/java/net/wurstclient/hacks/BowAimbotHack.java @@ -206,7 +206,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glDisable(GL11.GL_DEPTH_TEST); matrixStack.push(); @@ -249,7 +248,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // GL resets GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_LINE_SMOOTH); RenderSystem.setShaderColor(1, 1, 1, 1); } diff --git a/src/main/java/net/wurstclient/hacks/BuildRandomHack.java b/src/main/java/net/wurstclient/hacks/BuildRandomHack.java index 8ab78e7604..121458990d 100644 --- a/src/main/java/net/wurstclient/hacks/BuildRandomHack.java +++ b/src/main/java/net/wurstclient/hacks/BuildRandomHack.java @@ -135,7 +135,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_DEPTH_TEST); @@ -166,7 +165,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // GL resets GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_LINE_SMOOTH); } private boolean tryToPlaceBlock(boolean legitMode, BlockPos pos) diff --git a/src/main/java/net/wurstclient/hacks/CaveFinderHack.java b/src/main/java/net/wurstclient/hacks/CaveFinderHack.java index 700410ebb6..b5306beb07 100644 --- a/src/main/java/net/wurstclient/hacks/CaveFinderHack.java +++ b/src/main/java/net/wurstclient/hacks/CaveFinderHack.java @@ -220,7 +220,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_DEPTH_TEST); @@ -254,7 +253,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) RenderSystem.setShaderColor(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_LINE_SMOOTH); } private ChunkPos getPlayerChunkPos(BlockPos eyesPos) diff --git a/src/main/java/net/wurstclient/hacks/ChestEspHack.java b/src/main/java/net/wurstclient/hacks/ChestEspHack.java index c67582a070..d05158d635 100644 --- a/src/main/java/net/wurstclient/hacks/ChestEspHack.java +++ b/src/main/java/net/wurstclient/hacks/ChestEspHack.java @@ -204,7 +204,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_DEPTH_TEST); @@ -236,6 +235,5 @@ public void onRender(MatrixStack matrixStack, float partialTicks) RenderSystem.setShaderColor(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_LINE_SMOOTH); } } diff --git a/src/main/java/net/wurstclient/hacks/ExcavatorHack.java b/src/main/java/net/wurstclient/hacks/ExcavatorHack.java index de21456bcc..d010a31307 100644 --- a/src/main/java/net/wurstclient/hacks/ExcavatorHack.java +++ b/src/main/java/net/wurstclient/hacks/ExcavatorHack.java @@ -155,7 +155,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_DEPTH_TEST); @@ -325,7 +324,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // GL resets GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_LINE_SMOOTH); RenderSystem.setShaderColor(1, 1, 1, 1); } diff --git a/src/main/java/net/wurstclient/hacks/FeedAuraHack.java b/src/main/java/net/wurstclient/hacks/FeedAuraHack.java index 66d40727fa..5dd5157685 100644 --- a/src/main/java/net/wurstclient/hacks/FeedAuraHack.java +++ b/src/main/java/net/wurstclient/hacks/FeedAuraHack.java @@ -187,7 +187,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_DEPTH_TEST); @@ -236,7 +235,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) RenderSystem.setShaderColor(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_LINE_SMOOTH); } private boolean isUntamed(AnimalEntity e) diff --git a/src/main/java/net/wurstclient/hacks/FreecamHack.java b/src/main/java/net/wurstclient/hacks/FreecamHack.java index 469c110f92..f6685ee8a8 100644 --- a/src/main/java/net/wurstclient/hacks/FreecamHack.java +++ b/src/main/java/net/wurstclient/hacks/FreecamHack.java @@ -184,7 +184,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glDisable(GL11.GL_DEPTH_TEST); matrixStack.push(); @@ -233,6 +232,5 @@ public void onRender(MatrixStack matrixStack, float partialTicks) RenderSystem.setShaderColor(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_LINE_SMOOTH); } } diff --git a/src/main/java/net/wurstclient/hacks/InstantBunkerHack.java b/src/main/java/net/wurstclient/hacks/InstantBunkerHack.java index 346eb176e5..8b42d98c5a 100644 --- a/src/main/java/net/wurstclient/hacks/InstantBunkerHack.java +++ b/src/main/java/net/wurstclient/hacks/InstantBunkerHack.java @@ -256,7 +256,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glDisable(GL11.GL_CULL_FACE); matrixStack.push(); @@ -306,6 +305,5 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // GL resets RenderSystem.setShaderColor(1, 1, 1, 1); GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_LINE_SMOOTH); } } diff --git a/src/main/java/net/wurstclient/hacks/ItemEspHack.java b/src/main/java/net/wurstclient/hacks/ItemEspHack.java index 08ee430094..f464fed182 100644 --- a/src/main/java/net/wurstclient/hacks/ItemEspHack.java +++ b/src/main/java/net/wurstclient/hacks/ItemEspHack.java @@ -102,7 +102,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) { // GL settings GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_LINE_SMOOTH); matrixStack.push(); @@ -122,7 +121,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) RenderSystem.setShaderColor(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_LINE_SMOOTH); } private void renderBoxes(MatrixStack matrixStack, double partialTicks, diff --git a/src/main/java/net/wurstclient/hacks/KillauraHack.java b/src/main/java/net/wurstclient/hacks/KillauraHack.java index cc675f7352..b4574d3bed 100644 --- a/src/main/java/net/wurstclient/hacks/KillauraHack.java +++ b/src/main/java/net/wurstclient/hacks/KillauraHack.java @@ -199,7 +199,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_DEPTH_TEST); @@ -257,7 +256,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) RenderSystem.setShaderColor(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_LINE_SMOOTH); } private enum Priority diff --git a/src/main/java/net/wurstclient/hacks/KillauraLegitHack.java b/src/main/java/net/wurstclient/hacks/KillauraLegitHack.java index 0b34f1439d..b634d7f562 100644 --- a/src/main/java/net/wurstclient/hacks/KillauraLegitHack.java +++ b/src/main/java/net/wurstclient/hacks/KillauraLegitHack.java @@ -214,7 +214,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_DEPTH_TEST); @@ -269,7 +268,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) RenderSystem.setShaderColor(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_LINE_SMOOTH); } private enum Priority diff --git a/src/main/java/net/wurstclient/hacks/MobEspHack.java b/src/main/java/net/wurstclient/hacks/MobEspHack.java index 6ec69801b1..35984344a0 100644 --- a/src/main/java/net/wurstclient/hacks/MobEspHack.java +++ b/src/main/java/net/wurstclient/hacks/MobEspHack.java @@ -121,7 +121,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glDisable(GL11.GL_DEPTH_TEST); matrixStack.push(); @@ -143,7 +142,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) RenderSystem.setShaderColor(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_LINE_SMOOTH); } private void renderBoxes(MatrixStack matrixStack, double partialTicks, diff --git a/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java b/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java index 6774286edc..56f16190bf 100644 --- a/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java +++ b/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java @@ -229,7 +229,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_LINE_SMOOTH); if(!depthTest) GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_CULL_FACE); @@ -260,7 +259,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) if(!depthTest) GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_LINE_SMOOTH); } private static class ChunkScanner diff --git a/src/main/java/net/wurstclient/hacks/NukerHack.java b/src/main/java/net/wurstclient/hacks/NukerHack.java index f8caac2ce1..62ccf6b6aa 100644 --- a/src/main/java/net/wurstclient/hacks/NukerHack.java +++ b/src/main/java/net/wurstclient/hacks/NukerHack.java @@ -244,7 +244,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_DEPTH_TEST); @@ -283,8 +282,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) RenderSystem.setShaderColor(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_LINE_SMOOTH); - } private enum Mode diff --git a/src/main/java/net/wurstclient/hacks/NukerLegitHack.java b/src/main/java/net/wurstclient/hacks/NukerLegitHack.java index bf50b7f945..d13bdfa181 100644 --- a/src/main/java/net/wurstclient/hacks/NukerLegitHack.java +++ b/src/main/java/net/wurstclient/hacks/NukerLegitHack.java @@ -285,7 +285,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_DEPTH_TEST); @@ -334,7 +333,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) RenderSystem.setShaderColor(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_LINE_SMOOTH); } private enum Mode diff --git a/src/main/java/net/wurstclient/hacks/OpenWaterEspHack.java b/src/main/java/net/wurstclient/hacks/OpenWaterEspHack.java index 1a32fbc9fd..f689d1b191 100644 --- a/src/main/java/net/wurstclient/hacks/OpenWaterEspHack.java +++ b/src/main/java/net/wurstclient/hacks/OpenWaterEspHack.java @@ -63,7 +63,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_DEPTH_TEST); @@ -80,7 +79,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) RenderSystem.setShaderColor(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_LINE_SMOOTH); } private void drawOpenWater(MatrixStack matrixStack, diff --git a/src/main/java/net/wurstclient/hacks/OverlayHack.java b/src/main/java/net/wurstclient/hacks/OverlayHack.java index 496cebcb65..937594b296 100644 --- a/src/main/java/net/wurstclient/hacks/OverlayHack.java +++ b/src/main/java/net/wurstclient/hacks/OverlayHack.java @@ -58,7 +58,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_DEPTH_TEST); @@ -98,6 +97,5 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // GL resets GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_LINE_SMOOTH); } } diff --git a/src/main/java/net/wurstclient/hacks/PlayerEspHack.java b/src/main/java/net/wurstclient/hacks/PlayerEspHack.java index 9e1671060b..a956c552f2 100644 --- a/src/main/java/net/wurstclient/hacks/PlayerEspHack.java +++ b/src/main/java/net/wurstclient/hacks/PlayerEspHack.java @@ -119,7 +119,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glDisable(GL11.GL_DEPTH_TEST); matrixStack.push(); @@ -142,7 +141,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) RenderSystem.setShaderColor(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_LINE_SMOOTH); } private void renderBoxes(MatrixStack matrixStack, double partialTicks, diff --git a/src/main/java/net/wurstclient/hacks/ProphuntEspHack.java b/src/main/java/net/wurstclient/hacks/ProphuntEspHack.java index 9e0b5f5c56..34292c9a23 100644 --- a/src/main/java/net/wurstclient/hacks/ProphuntEspHack.java +++ b/src/main/java/net/wurstclient/hacks/ProphuntEspHack.java @@ -53,7 +53,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_DEPTH_TEST); @@ -97,6 +96,5 @@ public void onRender(MatrixStack matrixStack, float partialTicks) RenderSystem.setShaderColor(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_LINE_SMOOTH); } } diff --git a/src/main/java/net/wurstclient/hacks/SearchHack.java b/src/main/java/net/wurstclient/hacks/SearchHack.java index f6f9d27eca..b8a4d47433 100644 --- a/src/main/java/net/wurstclient/hacks/SearchHack.java +++ b/src/main/java/net/wurstclient/hacks/SearchHack.java @@ -218,7 +218,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_DEPTH_TEST); @@ -246,7 +245,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) RenderSystem.setShaderColor(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_LINE_SMOOTH); } private void addSearchersInRange(ChunkPos center, Block block, diff --git a/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java b/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java index b8efc9e5be..b9b821e047 100644 --- a/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java +++ b/src/main/java/net/wurstclient/hacks/TrajectoriesHack.java @@ -87,7 +87,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDepthMask(false); - GL11.glEnable(GL11.GL_LINE_SMOOTH); RenderUtils.applyCameraRotationOnly(); @@ -113,7 +112,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthMask(true); - GL11.glDisable(GL11.GL_LINE_SMOOTH); matrixStack.pop(); } diff --git a/src/main/java/net/wurstclient/hacks/TreeBotHack.java b/src/main/java/net/wurstclient/hacks/TreeBotHack.java index db70d9643f..1fa4d8aa15 100644 --- a/src/main/java/net/wurstclient/hacks/TreeBotHack.java +++ b/src/main/java/net/wurstclient/hacks/TreeBotHack.java @@ -294,7 +294,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_DEPTH_TEST); @@ -308,7 +307,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) RenderSystem.setShaderColor(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_LINE_SMOOTH); } private void drawTree(MatrixStack matrixStack) diff --git a/src/main/java/net/wurstclient/hacks/TunnellerHack.java b/src/main/java/net/wurstclient/hacks/TunnellerHack.java index 146a6996ec..d6f507619f 100644 --- a/src/main/java/net/wurstclient/hacks/TunnellerHack.java +++ b/src/main/java/net/wurstclient/hacks/TunnellerHack.java @@ -202,7 +202,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_DEPTH_TEST); @@ -266,7 +265,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) RenderSystem.setShaderColor(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_LINE_SMOOTH); } private void updateCyanBuffer() diff --git a/src/main/java/net/wurstclient/hacks/autofish/AutoFishDebugDraw.java b/src/main/java/net/wurstclient/hacks/autofish/AutoFishDebugDraw.java index 7d843536ab..f34a8a5738 100644 --- a/src/main/java/net/wurstclient/hacks/autofish/AutoFishDebugDraw.java +++ b/src/main/java/net/wurstclient/hacks/autofish/AutoFishDebugDraw.java @@ -74,7 +74,6 @@ public void render(MatrixStack matrixStack, float partialTicks) // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_DEPTH_TEST); @@ -98,7 +97,6 @@ public void render(MatrixStack matrixStack, float partialTicks) RenderSystem.setShaderColor(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_LINE_SMOOTH); } private void drawValidRange(MatrixStack matrixStack, diff --git a/src/main/java/net/wurstclient/hacks/newchunks/NewChunksRenderer.java b/src/main/java/net/wurstclient/hacks/newchunks/NewChunksRenderer.java index 25fd7f4485..0f8b5b304c 100644 --- a/src/main/java/net/wurstclient/hacks/newchunks/NewChunksRenderer.java +++ b/src/main/java/net/wurstclient/hacks/newchunks/NewChunksRenderer.java @@ -64,7 +64,6 @@ public void render(MatrixStack matrixStack, float partialTicks) // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_DEPTH_TEST); @@ -112,6 +111,5 @@ public void render(MatrixStack matrixStack, float partialTicks) RenderSystem.setShaderColor(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_LINE_SMOOTH); } } From 578e0ea99fa8e86f82f97bcb2bd44468dc043765 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 10 May 2023 17:18:19 +0200 Subject: [PATCH 082/282] Move block breaking overlay to a separate OverlayRenderer class --- .../java/net/wurstclient/hacks/NukerHack.java | 79 ++----------- .../net/wurstclient/hacks/NukerLegitHack.java | 76 +++--------- .../net/wurstclient/hacks/OverlayHack.java | 80 ++++--------- .../net/wurstclient/util/OverlayRenderer.java | 109 ++++++++++++++++++ 4 files changed, 156 insertions(+), 188 deletions(-) create mode 100644 src/main/java/net/wurstclient/util/OverlayRenderer.java diff --git a/src/main/java/net/wurstclient/hacks/NukerHack.java b/src/main/java/net/wurstclient/hacks/NukerHack.java index 62ccf6b6aa..57abf02232 100644 --- a/src/main/java/net/wurstclient/hacks/NukerHack.java +++ b/src/main/java/net/wurstclient/hacks/NukerHack.java @@ -19,18 +19,12 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import org.lwjgl.opengl.GL11; - -import com.mojang.blaze3d.systems.RenderSystem; - import net.minecraft.block.Blocks; import net.minecraft.client.network.ClientPlayerEntity; -import net.minecraft.client.render.GameRenderer; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Box; import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3i; import net.wurstclient.Category; @@ -46,7 +40,7 @@ import net.wurstclient.settings.SliderSetting.ValueDisplay; import net.wurstclient.util.BlockBreaker; import net.wurstclient.util.BlockUtils; -import net.wurstclient.util.RenderUtils; +import net.wurstclient.util.OverlayRenderer; import net.wurstclient.util.RotationUtils; public final class NukerHack extends Hack @@ -86,9 +80,8 @@ public final class NukerHack extends Hack "minecraft:raw_iron_block", "minecraft:redstone_ore"); private final ArrayDeque> prevBlocks = new ArrayDeque<>(); + private final OverlayRenderer renderer = new OverlayRenderer(); private BlockPos currentBlock; - private float progress; - private float prevProgress; public NukerHack() { @@ -136,6 +129,7 @@ protected void onDisable() } prevBlocks.clear(); + renderer.resetProgress(); if(!lockId.isChecked()) id.setBlock(Blocks.AIR); @@ -144,13 +138,13 @@ protected void onDisable() @Override public void onUpdate() { + currentBlock = null; + // abort if using IDNuker without an ID being set if(mode.getSelected() == Mode.ID && id.getBlock() == Blocks.AIR) return; ClientPlayerEntity player = MC.player; - - currentBlock = null; Vec3d eyesPos = RotationUtils.getEyesPos().subtract(0.5, 0.5, 0.5); BlockPos eyesBlock = BlockPos.ofFloored(RotationUtils.getEyesPos()); double rangeSq = Math.pow(range.getValue(), 2); @@ -186,8 +180,7 @@ public void onUpdate() currentBlock = blocks3.get(0); MC.interactionManager.cancelBlockBreaking(); - progress = 1; - prevProgress = 1; + renderer.resetProgress(); BlockBreaker.breakBlocksWithPacketSpam(blocks3); return; } @@ -203,18 +196,9 @@ public void onUpdate() MC.interactionManager.cancelBlockBreaking(); if(currentBlock != null && BlockUtils.getHardness(currentBlock) < 1) - { - prevProgress = progress; - progress = IMC.getInteractionManager().getCurrentBreakingProgress(); - - if(progress < prevProgress) - prevProgress = progress; - - }else - { - progress = 1; - prevProgress = 1; - } + renderer.updateProgress(); + else + renderer.resetProgress(); } @Override @@ -238,50 +222,7 @@ public void onLeftClick(LeftClickEvent event) @Override public void onRender(MatrixStack matrixStack, float partialTicks) { - if(currentBlock == null) - return; - - // GL settings - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_CULL_FACE); - GL11.glDisable(GL11.GL_DEPTH_TEST); - - matrixStack.push(); - - BlockPos camPos = RenderUtils.getCameraBlockPos(); - int regionX = (camPos.getX() >> 9) * 512; - int regionZ = (camPos.getZ() >> 9) * 512; - RenderUtils.applyRegionalRenderOffset(matrixStack, regionX, regionZ); - - Box box = new Box(BlockPos.ORIGIN); - float p = prevProgress + (progress - prevProgress) * partialTicks; - float red = p * 2F; - float green = 2 - red; - - matrixStack.translate(currentBlock.getX() - regionX, - currentBlock.getY(), currentBlock.getZ() - regionZ); - if(p < 1) - { - matrixStack.translate(0.5, 0.5, 0.5); - matrixStack.scale(p, p, p); - matrixStack.translate(-0.5, -0.5, -0.5); - } - - RenderSystem.setShader(GameRenderer::getPositionProgram); - - RenderSystem.setShaderColor(red, green, 0, 0.25F); - RenderUtils.drawSolidBox(box, matrixStack); - - RenderSystem.setShaderColor(red, green, 0, 0.5F); - RenderUtils.drawOutlinedBox(box, matrixStack); - - matrixStack.pop(); - - // GL resets - RenderSystem.setShaderColor(1, 1, 1, 1); - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glDisable(GL11.GL_BLEND); + renderer.render(matrixStack, partialTicks, currentBlock); } private enum Mode diff --git a/src/main/java/net/wurstclient/hacks/NukerLegitHack.java b/src/main/java/net/wurstclient/hacks/NukerLegitHack.java index d13bdfa181..c1567a15f9 100644 --- a/src/main/java/net/wurstclient/hacks/NukerLegitHack.java +++ b/src/main/java/net/wurstclient/hacks/NukerLegitHack.java @@ -14,14 +14,9 @@ import java.util.function.Predicate; import java.util.stream.Collectors; -import org.lwjgl.opengl.GL11; - -import com.mojang.blaze3d.systems.RenderSystem; - import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.Material; -import net.minecraft.client.render.GameRenderer; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; @@ -42,7 +37,7 @@ import net.wurstclient.settings.SliderSetting; import net.wurstclient.settings.SliderSetting.ValueDisplay; import net.wurstclient.util.BlockUtils; -import net.wurstclient.util.RenderUtils; +import net.wurstclient.util.OverlayRenderer; import net.wurstclient.util.RotationUtils; @SearchTags({"LegitNuker", "nuker legit", "legit nuker"}) @@ -82,6 +77,7 @@ public final class NukerLegitHack extends Hack "minecraft:raw_copper_block", "minecraft:raw_gold_block", "minecraft:raw_iron_block", "minecraft:redstone_ore"); + private final OverlayRenderer renderer = new OverlayRenderer(); private BlockPos currentBlock; public NukerLegitHack() @@ -128,6 +124,7 @@ public void onDisable() // resets MC.options.attackKey.setPressed(false); + renderer.resetProgress(); currentBlock = null; if(!lockId.isChecked()) id.setBlock(Blocks.AIR); @@ -161,11 +158,14 @@ public void onLeftClick(LeftClickEvent event) @Override public void onUpdate() { + currentBlock = null; + // abort if using IDNuker without an ID being set if(mode.getSelected() == Mode.ID && id.getBlock() == Blocks.AIR) + { + renderer.resetProgress(); return; - - currentBlock = null; + } // get valid blocks Iterable validBlocks = getValidBlocks(range.getValue(), @@ -185,7 +185,12 @@ public void onUpdate() // reset if no block was found if(currentBlock == null) + { MC.options.attackKey.setPressed(false); + renderer.resetProgress(); + } + + renderer.updateProgress(); } private ArrayList getValidBlocks(double range, @@ -279,60 +284,7 @@ private boolean breakBlockExtraLegit(BlockPos pos) @Override public void onRender(MatrixStack matrixStack, float partialTicks) { - if(currentBlock == null) - return; - - // GL settings - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_CULL_FACE); - GL11.glDisable(GL11.GL_DEPTH_TEST); - - matrixStack.push(); - - BlockPos camPos = RenderUtils.getCameraBlockPos(); - int regionX = (camPos.getX() >> 9) * 512; - int regionZ = (camPos.getZ() >> 9) * 512; - RenderUtils.applyRegionalRenderOffset(matrixStack, regionX, regionZ); - - // set position - matrixStack.translate(currentBlock.getX() - regionX, - currentBlock.getY(), currentBlock.getZ() - regionZ); - - // get progress - float progress; - if(BlockUtils.getHardness(currentBlock) < 1) - progress = IMC.getInteractionManager().getCurrentBreakingProgress(); - else - progress = 1; - - // set size - if(progress < 1) - { - matrixStack.translate(0.5, 0.5, 0.5); - matrixStack.scale(progress, progress, progress); - matrixStack.translate(-0.5, -0.5, -0.5); - } - - // get color - float red = progress * 2F; - float green = 2 - red; - - // draw box - RenderSystem.setShader(GameRenderer::getPositionProgram); - - RenderSystem.setShaderColor(red, green, 0, 0.25F); - RenderUtils.drawSolidBox(matrixStack); - - RenderSystem.setShaderColor(red, green, 0, 0.5F); - RenderUtils.drawOutlinedBox(matrixStack); - - matrixStack.pop(); - - // GL resets - RenderSystem.setShaderColor(1, 1, 1, 1); - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glDisable(GL11.GL_BLEND); + renderer.render(matrixStack, partialTicks, currentBlock); } private enum Mode diff --git a/src/main/java/net/wurstclient/hacks/OverlayHack.java b/src/main/java/net/wurstclient/hacks/OverlayHack.java index 937594b296..d3b997d585 100644 --- a/src/main/java/net/wurstclient/hacks/OverlayHack.java +++ b/src/main/java/net/wurstclient/hacks/OverlayHack.java @@ -7,22 +7,20 @@ */ package net.wurstclient.hacks; -import org.lwjgl.opengl.GL11; - -import com.mojang.blaze3d.systems.RenderSystem; - -import net.minecraft.client.render.GameRenderer; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.HitResult; -import net.minecraft.util.math.BlockPos; import net.wurstclient.Category; import net.wurstclient.events.RenderListener; +import net.wurstclient.events.UpdateListener; import net.wurstclient.hack.Hack; -import net.wurstclient.util.RenderUtils; +import net.wurstclient.util.OverlayRenderer; -public final class OverlayHack extends Hack implements RenderListener +public final class OverlayHack extends Hack + implements UpdateListener, RenderListener { + private final OverlayRenderer renderer = new OverlayRenderer(); + public OverlayHack() { super("Overlay"); @@ -32,70 +30,38 @@ public OverlayHack() @Override public void onEnable() { + EVENTS.add(UpdateListener.class, this); EVENTS.add(RenderListener.class, this); } @Override public void onDisable() { + EVENTS.remove(UpdateListener.class, this); EVENTS.remove(RenderListener.class, this); + renderer.resetProgress(); + } + + @Override + public void onUpdate() + { + if(MC.interactionManager.isBreakingBlock()) + renderer.updateProgress(); + else + renderer.resetProgress(); } @Override public void onRender(MatrixStack matrixStack, float partialTicks) { - if(MC.crosshairTarget == null - || MC.crosshairTarget.getType() != HitResult.Type.BLOCK) - return; - - BlockHitResult blockHitResult = (BlockHitResult)MC.crosshairTarget; - BlockPos pos = new BlockPos(blockHitResult.getBlockPos()); - - // check if hitting block if(!MC.interactionManager.isBreakingBlock()) return; - // GL settings - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_CULL_FACE); - GL11.glDisable(GL11.GL_DEPTH_TEST); - - matrixStack.push(); - - BlockPos camPos = RenderUtils.getCameraBlockPos(); - int regionX = (camPos.getX() >> 9) * 512; - int regionZ = (camPos.getZ() >> 9) * 512; - RenderUtils.applyRegionalRenderOffset(matrixStack, regionX, regionZ); - - // set position - matrixStack.translate(pos.getX() - regionX, pos.getY(), - pos.getZ() - regionZ); - - // get progress - float progress = - IMC.getInteractionManager().getCurrentBreakingProgress(); - - // set size - matrixStack.translate(0.5, 0.5, 0.5); - matrixStack.scale(progress, progress, progress); - matrixStack.translate(-0.5, -0.5, -0.5); - - // get color - float red = progress * 2F; - float green = 2 - red; - - // draw box - RenderSystem.setShader(GameRenderer::getPositionProgram); - RenderSystem.setShaderColor(red, green, 0, 0.25F); - RenderUtils.drawSolidBox(matrixStack); - RenderSystem.setShaderColor(red, green, 0, 0.5F); - RenderUtils.drawOutlinedBox(matrixStack); - - matrixStack.pop(); + if(!(MC.crosshairTarget instanceof BlockHitResult blockHitResult) + || blockHitResult.getType() != HitResult.Type.BLOCK) + return; - // GL resets - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glDisable(GL11.GL_BLEND); + renderer.render(matrixStack, partialTicks, + blockHitResult.getBlockPos()); } } diff --git a/src/main/java/net/wurstclient/util/OverlayRenderer.java b/src/main/java/net/wurstclient/util/OverlayRenderer.java new file mode 100644 index 0000000000..a11ab18941 --- /dev/null +++ b/src/main/java/net/wurstclient/util/OverlayRenderer.java @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.util; + +import org.lwjgl.opengl.GL11; + +import com.mojang.blaze3d.systems.RenderSystem; + +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.render.GameRenderer; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.wurstclient.WurstClient; +import net.wurstclient.mixinterface.IMinecraftClient; + +public final class OverlayRenderer +{ + protected static final MinecraftClient MC = WurstClient.MC; + protected static final IMinecraftClient IMC = WurstClient.IMC; + + private float progress; + private float prevProgress; + private BlockPos prevPos; + + public void resetProgress() + { + progress = 0; + prevProgress = 0; + prevPos = null; + } + + public void updateProgress() + { + prevProgress = progress; + progress = IMC.getInteractionManager().getCurrentBreakingProgress(); + + if(progress < prevProgress) + prevProgress = progress; + } + + public void render(MatrixStack matrixStack, float partialTicks, + BlockPos pos) + { + if(pos == null) + return; + + // reset progress if breaking a different block + if(prevPos != null && !pos.equals(prevPos)) + resetProgress(); + + prevPos = pos; + + // GL settings + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glEnable(GL11.GL_CULL_FACE); + GL11.glDisable(GL11.GL_DEPTH_TEST); + + matrixStack.push(); + + BlockPos camPos = RenderUtils.getCameraBlockPos(); + int regionX = (camPos.getX() >> 9) * 512; + int regionZ = (camPos.getZ() >> 9) * 512; + RenderUtils.applyRegionalRenderOffset(matrixStack, regionX, regionZ); + + // set position + matrixStack.translate(pos.getX() - regionX, pos.getY(), + pos.getZ() - regionZ); + + // get interpolated progress + boolean breaksInstantly = (MC.player.getAbilities().creativeMode + || BlockUtils.getHardness(pos) >= 1) + && BlockUtils.canBeClicked(pos); + float p = breaksInstantly ? 1 + : MathHelper.lerp(partialTicks, prevProgress, progress); + + // set size + if(p < 1) + { + matrixStack.translate(0.5, 0.5, 0.5); + matrixStack.scale(p, p, p); + matrixStack.translate(-0.5, -0.5, -0.5); + } + + // get color + float red = p * 2F; + float green = 2 - red; + + // draw box + RenderSystem.setShader(GameRenderer::getPositionProgram); + RenderSystem.setShaderColor(red, green, 0, 0.25F); + RenderUtils.drawSolidBox(matrixStack); + RenderSystem.setShaderColor(red, green, 0, 0.5F); + RenderUtils.drawOutlinedBox(matrixStack); + + matrixStack.pop(); + + // GL resets + RenderSystem.setShaderColor(1, 1, 1, 1); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glDisable(GL11.GL_BLEND); + } +} From fa668e0efc91b44134f85bd0af925bc7550da324 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 10 May 2023 17:19:18 +0200 Subject: [PATCH 083/282] Make Nuker wait when the user is mining manually --- src/main/java/net/wurstclient/hacks/NukerHack.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/net/wurstclient/hacks/NukerHack.java b/src/main/java/net/wurstclient/hacks/NukerHack.java index 57abf02232..ce5a246dcf 100644 --- a/src/main/java/net/wurstclient/hacks/NukerHack.java +++ b/src/main/java/net/wurstclient/hacks/NukerHack.java @@ -140,6 +140,10 @@ public void onUpdate() { currentBlock = null; + // abort if user is mining manually + if(MC.options.attackKey.isPressed()) + return; + // abort if using IDNuker without an ID being set if(mode.getSelected() == Mode.ID && id.getBlock() == Blocks.AIR) return; From 1567a5edee222cc002d83b9a60fddd829d0a064a Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 10 May 2023 17:28:12 +0200 Subject: [PATCH 084/282] Fix lang files still containing PlayerFinder's description --- src/main/resources/assets/wurst/lang/cs_cz.json | 1 - src/main/resources/assets/wurst/lang/en_us.json | 1 - src/main/resources/assets/wurst/lang/fr_fr.json | 1 - src/main/resources/assets/wurst/lang/it_it.json | 1 - src/main/resources/assets/wurst/lang/ja_jp.json | 1 - src/main/resources/assets/wurst/lang/pl_pl.json | 1 - src/main/resources/assets/wurst/lang/ro_ro.json | 1 - src/main/resources/assets/wurst/lang/ru_ru.json | 1 - src/main/resources/assets/wurst/lang/uk_ua.json | 1 - src/main/resources/assets/wurst/lang/zh_cn.json | 1 - src/main/resources/assets/wurst/lang/zh_hk.json | 1 - src/main/resources/assets/wurst/lang/zh_tw.json | 1 - 12 files changed, 12 deletions(-) diff --git a/src/main/resources/assets/wurst/lang/cs_cz.json b/src/main/resources/assets/wurst/lang/cs_cz.json index 8346a662b8..8040d9ed19 100644 --- a/src/main/resources/assets/wurst/lang/cs_cz.json +++ b/src/main/resources/assets/wurst/lang/cs_cz.json @@ -124,7 +124,6 @@ "description.wurst.hack.panic": "Okamžitě vypne všechny povolené hacky.\nS tímhle opatrně!", "description.wurst.hack.parkour": "Při dosažení hrany bloku skáčete automaticky.\nUžitečné pro parkoury a skoko-běhách.", "description.wurst.hack.playeresp": "Zvýrazní okolní hráče.\nESP boxy přátel se zobrazí modře.", - "description.wurst.hack.playerfinder": "Vyhledává vzdálené hráče během bouřek.", "description.wurst.hack.portalgui": "Umožňuje otevření inventářů v portálech.", "description.wurst.hack.potionsaver": "Pozastaví všecny efekty lektvarů, dokud stojíte na místě.", "description.wurst.hack.prophuntesp": "Umožňuje vidět falešné bloky v Prophuntu.\nVyrobeno pro Mineplexí Prophunt. Může však fungovat i na jiných serverech.", diff --git a/src/main/resources/assets/wurst/lang/en_us.json b/src/main/resources/assets/wurst/lang/en_us.json index 5cdc338a11..61a0142add 100644 --- a/src/main/resources/assets/wurst/lang/en_us.json +++ b/src/main/resources/assets/wurst/lang/en_us.json @@ -128,7 +128,6 @@ "description.wurst.hack.panic": "Instantly turns off all enabled hacks.\nBe careful with this one!", "description.wurst.hack.parkour": "Makes you jump automatically when reaching the edge of a block.\nUseful for parkours and jump'n'runs.", "description.wurst.hack.playeresp": "Highlights nearby players.\nESP boxes of friends will appear in blue.", - "description.wurst.hack.playerfinder": "Finds far away players during thunderstorms.", "description.wurst.hack.portalgui": "Allows you to open GUIs in portals.", "description.wurst.hack.potionsaver": "Freezes all potion effects while you are standing still.", "description.wurst.hack.prophuntesp": "Allows you to see fake blocks in Prophunt.\nMade for Mineplex Prophunt. Might not work on other servers.", diff --git a/src/main/resources/assets/wurst/lang/fr_fr.json b/src/main/resources/assets/wurst/lang/fr_fr.json index e4f717db61..c9cb3691a5 100644 --- a/src/main/resources/assets/wurst/lang/fr_fr.json +++ b/src/main/resources/assets/wurst/lang/fr_fr.json @@ -121,7 +121,6 @@ "description.wurst.hack.panic": "Désactive instantanément tous les hacks activés.\nSoyez prudent avec celui-ci !", "description.wurst.hack.parkour": "Vous fait sauter automatiquement lorsque vous atteignez le bord d'un bloc.\nUtile pour les parcours.", "description.wurst.hack.playeresp": "Met en évidence les joueurs à proximité.\nLes boîtes ESP des amis apparaîtront en bleu.", - "description.wurst.hack.playerfinder": "Trouve les joueurs éloignés pendant les orages.", "description.wurst.hack.portalgui": "Vous permet d'ouvrir les GUI dans des portails.", "description.wurst.hack.potionsaver": "Gèle tous les effets de potion pendant que vous êtes immobile.", "description.wurst.hack.prophuntesp": "Permet de voir les faux blocs dans le Prophunt.\nConçu pour le Prohunt de Mineplex. Peut ne pas fonctionner sur d'autres serveurs.", diff --git a/src/main/resources/assets/wurst/lang/it_it.json b/src/main/resources/assets/wurst/lang/it_it.json index 41adb13c76..1d70da3888 100644 --- a/src/main/resources/assets/wurst/lang/it_it.json +++ b/src/main/resources/assets/wurst/lang/it_it.json @@ -124,7 +124,6 @@ "description.wurst.hack.panic": "Disattiva tutte le hack utilizzate.\n Pensa prima di usarlo usi!", "description.wurst.hack.parkour": "Ti fa saltare automaticamente quando arrivi alla fine di un blocco.\nUtile per i parkour e per le jump'n'runs.", "description.wurst.hack.playeresp": "Evidenzia i giocatori vicini.\nI riquadri ESP degli amici saranno in blu.", - "description.wurst.hack.playerfinder": "Trova i giocatori lontani durante le tempeste.", "description.wurst.hack.portalgui": "Ti permette di aprire le GUI nei portali.", "description.wurst.hack.potionsaver": "Blocca tutti gli effetti della pozione mentre sei fermo.", "description.wurst.hack.prophuntesp": "Ti permette di vedere i blocchi falsi in PropHunt.\n Fatto per la PropHunt di Mineplex. Potrebbe non funzionare su altri server.", diff --git a/src/main/resources/assets/wurst/lang/ja_jp.json b/src/main/resources/assets/wurst/lang/ja_jp.json index 8acdf08f33..643433c90e 100644 --- a/src/main/resources/assets/wurst/lang/ja_jp.json +++ b/src/main/resources/assets/wurst/lang/ja_jp.json @@ -124,7 +124,6 @@ "description.wurst.hack.panic": "使用しているすべてのハックを瞬時にOFFにする。\n誤操作に注意!", "description.wurst.hack.parkour": "ブロックの端に到達した際に自動でジャンプする。\nパルクールなどに有用。", "description.wurst.hack.playeresp": "付近のプレイヤーをハイライト表示する。\nフレンドのESPボックスは青色で表示される。", - "description.wurst.hack.playerfinder": "雷雨時に遠くにいるプレイヤーを見つける。", "description.wurst.hack.portalgui": "ネザーポータルの中にいてもメニューを開けるようになる。", "description.wurst.hack.potionsaver": "静止中にすべてのポーションの効果を停止させる。", "description.wurst.hack.prophuntesp": "Prophuntで偽物のブロックを見破ることができる。\nMineplexサーバーのミニゲーム「Prophunt」用。他サーバーでは動作しない可能性あり。", diff --git a/src/main/resources/assets/wurst/lang/pl_pl.json b/src/main/resources/assets/wurst/lang/pl_pl.json index ce6e904a87..e7f6fe2f3b 100644 --- a/src/main/resources/assets/wurst/lang/pl_pl.json +++ b/src/main/resources/assets/wurst/lang/pl_pl.json @@ -124,7 +124,6 @@ "description.wurst.hack.panic": "Natychmiast wyłącza wszystkie włączone hacki.\nBądź z tym ostrożny!", "description.wurst.hack.parkour": "Sprawia, że skaczesz automatycznie po dotarciu do krawędzi bloku.\nPrzydatne do parkourów i jump'n'runów.", "description.wurst.hack.playeresp": "Podświetla pobliskich graczy.\nKontenery ESP znajomych pojawią się na niebiesko.", - "description.wurst.hack.playerfinder": "Znajduje odległych graczy podczas burzy.", "description.wurst.hack.portalgui": "Umożliwia otwieranie GUI w portalach.", "description.wurst.hack.potionsaver": "Wstrzymuje wszystkie efekty mikstur, gdy stoisz w miejscu.", "description.wurst.hack.prophuntesp": "Pozwala zobaczyć fałszywe bloki w Prophuntcie.\nStworzony dla Prophunta Mineplex'a. Może nie działać na innych serwerach.", diff --git a/src/main/resources/assets/wurst/lang/ro_ro.json b/src/main/resources/assets/wurst/lang/ro_ro.json index 62a6b69c0c..140edb9cd5 100644 --- a/src/main/resources/assets/wurst/lang/ro_ro.json +++ b/src/main/resources/assets/wurst/lang/ro_ro.json @@ -120,7 +120,6 @@ "description.wurst.hack.panic": "Opreste instant orice hack pornit.\nAi grija folosing acesta!", "description.wurst.hack.parkour": "Te face sa sari automat cand esti la marginea unui block.\nFolositor pentru parkour.", "description.wurst.hack.playeresp": "Contureaza jucatorii din apropiere.\nHitboxurile prietenilor vor aparea in albastru.", - "description.wurst.hack.playerfinder": "Localizeaza playerii din departare pe timp de furtuna.", "description.wurst.hack.portalgui": "Iti permite sa folosesti GUI-uri in portale.", "description.wurst.hack.potionsaver": "Ingheata efectele potiunilor in timp ce stai pe loc.", "description.wurst.hack.prophuntesp": "Iti permite sa vezi jucatorii ascunsi in prophunt.\nFacut pentru Mineplex Prophunt. Posibil sa nu functioneze pe alte servere.", diff --git a/src/main/resources/assets/wurst/lang/ru_ru.json b/src/main/resources/assets/wurst/lang/ru_ru.json index e38f6602fd..ab2ff2795b 100644 --- a/src/main/resources/assets/wurst/lang/ru_ru.json +++ b/src/main/resources/assets/wurst/lang/ru_ru.json @@ -124,7 +124,6 @@ "description.wurst.hack.panic": "Моментально выключает все читы.\nОсторожней с этим!", "description.wurst.hack.parkour": "Заставляет вас автоматически прыгать по достижении края блока.\nПолезно для паркуров и побегов.", "description.wurst.hack.playeresp": "Подсвечивает игроков неподалеку.\nДрузей будет подсвечивать синим.", - "description.wurst.hack.playerfinder": "Находит игроков во время грозы.", "description.wurst.hack.portalgui": "Позволяет открывать инвентарь и чат в порталах.", "description.wurst.hack.potionsaver": "Замораживает время действия всех эффектов пока Вы стоите на месте.", "description.wurst.hack.prophuntesp": "Позволяет отличать ненастоящие блоки в Prophunt.\nСделано для Mineplex Prophunt. Может не работать на других серверах.", diff --git a/src/main/resources/assets/wurst/lang/uk_ua.json b/src/main/resources/assets/wurst/lang/uk_ua.json index 4ac685e080..2622740d60 100644 --- a/src/main/resources/assets/wurst/lang/uk_ua.json +++ b/src/main/resources/assets/wurst/lang/uk_ua.json @@ -120,7 +120,6 @@ "description.wurst.hack.panic": "Миттєво вимикає всі чити.\nОбережніше з цим!", "description.wurst.hack.parkour": "Примушує вас автоматично стрибати після досягнення краю блоку.\nКорисно для паркурів та пагонів.", "description.wurst.hack.playeresp": "Підсвічує гравців.\nДрузів буде підсвічувати синім.", - "description.wurst.hack.playerfinder": "Знаходить гравців під час грози.", "description.wurst.hack.portalgui": "Дозволяє відкривати інвентар та чат у порталах.", "description.wurst.hack.potionsaver": "Заморожує дію всіх ефектів, поки ви стоїте на місці.", "description.wurst.hack.prophuntesp": "Дозволяє відрізняти несправжні блоки в Prophunt.\nЗроблено для Mineplex Prophunt. Може працювати на інших серверах.", diff --git a/src/main/resources/assets/wurst/lang/zh_cn.json b/src/main/resources/assets/wurst/lang/zh_cn.json index f4f1ee4571..c80adc71a6 100644 --- a/src/main/resources/assets/wurst/lang/zh_cn.json +++ b/src/main/resources/assets/wurst/lang/zh_cn.json @@ -124,7 +124,6 @@ "description.wurst.hack.panic": "瞬间关闭所有的作弊功能。\n请小心使用!", "description.wurst.hack.parkour": "当你到达方块边缘时自动跳起。\n适用于跑酷或部分需要跑跳的场景。", "description.wurst.hack.playeresp": "高亮透视附近的玩家。\n你的好友会显示蓝色框框。", - "description.wurst.hack.playerfinder": "在雷雨中寻找远处的玩家。", "description.wurst.hack.portalgui": "允许你在传送门内打开 GUI。", "description.wurst.hack.potionsaver": "当你站着不动时冻结所有的药水效果时间。", "description.wurst.hack.prophuntesp": "在躲猫猫小游戏中知道哪些是人扮的方块。\n用于 Mineplex 服务器的 Prophunt(躲猫猫),其他服务器未必奏效。", diff --git a/src/main/resources/assets/wurst/lang/zh_hk.json b/src/main/resources/assets/wurst/lang/zh_hk.json index b0d3cff367..895f9b4612 100644 --- a/src/main/resources/assets/wurst/lang/zh_hk.json +++ b/src/main/resources/assets/wurst/lang/zh_hk.json @@ -118,7 +118,6 @@ "description.wurst.hack.panic": "瞬間關閉所有嘅作弊功能。\n請小心使用!", "description.wurst.hack.parkour": "當到方塊邊緣你會自動跳起身。\n適用於跑酷或跳同跑。", "description.wurst.hack.playeresp": "高亮透視附近嘅玩家。\n如果係你嘅好友話會顯示藍色框框。", - "description.wurst.hack.playerfinder": "喺雷雨天中尋找遠處嘅玩家。", "description.wurst.hack.portalgui": "允許你喺傳送門內打開 GUI。", "description.wurst.hack.potionsaver": "當你企住唔郁時凍結所有嘅葯水效果時間。", "description.wurst.hack.prophuntesp": "喺捉依因小游戲中知道邊啲係人扮嘅方塊。\n用於 Mineplex 伺服器嘅 Prophunt(捉依因),其他伺服器未必湊效。", diff --git a/src/main/resources/assets/wurst/lang/zh_tw.json b/src/main/resources/assets/wurst/lang/zh_tw.json index c9470025a0..d50a5d46a1 100644 --- a/src/main/resources/assets/wurst/lang/zh_tw.json +++ b/src/main/resources/assets/wurst/lang/zh_tw.json @@ -124,7 +124,6 @@ "description.wurst.hack.panic": "瞬間關閉所有的作弊功能。\n請小心使用!", "description.wurst.hack.parkour": "你會自動跳躍起來,當到方塊的邊緣。\n適用於跑酷或跳和跑。", "description.wurst.hack.playeresp": "高亮透視附近的玩家。\n如果是你的好友的話會顯示藍色框框。", - "description.wurst.hack.playerfinder": "在雷雨中尋找遠處的玩家。", "description.wurst.hack.portalgui": "允許你在傳送門內打開GUI。", "description.wurst.hack.potionsaver": "當你站著不動時凍結所有的藥水效果時間。", "description.wurst.hack.prophuntesp": "在躲猫猫小遊戲中知道哪些是人扮的方塊。\n用於Mineplex服務器的Prophunt(躲猫猫),其他服務器未必凑效。", From d69b0338d6fbb58a01199fa2460e9537482ce65f Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 10 May 2023 18:00:53 +0200 Subject: [PATCH 085/282] [Wurst-Bot] Update to 1.20-pre1 --- gradle.properties | 8 ++++---- src/main/java/net/wurstclient/WurstClient.java | 2 +- src/main/java/net/wurstclient/hacks/AutoFarmHack.java | 6 +++--- .../java/net/wurstclient/hacks/BaseFinderHack.java | 2 +- .../java/net/wurstclient/hacks/CaveFinderHack.java | 2 +- src/main/java/net/wurstclient/hacks/MobEspHack.java | 2 +- .../java/net/wurstclient/hacks/MobSpawnEspHack.java | 2 +- src/main/java/net/wurstclient/hacks/SearchHack.java | 2 +- src/main/java/net/wurstclient/hacks/TunnellerHack.java | 10 +++++----- .../wurstclient/hacks/chestesp/ChestEspRenderer.java | 4 ++-- .../wurstclient/hacks/newchunks/NewChunksRenderer.java | 2 +- .../java/net/wurstclient/mixin/StatsScreenMixin.java | 2 +- .../java/net/wurstclient/mixin/TitleScreenMixin.java | 2 +- .../net/wurstclient/navigator/NavigatorMainScreen.java | 2 +- src/main/java/net/wurstclient/treebot/Tree.java | 2 +- 15 files changed, 25 insertions(+), 25 deletions(-) diff --git a/gradle.properties b/gradle.properties index 8f6dfb47fa..d652113738 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,15 +4,15 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these at https://fabricmc.net/develop/ and # https://www.curseforge.com/minecraft/mc-mods/fabric-api -minecraft_version=23w18a -yarn_mappings=23w18a+build.1 +minecraft_version=1.20-pre1 +yarn_mappings=1.20-pre1+build.1 loader_version=0.14.19 #Fabric api -fabric_version=0.80.1+1.20 +fabric_version=0.80.2+1.20 # Mod Properties -mod_version = v7.34-MC23w18a +mod_version = v7.34-MC1.20-pre1 maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index 520e1b8f7e..f95a6d3717 100644 --- a/src/main/java/net/wurstclient/WurstClient.java +++ b/src/main/java/net/wurstclient/WurstClient.java @@ -57,7 +57,7 @@ public enum WurstClient public static IMinecraftClient IMC; public static final String VERSION = "7.34"; - public static final String MC_VERSION = "23w18a"; + public static final String MC_VERSION = "1.20-pre1"; private WurstAnalytics analytics; private EventManager eventManager; diff --git a/src/main/java/net/wurstclient/hacks/AutoFarmHack.java b/src/main/java/net/wurstclient/hacks/AutoFarmHack.java index 497c84311c..e932aff76e 100644 --- a/src/main/java/net/wurstclient/hacks/AutoFarmHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoFarmHack.java @@ -527,7 +527,7 @@ private void updateVertexBuffers(List blocksToHarvest, if(greenBuffer != null) greenBuffer.close(); - greenBuffer = new VertexBuffer(VertexBuffer.class_8555.STATIC); + greenBuffer = new VertexBuffer(VertexBuffer.Usage.STATIC); bufferBuilder.begin(VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION); @@ -550,7 +550,7 @@ private void updateVertexBuffers(List blocksToHarvest, if(cyanBuffer != null) cyanBuffer.close(); - cyanBuffer = new VertexBuffer(VertexBuffer.class_8555.STATIC); + cyanBuffer = new VertexBuffer(VertexBuffer.Usage.STATIC); bufferBuilder.begin(VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION); @@ -571,7 +571,7 @@ private void updateVertexBuffers(List blocksToHarvest, if(redBuffer != null) redBuffer.close(); - redBuffer = new VertexBuffer(VertexBuffer.class_8555.STATIC); + redBuffer = new VertexBuffer(VertexBuffer.Usage.STATIC); bufferBuilder.begin(VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION); diff --git a/src/main/java/net/wurstclient/hacks/BaseFinderHack.java b/src/main/java/net/wurstclient/hacks/BaseFinderHack.java index 9b651b428d..fa897ff236 100644 --- a/src/main/java/net/wurstclient/hacks/BaseFinderHack.java +++ b/src/main/java/net/wurstclient/hacks/BaseFinderHack.java @@ -208,7 +208,7 @@ public void onUpdate() if(vertexBuffer != null) vertexBuffer.close(); - vertexBuffer = new VertexBuffer(VertexBuffer.class_8555.STATIC); + vertexBuffer = new VertexBuffer(VertexBuffer.Usage.STATIC); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); diff --git a/src/main/java/net/wurstclient/hacks/CaveFinderHack.java b/src/main/java/net/wurstclient/hacks/CaveFinderHack.java index c4617c819e..43de5ca57d 100644 --- a/src/main/java/net/wurstclient/hacks/CaveFinderHack.java +++ b/src/main/java/net/wurstclient/hacks/CaveFinderHack.java @@ -460,7 +460,7 @@ private void setBufferFromTask() if(vertexBuffer != null) vertexBuffer.close(); - vertexBuffer = new VertexBuffer(VertexBuffer.class_8555.STATIC); + vertexBuffer = new VertexBuffer(VertexBuffer.Usage.STATIC); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); diff --git a/src/main/java/net/wurstclient/hacks/MobEspHack.java b/src/main/java/net/wurstclient/hacks/MobEspHack.java index a0098fda12..e4a588cac6 100644 --- a/src/main/java/net/wurstclient/hacks/MobEspHack.java +++ b/src/main/java/net/wurstclient/hacks/MobEspHack.java @@ -75,7 +75,7 @@ public void onEnable() EVENTS.add(CameraTransformViewBobbingListener.class, this); EVENTS.add(RenderListener.class, this); - mobBox = new VertexBuffer(VertexBuffer.class_8555.STATIC); + mobBox = new VertexBuffer(VertexBuffer.Usage.STATIC); Box bb = new Box(-0.5, 0, -0.5, 0.5, 1, 0.5); RenderUtils.drawOutlinedBox(bb, mobBox); } diff --git a/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java b/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java index db87000350..0678ce5f25 100644 --- a/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java +++ b/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java @@ -335,7 +335,7 @@ private void compileBuffer() if(vertexBuffer != null) vertexBuffer.close(); - vertexBuffer = new VertexBuffer(VertexBuffer.class_8555.STATIC); + vertexBuffer = new VertexBuffer(VertexBuffer.Usage.STATIC); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); diff --git a/src/main/java/net/wurstclient/hacks/SearchHack.java b/src/main/java/net/wurstclient/hacks/SearchHack.java index 7c73cf2333..37ae3ea300 100644 --- a/src/main/java/net/wurstclient/hacks/SearchHack.java +++ b/src/main/java/net/wurstclient/hacks/SearchHack.java @@ -427,7 +427,7 @@ private void setBufferFromTask() if(vertexBuffer != null) vertexBuffer.close(); - vertexBuffer = new VertexBuffer(VertexBuffer.class_8555.STATIC); + vertexBuffer = new VertexBuffer(VertexBuffer.Usage.STATIC); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); diff --git a/src/main/java/net/wurstclient/hacks/TunnellerHack.java b/src/main/java/net/wurstclient/hacks/TunnellerHack.java index 99d473c687..e1368ffac9 100644 --- a/src/main/java/net/wurstclient/hacks/TunnellerHack.java +++ b/src/main/java/net/wurstclient/hacks/TunnellerHack.java @@ -272,7 +272,7 @@ private void updateCyanBuffer() if(vertexBuffers[0] != null) vertexBuffers[0].close(); - vertexBuffers[0] = new VertexBuffer(VertexBuffer.class_8555.STATIC); + vertexBuffers[0] = new VertexBuffer(VertexBuffer.Usage.STATIC); BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; @@ -393,7 +393,7 @@ public void run() if(vertexBuffers[1] != null) vertexBuffers[1].close(); - vertexBuffers[1] = new VertexBuffer(VertexBuffer.class_8555.STATIC); + vertexBuffers[1] = new VertexBuffer(VertexBuffer.Usage.STATIC); BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; @@ -507,7 +507,7 @@ public boolean canRun() if(vertexBuffers[2] != null) vertexBuffers[2].close(); - vertexBuffers[2] = new VertexBuffer(VertexBuffer.class_8555.STATIC); + vertexBuffers[2] = new VertexBuffer(VertexBuffer.Usage.STATIC); BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; @@ -652,7 +652,7 @@ public boolean canRun() if(vertexBuffers[3] != null) vertexBuffers[3].close(); - vertexBuffers[3] = new VertexBuffer(VertexBuffer.class_8555.STATIC); + vertexBuffers[3] = new VertexBuffer(VertexBuffer.Usage.STATIC); BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; @@ -754,7 +754,7 @@ public boolean canRun() if(vertexBuffers[4] != null) vertexBuffers[4].close(); - vertexBuffers[4] = new VertexBuffer(VertexBuffer.class_8555.STATIC); + vertexBuffers[4] = new VertexBuffer(VertexBuffer.Usage.STATIC); BlockPos camPos = RenderUtils.getCameraBlockPos(); int regionX = (camPos.getX() >> 9) * 512; diff --git a/src/main/java/net/wurstclient/hacks/chestesp/ChestEspRenderer.java b/src/main/java/net/wurstclient/hacks/chestesp/ChestEspRenderer.java index afedb68137..ac76608aa0 100644 --- a/src/main/java/net/wurstclient/hacks/chestesp/ChestEspRenderer.java +++ b/src/main/java/net/wurstclient/hacks/chestesp/ChestEspRenderer.java @@ -112,8 +112,8 @@ public void renderLines(ChestEspGroup group) public static void prepareBuffers() { closeBuffers(); - solidBox = new VertexBuffer(VertexBuffer.class_8555.STATIC); - outlinedBox = new VertexBuffer(VertexBuffer.class_8555.STATIC); + solidBox = new VertexBuffer(VertexBuffer.Usage.STATIC); + outlinedBox = new VertexBuffer(VertexBuffer.Usage.STATIC); Box box = new Box(BlockPos.ORIGIN); RenderUtils.drawSolidBox(box, solidBox); diff --git a/src/main/java/net/wurstclient/hacks/newchunks/NewChunksRenderer.java b/src/main/java/net/wurstclient/hacks/newchunks/NewChunksRenderer.java index 16fb0ec55d..04f1913521 100644 --- a/src/main/java/net/wurstclient/hacks/newchunks/NewChunksRenderer.java +++ b/src/main/java/net/wurstclient/hacks/newchunks/NewChunksRenderer.java @@ -41,7 +41,7 @@ public NewChunksRenderer(SliderSetting altitude, SliderSetting opacity, public void updateBuffer(int i, BuiltBuffer buffer) { - vertexBuffers[i] = new VertexBuffer(VertexBuffer.class_8555.STATIC); + vertexBuffers[i] = new VertexBuffer(VertexBuffer.Usage.STATIC); vertexBuffers[i].bind(); vertexBuffers[i].upload(buffer); VertexBuffer.unbind(); diff --git a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java index 187f0eeda4..5297484e74 100644 --- a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java @@ -55,7 +55,7 @@ private void onCreateButtons(CallbackInfo ci) .equals(I18n.translate("gui.done"))) continue; - button.setX(width / 2 + 2); + button.method_46421(width / 2 + 2); button.setWidth(150); } } diff --git a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java index 28488e077b..87f2248691 100644 --- a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java @@ -77,7 +77,7 @@ private void onTick(CallbackInfo ci) // adjust AltManager button if Realms button has been moved // happens when ModMenu is installed - altsButton.setY(realmsButton.getY()); + altsButton.method_46419(realmsButton.getY()); } /** diff --git a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java index 70cd9d694c..723c4d909c 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java @@ -74,7 +74,7 @@ protected void onResize() setFocused(searchBar); searchBar.setFocused(true); - searchBar.setX(middleX - 100); + searchBar.method_46421(middleX - 100); setContentHeight(navigatorDisplayList.size() / 3 * 20); } diff --git a/src/main/java/net/wurstclient/treebot/Tree.java b/src/main/java/net/wurstclient/treebot/Tree.java index b455eb1f26..740b4fece2 100644 --- a/src/main/java/net/wurstclient/treebot/Tree.java +++ b/src/main/java/net/wurstclient/treebot/Tree.java @@ -39,7 +39,7 @@ public void compileBuffer() if(vertexBuffer != null) vertexBuffer.close(); - vertexBuffer = new VertexBuffer(VertexBuffer.class_8555.STATIC); + vertexBuffer = new VertexBuffer(VertexBuffer.Usage.STATIC); int regionX = (stump.getX() >> 9) * 512; int regionZ = (stump.getZ() >> 9) * 512; From f3b0fc2b78dd754b237a74a745fdb5350d67fd88 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 10 May 2023 18:52:42 +0200 Subject: [PATCH 086/282] Update to 1.20-pre1 --- .../mixin/ClientPlayerEntityMixin.java | 27 ++++++++++++------- .../wurstclient/mixin/StatsScreenMixin.java | 2 +- .../wurstclient/mixin/TitleScreenMixin.java | 2 +- .../navigator/NavigatorMainScreen.java | 2 +- src/main/resources/fabric.mod.json | 4 +-- 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/main/java/net/wurstclient/mixin/ClientPlayerEntityMixin.java b/src/main/java/net/wurstclient/mixin/ClientPlayerEntityMixin.java index 005bde80ad..7543aa8ea1 100644 --- a/src/main/java/net/wurstclient/mixin/ClientPlayerEntityMixin.java +++ b/src/main/java/net/wurstclient/mixin/ClientPlayerEntityMixin.java @@ -83,29 +83,28 @@ private boolean wurstIsUsingItem(ClientPlayerEntity player) return player.isUsingItem(); } - @Inject(at = {@At("HEAD")}, method = {"sendMovementPackets()V"}) + @Inject(at = @At("HEAD"), method = "sendMovementPackets()V") private void onSendMovementPacketsHEAD(CallbackInfo ci) { EventManager.fire(PreMotionEvent.INSTANCE); } - @Inject(at = {@At("TAIL")}, method = {"sendMovementPackets()V"}) + @Inject(at = @At("TAIL"), method = "sendMovementPackets()V") private void onSendMovementPacketsTAIL(CallbackInfo ci) { EventManager.fire(PostMotionEvent.INSTANCE); } - @Inject(at = {@At("HEAD")}, - method = { - "move(Lnet/minecraft/entity/MovementType;Lnet/minecraft/util/math/Vec3d;)V"}) + @Inject(at = @At("HEAD"), + method = "move(Lnet/minecraft/entity/MovementType;Lnet/minecraft/util/math/Vec3d;)V") private void onMove(MovementType type, Vec3d offset, CallbackInfo ci) { PlayerMoveEvent event = new PlayerMoveEvent(this); EventManager.fire(event); } - @Inject(at = {@At("HEAD")}, - method = {"isAutoJumpEnabled()Z"}, + @Inject(at = @At("HEAD"), + method = "isAutoJumpEnabled()Z", cancellable = true) private void onIsAutoJumpEnabled(CallbackInfoReturnable cir) { @@ -113,10 +112,14 @@ private void onIsAutoJumpEnabled(CallbackInfoReturnable cir) cir.setReturnValue(false); } + /** + * When PortalGUI is enabled, this mixin temporarily sets the current screen + * to null to prevent the updateNausea() method from closing it. + */ @Inject(at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;currentScreen:Lnet/minecraft/client/gui/screen/Screen;", opcode = Opcodes.GETFIELD, - ordinal = 0), method = {"updateNausea()V"}) + ordinal = 0), method = "updateNausea()V") private void beforeUpdateNausea(CallbackInfo ci) { if(!WurstClient.INSTANCE.getHax().portalGuiHack.isEnabled()) @@ -126,10 +129,14 @@ private void beforeUpdateNausea(CallbackInfo ci) client.currentScreen = null; } + /** + * This mixin restores the current screen as soon as the updateNausea() + * method is done looking at it. + */ @Inject(at = @At(value = "FIELD", - target = "Lnet/minecraft/client/network/ClientPlayerEntity;nextNauseaStrength:F", + target = "Lnet/minecraft/client/network/ClientPlayerEntity;field_44911:F", opcode = Opcodes.GETFIELD, - ordinal = 1), method = {"updateNausea()V"}) + ordinal = 1), method = "updateNausea()V") private void afterUpdateNausea(CallbackInfo ci) { if(tempCurrentScreen == null) diff --git a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java index 5297484e74..187f0eeda4 100644 --- a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java @@ -55,7 +55,7 @@ private void onCreateButtons(CallbackInfo ci) .equals(I18n.translate("gui.done"))) continue; - button.method_46421(width / 2 + 2); + button.setX(width / 2 + 2); button.setWidth(150); } } diff --git a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java index 87f2248691..28488e077b 100644 --- a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java @@ -77,7 +77,7 @@ private void onTick(CallbackInfo ci) // adjust AltManager button if Realms button has been moved // happens when ModMenu is installed - altsButton.method_46419(realmsButton.getY()); + altsButton.setY(realmsButton.getY()); } /** diff --git a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java index 723c4d909c..70cd9d694c 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java @@ -74,7 +74,7 @@ protected void onResize() setFocused(searchBar); searchBar.setFocused(true); - searchBar.method_46421(middleX - 100); + searchBar.setX(middleX - 100); setContentHeight(navigatorDisplayList.size() / 3 * 20); } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 17bdcddd9f..269489163b 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -30,8 +30,8 @@ "depends": { "fabricloader": ">=0.14.19", - "fabric-api": ">=0.80.1", - "minecraft": "~1.20-alpha.23.18.a", + "fabric-api": ">=0.80.2", + "minecraft": "~1.20-beta.1", "java": ">=17" }, "suggests": { From ea90a95413fe30d2c22ff14b510db559fede5b4f Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sat, 13 May 2023 20:50:24 +0200 Subject: [PATCH 087/282] Update JSON syntax check --- .github/workflows/jsonsyntax.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/jsonsyntax.yml b/.github/workflows/jsonsyntax.yml index 6d41358669..1daceaffd9 100644 --- a/.github/workflows/jsonsyntax.yml +++ b/.github/workflows/jsonsyntax.yml @@ -1,6 +1,10 @@ name: JSON syntax on: + push: + branches: [ "master" ] + paths: + - '**.json' pull_request: paths: - '**.json' @@ -9,8 +13,8 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: json-syntax-check - uses: limitusus/json-syntax-check@v1.0.3 + uses: limitusus/json-syntax-check@v2 with: pattern: "\\.json$" From f4716a5a0c75849a3c1010044413a197008cf937 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 14 May 2023 21:16:16 +0200 Subject: [PATCH 088/282] Simplify how AutoFish's valid range is rendered --- .../net/wurstclient/hacks/AutoFishHack.java | 5 ++--- .../hacks/autofish/AutoFishDebugDraw.java | 21 ++++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/AutoFishHack.java b/src/main/java/net/wurstclient/hacks/AutoFishHack.java index e716ecf514..77073b0180 100644 --- a/src/main/java/net/wurstclient/hacks/AutoFishHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoFishHack.java @@ -39,7 +39,8 @@ public final class AutoFishHack extends Hack private int castRodTimer; private int reelInTimer; - private final AutoFishDebugDraw debugDraw = new AutoFishDebugDraw(); + private final AutoFishDebugDraw debugDraw = + new AutoFishDebugDraw(validRange); private final AutoFishRodSelector rodSelector = new AutoFishRodSelector(); private boolean wasOpenWater; @@ -80,8 +81,6 @@ public void onDisable() @Override public void onUpdate() { - debugDraw.updateValidRange(validRange.getValue()); - if(reelInTimer > 0) reelInTimer--; diff --git a/src/main/java/net/wurstclient/hacks/autofish/AutoFishDebugDraw.java b/src/main/java/net/wurstclient/hacks/autofish/AutoFishDebugDraw.java index f34a8a5738..eea9ca1d87 100644 --- a/src/main/java/net/wurstclient/hacks/autofish/AutoFishDebugDraw.java +++ b/src/main/java/net/wurstclient/hacks/autofish/AutoFishDebugDraw.java @@ -30,6 +30,7 @@ import net.wurstclient.settings.CheckboxSetting; import net.wurstclient.settings.ColorSetting; import net.wurstclient.settings.Setting; +import net.wurstclient.settings.SliderSetting; import net.wurstclient.util.RenderUtils; public final class AutoFishDebugDraw @@ -41,8 +42,13 @@ public final class AutoFishDebugDraw private final ColorSetting ddColor = new ColorSetting("DD color", "Color of the debug draw, if enabled.", Color.RED); + private final SliderSetting validRange; private Vec3d lastSoundPos; - private Box validRangeBox; + + public AutoFishDebugDraw(SliderSetting validRange) + { + this.validRange = validRange; + } public Stream getSettings() { @@ -52,13 +58,6 @@ public Stream getSettings() public void reset() { lastSoundPos = null; - validRangeBox = null; - } - - public void updateValidRange(double validRange) - { - validRangeBox = new Box(-validRange, -1 / 16.0, -validRange, validRange, - 1 / 16.0, validRange); } public void updateSoundPos(PlaySoundS2CPacket sound) @@ -85,7 +84,7 @@ public void render(MatrixStack matrixStack, float partialTicks) RenderUtils.applyRegionalRenderOffset(matrixStack, regionX, regionZ); FishingBobberEntity bobber = WurstClient.MC.player.fishHook; - if(bobber != null && validRangeBox != null) + if(bobber != null) drawValidRange(matrixStack, bobber, regionX, regionZ); if(lastSoundPos != null) @@ -109,7 +108,9 @@ private void drawValidRange(MatrixStack matrixStack, float[] colorF = ddColor.getColorF(); RenderSystem.setShaderColor(colorF[0], colorF[1], colorF[2], 0.5F); - RenderUtils.drawOutlinedBox(validRangeBox, matrixStack); + double vr = validRange.getValue(); + Box vrBox = new Box(-vr, -1 / 16.0, -vr, vr, 1 / 16.0, vr); + RenderUtils.drawOutlinedBox(vrBox, matrixStack); matrixStack.pop(); } From c47f8b6bf803147e373e4f15c44c6c2664e8fd76 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 15 May 2023 12:54:48 +0200 Subject: [PATCH 089/282] Use InventoryUtils in AutoFishRodSelector No more scheduled window clicks! --- .../net/wurstclient/hacks/AutoFishHack.java | 10 +---- .../hacks/autofish/AutoFishRodSelector.java | 44 +------------------ .../net/wurstclient/util/InventoryUtils.java | 18 ++++++-- 3 files changed, 18 insertions(+), 54 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/AutoFishHack.java b/src/main/java/net/wurstclient/hacks/AutoFishHack.java index 77073b0180..b2c1c209a6 100644 --- a/src/main/java/net/wurstclient/hacks/AutoFishHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoFishHack.java @@ -84,15 +84,6 @@ public void onUpdate() if(reelInTimer > 0) reelInTimer--; - ClientPlayerEntity player = MC.player; - - if(rodSelector.hasScheduledClick()) - { - rodSelector.doScheduledClick(); - castRodTimer = 15; - return; - } - rodSelector.updateBestRod(); if(!rodSelector.hasARod()) @@ -116,6 +107,7 @@ public void onUpdate() } // cast rod + ClientPlayerEntity player = MC.player; if(player.fishHook == null || player.fishHook.isRemoved()) { rightClick(); diff --git a/src/main/java/net/wurstclient/hacks/autofish/AutoFishRodSelector.java b/src/main/java/net/wurstclient/hacks/autofish/AutoFishRodSelector.java index 5329204eda..50b9d436fe 100644 --- a/src/main/java/net/wurstclient/hacks/autofish/AutoFishRodSelector.java +++ b/src/main/java/net/wurstclient/hacks/autofish/AutoFishRodSelector.java @@ -14,34 +14,19 @@ import net.minecraft.item.FishingRodItem; import net.minecraft.item.ItemStack; import net.wurstclient.WurstClient; -import net.wurstclient.mixinterface.IMinecraftClient; +import net.wurstclient.util.InventoryUtils; public final class AutoFishRodSelector { private static final MinecraftClient MC = WurstClient.MC; - private static final IMinecraftClient IMC = WurstClient.IMC; private int bestRodValue; private int bestRodSlot; - private int scheduledWindowClick; - public void reset() { bestRodValue = -1; bestRodSlot = -1; - scheduledWindowClick = -1; - } - - public boolean hasScheduledClick() - { - return scheduledWindowClick != -1; - } - - public void doScheduledClick() - { - IMC.getInteractionManager().windowClick_PICKUP(scheduledWindowClick); - scheduledWindowClick = -1; } public void updateBestRod() @@ -80,32 +65,7 @@ public boolean isBestRodAlreadySelected() public void selectBestRod() { - PlayerInventory inventory = MC.player.getInventory(); - - if(bestRodSlot < 9) - { - inventory.selectedSlot = bestRodSlot; - return; - } - - int firstEmptySlot = inventory.getEmptySlot(); - - if(firstEmptySlot != -1) - { - if(firstEmptySlot >= 9) - IMC.getInteractionManager() - .windowClick_QUICK_MOVE(36 + inventory.selectedSlot); - - IMC.getInteractionManager().windowClick_QUICK_MOVE(bestRodSlot); - - }else - { - IMC.getInteractionManager().windowClick_PICKUP(bestRodSlot); - IMC.getInteractionManager() - .windowClick_PICKUP(36 + inventory.selectedSlot); - - scheduledWindowClick = -bestRodSlot; - } + InventoryUtils.selectItem(bestRodSlot); } private int getRodValue(ItemStack stack) diff --git a/src/main/java/net/wurstclient/util/InventoryUtils.java b/src/main/java/net/wurstclient/util/InventoryUtils.java index 1968e62541..2a89e5661f 100644 --- a/src/main/java/net/wurstclient/util/InventoryUtils.java +++ b/src/main/java/net/wurstclient/util/InventoryUtils.java @@ -79,7 +79,6 @@ public static boolean selectItem(Predicate predicate, int maxInvSlot, boolean takeFromOffhand) { PlayerInventory inventory = MC.player.getInventory(); - IClientPlayerInteractionManager im = IMC.getInteractionManager(); // create a stream of all slots that we want to search IntStream stream = IntStream.range(0, maxInvSlot); @@ -94,6 +93,21 @@ public static boolean selectItem(Predicate predicate, if(slot == -1) return false; + selectItem(slot); + return true; + } + + /** + * Moves the item in the given slot to {@code inventory.selectedSlot}. + * + * @param slot + * the slot of the item to select + */ + public static void selectItem(int slot) + { + PlayerInventory inventory = MC.player.getInventory(); + IClientPlayerInteractionManager im = IMC.getInteractionManager(); + // if the item is already in the hotbar, just select it if(slot < 9) inventory.selectedSlot = slot; @@ -104,7 +118,5 @@ else if(inventory.getEmptySlot() > -1 && inventory.getEmptySlot() < 9) // otherwise, swap with the currently selected item else im.windowClick_SWAP(slot, inventory.selectedSlot); - - return false; } } From 7108fa627d608096d93ae7da4d64ebd2592ab0bb Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 15 May 2023 14:03:59 +0200 Subject: [PATCH 090/282] Make selectItem(int) validate the slot number --- .../net/wurstclient/util/InventoryUtils.java | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/wurstclient/util/InventoryUtils.java b/src/main/java/net/wurstclient/util/InventoryUtils.java index 2a89e5661f..4c1b6f78d5 100644 --- a/src/main/java/net/wurstclient/util/InventoryUtils.java +++ b/src/main/java/net/wurstclient/util/InventoryUtils.java @@ -89,25 +89,29 @@ public static boolean selectItem(Predicate predicate, int slot = stream.filter(i -> predicate.test(inventory.getStack(i))) .findFirst().orElse(-1); - // if no item was found, return false - if(slot == -1) - return false; - - selectItem(slot); - return true; + return selectItem(slot); } /** - * Moves the item in the given slot to {@code inventory.selectedSlot}. + * Moves the item in the given slot to {@code inventory.selectedSlot}. If + * the given slot is negative, this method will do nothing and return + * {@code false}. * * @param slot * the slot of the item to select + * @return {@code true} if the item was moved. This does not necessarily + * mean that the item is now in the selected slot, it could still be + * on its way there. */ - public static void selectItem(int slot) + public static boolean selectItem(int slot) { PlayerInventory inventory = MC.player.getInventory(); IClientPlayerInteractionManager im = IMC.getInteractionManager(); + // if the slot is negative, abort and return false + if(slot < 0) + return false; + // if the item is already in the hotbar, just select it if(slot < 9) inventory.selectedSlot = slot; @@ -118,5 +122,7 @@ else if(inventory.getEmptySlot() > -1 && inventory.getEmptySlot() < 9) // otherwise, swap with the currently selected item else im.windowClick_SWAP(slot, inventory.selectedSlot); + + return true; } } From 60b14ff7ed5ea3ee652376d6f490b7013183e197 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 15 May 2023 15:25:03 +0200 Subject: [PATCH 091/282] Make AutoFish turning off when it runs out of fishing rods optional --- .../net/wurstclient/hacks/AutoFishHack.java | 25 +++++---- .../hacks/autofish/AutoFishRodSelector.java | 51 ++++++++++++++----- 2 files changed, 53 insertions(+), 23 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/AutoFishHack.java b/src/main/java/net/wurstclient/hacks/AutoFishHack.java index b2c1c209a6..54ec52cf5c 100644 --- a/src/main/java/net/wurstclient/hacks/AutoFishHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoFishHack.java @@ -41,17 +41,28 @@ public final class AutoFishHack extends Hack private final AutoFishDebugDraw debugDraw = new AutoFishDebugDraw(validRange); - private final AutoFishRodSelector rodSelector = new AutoFishRodSelector(); + private final AutoFishRodSelector rodSelector = + new AutoFishRodSelector(this); private boolean wasOpenWater; public AutoFishHack() { super("AutoFish"); - setCategory(Category.OTHER); + addSetting(validRange); debugDraw.getSettings().forEach(this::addSetting); + rodSelector.getSettings().forEach(this::addSetting); + } + + @Override + public String getRenderName() + { + if(!rodSelector.hasARod()) + return getName() + " [out of rods]"; + + return getName(); } @Override @@ -84,15 +95,7 @@ public void onUpdate() if(reelInTimer > 0) reelInTimer--; - rodSelector.updateBestRod(); - - if(!rodSelector.hasARod()) - { - ChatUtils.message("AutoFish has run out of fishing rods."); - setEnabled(false); - return; - } - + // select fishing rod if(!rodSelector.isBestRodAlreadySelected()) { rodSelector.selectBestRod(); diff --git a/src/main/java/net/wurstclient/hacks/autofish/AutoFishRodSelector.java b/src/main/java/net/wurstclient/hacks/autofish/AutoFishRodSelector.java index 50b9d436fe..a8a8733dd0 100644 --- a/src/main/java/net/wurstclient/hacks/autofish/AutoFishRodSelector.java +++ b/src/main/java/net/wurstclient/hacks/autofish/AutoFishRodSelector.java @@ -7,6 +7,8 @@ */ package net.wurstclient.hacks.autofish; +import java.util.stream.Stream; + import net.minecraft.client.MinecraftClient; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.enchantment.Enchantments; @@ -14,28 +16,53 @@ import net.minecraft.item.FishingRodItem; import net.minecraft.item.ItemStack; import net.wurstclient.WurstClient; +import net.wurstclient.hacks.AutoFishHack; +import net.wurstclient.settings.CheckboxSetting; +import net.wurstclient.settings.Setting; +import net.wurstclient.util.ChatUtils; import net.wurstclient.util.InventoryUtils; public final class AutoFishRodSelector { private static final MinecraftClient MC = WurstClient.MC; + private final CheckboxSetting stopWhenOutOfRods = new CheckboxSetting( + "Stop when out of rods", + "If enabled, AutoFish will turn itself off when it runs out of fishing rods.", + false); + + private final AutoFishHack autoFish; private int bestRodValue; private int bestRodSlot; + public AutoFishRodSelector(AutoFishHack autoFish) + { + this.autoFish = autoFish; + } + + public Stream getSettings() + { + return Stream.of(stopWhenOutOfRods); + } + public void reset() { bestRodValue = -1; bestRodSlot = -1; } - public void updateBestRod() + public boolean hasARod() + { + return bestRodSlot != -1; + } + + public boolean isBestRodAlreadySelected() { PlayerInventory inventory = MC.player.getInventory(); int selectedSlot = inventory.selectedSlot; ItemStack selectedStack = inventory.getStack(selectedSlot); - // start with selected rod + // evaluate selected rod (or lack thereof) bestRodValue = getRodValue(selectedStack); bestRodSlot = bestRodValue > -1 ? selectedSlot : -1; @@ -51,20 +78,20 @@ public void updateBestRod() bestRodSlot = slot; } } - } - - public boolean hasARod() - { - return bestRodSlot != -1; - } - - public boolean isBestRodAlreadySelected() - { - return bestRodSlot == MC.player.getInventory().selectedSlot; + + // return true if selected rod is best rod + return bestRodSlot == selectedSlot; } public void selectBestRod() { + if(bestRodSlot == -1 && stopWhenOutOfRods.isChecked()) + { + ChatUtils.message("AutoFish has run out of fishing rods."); + autoFish.setEnabled(false); + return; + } + InventoryUtils.selectItem(bestRodSlot); } From 73e27eabc674b1853d7d41660fd5b3a9ffad113e Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 15 May 2023 16:13:15 +0200 Subject: [PATCH 092/282] Fix InventoryUtils not handling the offhand correctly --- .../net/wurstclient/util/InventoryUtils.java | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/wurstclient/util/InventoryUtils.java b/src/main/java/net/wurstclient/util/InventoryUtils.java index 4c1b6f78d5..02a3aad1ba 100644 --- a/src/main/java/net/wurstclient/util/InventoryUtils.java +++ b/src/main/java/net/wurstclient/util/InventoryUtils.java @@ -118,11 +118,29 @@ public static boolean selectItem(int slot) // if there is an empty slot in the hotbar, shift-click the item there // it will be selected in the next tick else if(inventory.getEmptySlot() > -1 && inventory.getEmptySlot() < 9) - im.windowClick_QUICK_MOVE(slot); + im.windowClick_QUICK_MOVE(toNetworkSlot(slot)); // otherwise, swap with the currently selected item else - im.windowClick_SWAP(slot, inventory.selectedSlot); + im.windowClick_SWAP(toNetworkSlot(slot), inventory.selectedSlot); return true; } + + private static int toNetworkSlot(int slot) + { + // hotbar + if(slot >= 0 && slot < 9) + return slot + 36; + + // armor + if(slot >= 36 && slot < 40) + return 44 - slot; + + // offhand + if(slot == 40) + return 45; + + // everything else + return slot; + } } From 15ce5ab8c8d8b4434d8e38631d7cdeb5087ae7e8 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 15 May 2023 16:23:06 +0200 Subject: [PATCH 093/282] Let AutoFishRodSelector see the offhand slot --- .../wurstclient/hacks/autofish/AutoFishRodSelector.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/wurstclient/hacks/autofish/AutoFishRodSelector.java b/src/main/java/net/wurstclient/hacks/autofish/AutoFishRodSelector.java index a8a8733dd0..7cd13707be 100644 --- a/src/main/java/net/wurstclient/hacks/autofish/AutoFishRodSelector.java +++ b/src/main/java/net/wurstclient/hacks/autofish/AutoFishRodSelector.java @@ -7,6 +7,7 @@ */ package net.wurstclient.hacks.autofish; +import java.util.stream.IntStream; import java.util.stream.Stream; import net.minecraft.client.MinecraftClient; @@ -66,8 +67,12 @@ public boolean isBestRodAlreadySelected() bestRodValue = getRodValue(selectedStack); bestRodSlot = bestRodValue > -1 ? selectedSlot : -1; + // create a stream of all slots that we want to search + IntStream stream = IntStream.range(0, 36); + stream = IntStream.concat(stream, IntStream.of(40)); + // search inventory for better rod - for(int slot = 0; slot < 36; slot++) + for(int slot : stream.toArray()) { ItemStack stack = inventory.getStack(slot); int rodValue = getRodValue(stack); From 8daf38af68e87dd0834d6ba7bb39434ea3613ffd Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 15 May 2023 16:58:34 +0200 Subject: [PATCH 094/282] Interpolate AutoFishDebugDraw --- .../wurstclient/hacks/autofish/AutoFishDebugDraw.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/autofish/AutoFishDebugDraw.java b/src/main/java/net/wurstclient/hacks/autofish/AutoFishDebugDraw.java index eea9ca1d87..469a0388e8 100644 --- a/src/main/java/net/wurstclient/hacks/autofish/AutoFishDebugDraw.java +++ b/src/main/java/net/wurstclient/hacks/autofish/AutoFishDebugDraw.java @@ -31,6 +31,7 @@ import net.wurstclient.settings.ColorSetting; import net.wurstclient.settings.Setting; import net.wurstclient.settings.SliderSetting; +import net.wurstclient.util.EntityUtils; import net.wurstclient.util.RenderUtils; public final class AutoFishDebugDraw @@ -85,7 +86,7 @@ public void render(MatrixStack matrixStack, float partialTicks) FishingBobberEntity bobber = WurstClient.MC.player.fishHook; if(bobber != null) - drawValidRange(matrixStack, bobber, regionX, regionZ); + drawValidRange(matrixStack, partialTicks, bobber, regionX, regionZ); if(lastSoundPos != null) drawLastBite(matrixStack, regionX, regionZ); @@ -98,12 +99,13 @@ public void render(MatrixStack matrixStack, float partialTicks) GL11.glDisable(GL11.GL_BLEND); } - private void drawValidRange(MatrixStack matrixStack, + private void drawValidRange(MatrixStack matrixStack, float partialTicks, FishingBobberEntity bobber, int regionX, int regionZ) { matrixStack.push(); - matrixStack.translate(bobber.getX() - regionX, bobber.getY(), - bobber.getZ() - regionZ); + Vec3d pos = EntityUtils.getLerpedPos(bobber, partialTicks); + matrixStack.translate(pos.getX() - regionX, pos.getY(), + pos.getZ() - regionZ); float[] colorF = ddColor.getColorF(); RenderSystem.setShaderColor(colorF[0], colorF[1], colorF[2], 0.5F); From f0a87b5cd789808d8bb5487c73216595bcba26fa Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 15 May 2023 17:20:15 +0200 Subject: [PATCH 095/282] Fix "Max tokens" description still claiming that stop sequences are broken in oobabooga webui They work fine as of 7eba22f51a3d770e617c9f0c589b830a6c8ed3fb. --- .../net/wurstclient/hacks/autocomplete/ModelSettings.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java b/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java index 9e84ef9c65..701e51b863 100644 --- a/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java +++ b/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java @@ -66,10 +66,7 @@ public boolean isChatModel() "The maximum number of tokens that the model can generate.\n\n" + "Higher values allow the model to predict longer chat messages," + " but also increase the time it takes to generate predictions.\n\n" - + "The default value of 16 is fine for most use cases.\n\n" - + "When using an API that doesn't support stop sequences (like the" - + " oobabooga web UI), higher values will result in a lot of wasted" - + " time and tokens.", + + "The default value of 16 is fine for most use cases.", 16, 1, 100, 1, ValueDisplay.INTEGER); public final SliderSetting temperature = new SliderSetting("Temperature", From a1925741df04db716a68b8755164e0760033697f Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 15 May 2023 18:14:09 +0200 Subject: [PATCH 096/282] Clean up AutoFishHack --- .../net/wurstclient/hacks/AutoFishHack.java | 85 +++++++++---------- 1 file changed, 41 insertions(+), 44 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/AutoFishHack.java b/src/main/java/net/wurstclient/hacks/AutoFishHack.java index 54ec52cf5c..b0dac6679d 100644 --- a/src/main/java/net/wurstclient/hacks/AutoFishHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoFishHack.java @@ -10,8 +10,7 @@ import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.projectile.FishingBobberEntity; -import net.minecraft.item.FishingRodItem; -import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; import net.minecraft.network.packet.s2c.play.PlaySoundS2CPacket; import net.minecraft.sound.SoundEvents; import net.wurstclient.Category; @@ -27,7 +26,9 @@ import net.wurstclient.settings.SliderSetting.ValueDisplay; import net.wurstclient.util.ChatUtils; -@SearchTags({"FishBot", "auto fish", "fish bot", "fishing"}) +@SearchTags({"AutoFishing", "auto fishing", "AutoFisher", "auto fisher", + "AFKFishBot", "afk fish bot", "AFKFishingBot", "afk fishing bot", + "AFKFisherBot", "afk fisher bot"}) public final class AutoFishHack extends Hack implements UpdateListener, PacketInputListener, RenderListener { @@ -36,14 +37,14 @@ public final class AutoFishHack extends Hack + "Increase your range if bites are not being detected, decrease it if other people's bites are being detected as yours.", 1.5, 0.25, 8, 0.25, ValueDisplay.DECIMAL); - private int castRodTimer; - private int reelInTimer; - private final AutoFishDebugDraw debugDraw = new AutoFishDebugDraw(validRange); private final AutoFishRodSelector rodSelector = new AutoFishRodSelector(this); + private int castRodTimer; + private int reelInTimer; + private boolean wasOpenWater; public AutoFishHack() @@ -92,6 +93,9 @@ public void onDisable() @Override public void onUpdate() { + // update timers + if(castRodTimer > 0) + castRodTimer--; if(reelInTimer > 0) reelInTimer--; @@ -102,27 +106,23 @@ public void onUpdate() return; } - // wait for timer - if(castRodTimer > 0) + // if not fishing, cast rod + if(!isFishing()) { - castRodTimer--; - return; - } - - // cast rod - ClientPlayerEntity player = MC.player; - if(player.fishHook == null || player.fishHook.isRemoved()) - { - rightClick(); + if(castRodTimer > 0) + return; + + IMC.rightClick(); castRodTimer = 15; reelInTimer = 1200; + return; } - // reel in after 60s + // otherwise, reel in when it's time if(reelInTimer == 0) { reelInTimer--; - rightClick(); + IMC.rightClick(); castRodTimer = 15; } } @@ -130,10 +130,7 @@ public void onUpdate() @Override public void onReceivedPacket(PacketInputEvent event) { - ClientPlayerEntity player = MC.player; - if(player == null || player.fishHook == null) - return; - + // check packet type if(!(event.getPacket() instanceof PlaySoundS2CPacket)) return; @@ -143,16 +140,26 @@ public void onReceivedPacket(PacketInputEvent event) .equals(sound.getSound().value())) return; + // check if player is fishing + if(!isFishing()) + return; + + // check if player is holding a fishing rod + ClientPlayerEntity player = MC.player; + if(!player.getMainHandStack().isOf(Items.FISHING_ROD)) + return; + debugDraw.updateSoundPos(sound); - // check position + // check sound position FishingBobberEntity bobber = player.fishHook; if(Math.abs(sound.getX() - bobber.getX()) > validRange.getValue() || Math.abs(sound.getZ() - bobber.getZ()) > validRange.getValue()) return; // check open water - boolean isOpenWater = isInOpenWater(bobber); + boolean isOpenWater = ((IFishingBobberEntity)bobber) + .checkOpenWaterAround(bobber.getBlockPos()); if(!isOpenWater && wasOpenWater) { ChatUtils.warning("You are currently fishing in shallow water."); @@ -162,28 +169,11 @@ public void onReceivedPacket(PacketInputEvent event) if(!WURST.getHax().openWaterEspHack.isEnabled()) ChatUtils.message("Use OpenWaterESP to find open water."); } + wasOpenWater = isOpenWater; // catch fish - rightClick(); + reelInTimer = 0; castRodTimer = 15; - wasOpenWater = isOpenWater; - } - - private boolean isInOpenWater(FishingBobberEntity bobber) - { - return ((IFishingBobberEntity)bobber) - .checkOpenWaterAround(bobber.getBlockPos()); - } - - private void rightClick() - { - // check held item - ItemStack stack = MC.player.getInventory().getMainHandStack(); - if(stack.isEmpty() || !(stack.getItem() instanceof FishingRodItem)) - return; - - // right click - IMC.rightClick(); } @Override @@ -191,4 +181,11 @@ public void onRender(MatrixStack matrixStack, float partialTicks) { debugDraw.render(matrixStack, partialTicks); } + + private boolean isFishing() + { + ClientPlayerEntity player = MC.player; + return player != null && player.fishHook != null + && !player.fishHook.isRemoved(); + } } From dd39d597cee99b510b624a546043ff5c047f1731 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Tue, 16 May 2023 12:35:30 +0200 Subject: [PATCH 097/282] Add catchDelay, retryDelay and patience sliders to AutoFish --- .../net/wurstclient/hacks/AutoFishHack.java | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/AutoFishHack.java b/src/main/java/net/wurstclient/hacks/AutoFishHack.java index b0dac6679d..06be48ecd0 100644 --- a/src/main/java/net/wurstclient/hacks/AutoFishHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoFishHack.java @@ -34,9 +34,23 @@ public final class AutoFishHack extends Hack { private final SliderSetting validRange = new SliderSetting("Valid range", "Any bites that occur outside of this range will be ignored.\n\n" - + "Increase your range if bites are not being detected, decrease it if other people's bites are being detected as yours.", + + "Increase your range if bites are not being detected, decrease it" + + " if other people's bites are being detected as yours.", 1.5, 0.25, 8, 0.25, ValueDisplay.DECIMAL); + private final SliderSetting catchDelay = new SliderSetting("Catch delay", + "How long AutoFish will wait after a bite before reeling in.", 0, 0, 60, + 1, ValueDisplay.INTEGER.withSuffix(" ticks")); + + private final SliderSetting retryDelay = new SliderSetting("Retry delay", + "If casting or reeling in the fishing rod fails, this is how long" + + " AutoFish will wait before trying again.", + 15, 0, 100, 1, ValueDisplay.INTEGER.withSuffix(" ticks")); + + private final SliderSetting patience = new SliderSetting("Patience", + "How long AutoFish will wait if it doesn't get a bite before reeling in.", + 60, 10, 120, 1, ValueDisplay.INTEGER.withSuffix("s")); + private final AutoFishDebugDraw debugDraw = new AutoFishDebugDraw(validRange); private final AutoFishRodSelector rodSelector = @@ -53,6 +67,9 @@ public AutoFishHack() setCategory(Category.OTHER); addSetting(validRange); + addSetting(catchDelay); + addSetting(retryDelay); + addSetting(patience); debugDraw.getSettings().forEach(this::addSetting); rodSelector.getSettings().forEach(this::addSetting); } @@ -113,17 +130,17 @@ public void onUpdate() return; IMC.rightClick(); - castRodTimer = 15; - reelInTimer = 1200; + castRodTimer = retryDelay.getValueI(); + reelInTimer = 20 * patience.getValueI(); return; } // otherwise, reel in when it's time if(reelInTimer == 0) { - reelInTimer--; IMC.rightClick(); - castRodTimer = 15; + reelInTimer = retryDelay.getValueI(); + castRodTimer = retryDelay.getValueI(); } } @@ -172,8 +189,7 @@ public void onReceivedPacket(PacketInputEvent event) wasOpenWater = isOpenWater; // catch fish - reelInTimer = 0; - castRodTimer = 15; + reelInTimer = catchDelay.getValueI(); } @Override From 58250ee900dd7768f4b85e28dca49ea7594b4e9c Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Tue, 16 May 2023 17:01:23 +0200 Subject: [PATCH 098/282] Make AutoFish's shallow water warning optional --- .../net/wurstclient/hacks/AutoFishHack.java | 30 +++------- .../autofish/ShallowWaterWarningCheckbox.java | 56 +++++++++++++++++++ 2 files changed, 65 insertions(+), 21 deletions(-) create mode 100644 src/main/java/net/wurstclient/hacks/autofish/ShallowWaterWarningCheckbox.java diff --git a/src/main/java/net/wurstclient/hacks/AutoFishHack.java b/src/main/java/net/wurstclient/hacks/AutoFishHack.java index 06be48ecd0..1c8113e237 100644 --- a/src/main/java/net/wurstclient/hacks/AutoFishHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoFishHack.java @@ -21,10 +21,9 @@ import net.wurstclient.hack.Hack; import net.wurstclient.hacks.autofish.AutoFishDebugDraw; import net.wurstclient.hacks.autofish.AutoFishRodSelector; -import net.wurstclient.mixinterface.IFishingBobberEntity; +import net.wurstclient.hacks.autofish.ShallowWaterWarningCheckbox; import net.wurstclient.settings.SliderSetting; import net.wurstclient.settings.SliderSetting.ValueDisplay; -import net.wurstclient.util.ChatUtils; @SearchTags({"AutoFishing", "auto fishing", "AutoFisher", "auto fisher", "AFKFishBot", "afk fish bot", "AFKFishingBot", "afk fishing bot", @@ -51,6 +50,9 @@ public final class AutoFishHack extends Hack "How long AutoFish will wait if it doesn't get a bite before reeling in.", 60, 10, 120, 1, ValueDisplay.INTEGER.withSuffix("s")); + private final ShallowWaterWarningCheckbox shallowWaterWarning = + new ShallowWaterWarningCheckbox(); + private final AutoFishDebugDraw debugDraw = new AutoFishDebugDraw(validRange); private final AutoFishRodSelector rodSelector = @@ -59,8 +61,6 @@ public final class AutoFishHack extends Hack private int castRodTimer; private int reelInTimer; - private boolean wasOpenWater; - public AutoFishHack() { super("AutoFish"); @@ -72,6 +72,7 @@ public AutoFishHack() addSetting(patience); debugDraw.getSettings().forEach(this::addSetting); rodSelector.getSettings().forEach(this::addSetting); + addSetting(shallowWaterWarning); } @Override @@ -89,10 +90,10 @@ public void onEnable() WURST.getHax().airPlaceHack.setEnabled(false); castRodTimer = 0; - reelInTimer = -1; + reelInTimer = 0; rodSelector.reset(); debugDraw.reset(); - wasOpenWater = true; + shallowWaterWarning.reset(); EVENTS.add(UpdateListener.class, this); EVENTS.add(PacketInputListener.class, this); @@ -148,11 +149,10 @@ public void onUpdate() public void onReceivedPacket(PacketInputEvent event) { // check packet type - if(!(event.getPacket() instanceof PlaySoundS2CPacket)) + if(!(event.getPacket() instanceof PlaySoundS2CPacket sound)) return; // check sound type - PlaySoundS2CPacket sound = (PlaySoundS2CPacket)event.getPacket(); if(!SoundEvents.ENTITY_FISHING_BOBBER_SPLASH .equals(sound.getSound().value())) return; @@ -174,19 +174,7 @@ public void onReceivedPacket(PacketInputEvent event) || Math.abs(sound.getZ() - bobber.getZ()) > validRange.getValue()) return; - // check open water - boolean isOpenWater = ((IFishingBobberEntity)bobber) - .checkOpenWaterAround(bobber.getBlockPos()); - if(!isOpenWater && wasOpenWater) - { - ChatUtils.warning("You are currently fishing in shallow water."); - ChatUtils.message( - "You can't get any treasure items while fishing like this."); - - if(!WURST.getHax().openWaterEspHack.isEnabled()) - ChatUtils.message("Use OpenWaterESP to find open water."); - } - wasOpenWater = isOpenWater; + shallowWaterWarning.checkWaterAround(bobber); // catch fish reelInTimer = catchDelay.getValueI(); diff --git a/src/main/java/net/wurstclient/hacks/autofish/ShallowWaterWarningCheckbox.java b/src/main/java/net/wurstclient/hacks/autofish/ShallowWaterWarningCheckbox.java new file mode 100644 index 0000000000..849324d59d --- /dev/null +++ b/src/main/java/net/wurstclient/hacks/autofish/ShallowWaterWarningCheckbox.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.hacks.autofish; + +import net.minecraft.entity.projectile.FishingBobberEntity; +import net.wurstclient.WurstClient; +import net.wurstclient.mixinterface.IFishingBobberEntity; +import net.wurstclient.settings.CheckboxSetting; +import net.wurstclient.util.ChatUtils; + +public class ShallowWaterWarningCheckbox extends CheckboxSetting +{ + private boolean hasAlreadyWarned; + + public ShallowWaterWarningCheckbox() + { + super("Shallow water warning", + "Displays a warning message in chat when you are fishing in shallow" + + " water.", + true); + } + + public void reset() + { + hasAlreadyWarned = false; + } + + public void checkWaterAround(FishingBobberEntity bobber) + { + boolean isOpenWater = ((IFishingBobberEntity)bobber) + .checkOpenWaterAround(bobber.getBlockPos()); + + if(isOpenWater) + { + hasAlreadyWarned = false; + return; + } + + if(isChecked() && !hasAlreadyWarned) + { + ChatUtils.warning("You are currently fishing in shallow water."); + ChatUtils.message( + "You can't get any treasure items while fishing like this."); + + if(!WurstClient.INSTANCE.getHax().openWaterEspHack.isEnabled()) + ChatUtils.message("Use OpenWaterESP to find open water."); + + hasAlreadyWarned = true; + } + } +} From ea850de15d038e284d83835693bd8360c3a10a99 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Tue, 16 May 2023 18:21:28 +0200 Subject: [PATCH 099/282] [Wurst-Bot] Update to 1.20-pre2 --- gradle.properties | 8 ++++---- src/main/java/net/wurstclient/WurstClient.java | 2 +- src/main/java/net/wurstclient/mixin/StatsScreenMixin.java | 2 +- src/main/java/net/wurstclient/mixin/TitleScreenMixin.java | 2 +- .../net/wurstclient/navigator/NavigatorMainScreen.java | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gradle.properties b/gradle.properties index d652113738..bad34618c5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,15 +4,15 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these at https://fabricmc.net/develop/ and # https://www.curseforge.com/minecraft/mc-mods/fabric-api -minecraft_version=1.20-pre1 -yarn_mappings=1.20-pre1+build.1 +minecraft_version=1.20-pre2 +yarn_mappings=1.20-pre2+build.1 loader_version=0.14.19 #Fabric api -fabric_version=0.80.2+1.20 +fabric_version=0.81.2+1.20 # Mod Properties -mod_version = v7.34-MC1.20-pre1 +mod_version = v7.34-MC1.20-pre2 maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index f95a6d3717..762d7e325a 100644 --- a/src/main/java/net/wurstclient/WurstClient.java +++ b/src/main/java/net/wurstclient/WurstClient.java @@ -57,7 +57,7 @@ public enum WurstClient public static IMinecraftClient IMC; public static final String VERSION = "7.34"; - public static final String MC_VERSION = "1.20-pre1"; + public static final String MC_VERSION = "1.20-pre2"; private WurstAnalytics analytics; private EventManager eventManager; diff --git a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java index 187f0eeda4..5297484e74 100644 --- a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java @@ -55,7 +55,7 @@ private void onCreateButtons(CallbackInfo ci) .equals(I18n.translate("gui.done"))) continue; - button.setX(width / 2 + 2); + button.method_46421(width / 2 + 2); button.setWidth(150); } } diff --git a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java index 28488e077b..87f2248691 100644 --- a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java @@ -77,7 +77,7 @@ private void onTick(CallbackInfo ci) // adjust AltManager button if Realms button has been moved // happens when ModMenu is installed - altsButton.setY(realmsButton.getY()); + altsButton.method_46419(realmsButton.getY()); } /** diff --git a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java index 70cd9d694c..723c4d909c 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java @@ -74,7 +74,7 @@ protected void onResize() setFocused(searchBar); searchBar.setFocused(true); - searchBar.setX(middleX - 100); + searchBar.method_46421(middleX - 100); setContentHeight(navigatorDisplayList.size() / 3 * 20); } From 621eb72afa0f147e432d6d2cc40b3d97b6a9ac8b Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Tue, 16 May 2023 18:41:26 +0200 Subject: [PATCH 100/282] Update to 1.20-pre2 --- .../java/net/wurstclient/mixin/ClientPlayerEntityMixin.java | 2 +- src/main/java/net/wurstclient/mixin/StatsScreenMixin.java | 2 +- src/main/java/net/wurstclient/mixin/TitleScreenMixin.java | 2 +- .../java/net/wurstclient/navigator/NavigatorMainScreen.java | 2 +- src/main/resources/fabric.mod.json | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/wurstclient/mixin/ClientPlayerEntityMixin.java b/src/main/java/net/wurstclient/mixin/ClientPlayerEntityMixin.java index 7543aa8ea1..0f3351b507 100644 --- a/src/main/java/net/wurstclient/mixin/ClientPlayerEntityMixin.java +++ b/src/main/java/net/wurstclient/mixin/ClientPlayerEntityMixin.java @@ -134,7 +134,7 @@ private void beforeUpdateNausea(CallbackInfo ci) * method is done looking at it. */ @Inject(at = @At(value = "FIELD", - target = "Lnet/minecraft/client/network/ClientPlayerEntity;field_44911:F", + target = "Lnet/minecraft/client/network/ClientPlayerEntity;nauseaIntensity:F", opcode = Opcodes.GETFIELD, ordinal = 1), method = "updateNausea()V") private void afterUpdateNausea(CallbackInfo ci) diff --git a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java index 5297484e74..187f0eeda4 100644 --- a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java @@ -55,7 +55,7 @@ private void onCreateButtons(CallbackInfo ci) .equals(I18n.translate("gui.done"))) continue; - button.method_46421(width / 2 + 2); + button.setX(width / 2 + 2); button.setWidth(150); } } diff --git a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java index 87f2248691..28488e077b 100644 --- a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java @@ -77,7 +77,7 @@ private void onTick(CallbackInfo ci) // adjust AltManager button if Realms button has been moved // happens when ModMenu is installed - altsButton.method_46419(realmsButton.getY()); + altsButton.setY(realmsButton.getY()); } /** diff --git a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java index 723c4d909c..70cd9d694c 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java @@ -74,7 +74,7 @@ protected void onResize() setFocused(searchBar); searchBar.setFocused(true); - searchBar.method_46421(middleX - 100); + searchBar.setX(middleX - 100); setContentHeight(navigatorDisplayList.size() / 3 * 20); } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 269489163b..535036d121 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -30,8 +30,8 @@ "depends": { "fabricloader": ">=0.14.19", - "fabric-api": ">=0.80.2", - "minecraft": "~1.20-beta.1", + "fabric-api": ">=0.81.2", + "minecraft": "~1.20-beta.2", "java": ">=17" }, "suggests": { From 8ec62e72d057865ea7cdc72fb6e24ce120ba157c Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Thu, 18 May 2023 22:26:42 +0200 Subject: [PATCH 101/282] Add option to turn off AutoFish when inventory is full --- .../net/wurstclient/hacks/AutoFishHack.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/java/net/wurstclient/hacks/AutoFishHack.java b/src/main/java/net/wurstclient/hacks/AutoFishHack.java index 1c8113e237..6e4fe10204 100644 --- a/src/main/java/net/wurstclient/hacks/AutoFishHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoFishHack.java @@ -22,8 +22,10 @@ import net.wurstclient.hacks.autofish.AutoFishDebugDraw; import net.wurstclient.hacks.autofish.AutoFishRodSelector; import net.wurstclient.hacks.autofish.ShallowWaterWarningCheckbox; +import net.wurstclient.settings.CheckboxSetting; import net.wurstclient.settings.SliderSetting; import net.wurstclient.settings.SliderSetting.ValueDisplay; +import net.wurstclient.util.ChatUtils; @SearchTags({"AutoFishing", "auto fishing", "AutoFisher", "auto fisher", "AFKFishBot", "afk fish bot", "AFKFishingBot", "afk fishing bot", @@ -50,6 +52,11 @@ public final class AutoFishHack extends Hack "How long AutoFish will wait if it doesn't get a bite before reeling in.", 60, 10, 120, 1, ValueDisplay.INTEGER.withSuffix("s")); + private final CheckboxSetting stopWhenInvFull = new CheckboxSetting( + "Stop when inv full", + "If enabled, AutoFish will turn itself off when your inventory is full.", + false); + private final ShallowWaterWarningCheckbox shallowWaterWarning = new ShallowWaterWarningCheckbox(); @@ -72,6 +79,7 @@ public AutoFishHack() addSetting(patience); debugDraw.getSettings().forEach(this::addSetting); rodSelector.getSettings().forEach(this::addSetting); + addSetting(stopWhenInvFull); addSetting(shallowWaterWarning); } @@ -117,6 +125,16 @@ public void onUpdate() if(reelInTimer > 0) reelInTimer--; + // check if inventory is full + if(stopWhenInvFull.isChecked() + && MC.player.getInventory().getEmptySlot() == -1) + { + ChatUtils.message( + "AutoFish has stopped because your inventory is full."); + setEnabled(false); + return; + } + // select fishing rod if(!rodSelector.isBestRodAlreadySelected()) { From bb00afa3ab1ca446dd6c23cd158db3c8b4a327f1 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Thu, 18 May 2023 22:38:45 +0200 Subject: [PATCH 102/282] Change version to 7.35 --- gradle.properties | 2 +- src/main/java/net/wurstclient/WurstClient.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 5ef3bc12ae..6b47e69f35 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ loader_version=0.14.19 fabric_version=0.80.0+1.19.4 # Mod Properties -mod_version = v7.34-MC1.19.4 +mod_version = v7.35-MC1.19.4 maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index 443d865010..fe5abe63b6 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 MinecraftClient MC; public static IMinecraftClient IMC; - public static final String VERSION = "7.34"; + public static final String VERSION = "7.35"; public static final String MC_VERSION = "1.19.4"; private WurstAnalytics analytics; From f0064f433be62be557039ab1b896711f539b8b55 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Fri, 19 May 2023 00:45:51 +0200 Subject: [PATCH 103/282] Use OverlayRenderer in AutoLibrarianHack --- .../wurstclient/hacks/AutoLibrarianHack.java | 58 +++---------------- 1 file changed, 7 insertions(+), 51 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/AutoLibrarianHack.java b/src/main/java/net/wurstclient/hacks/AutoLibrarianHack.java index 33a8610d79..08534e16f3 100644 --- a/src/main/java/net/wurstclient/hacks/AutoLibrarianHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoLibrarianHack.java @@ -51,15 +51,9 @@ import net.wurstclient.settings.CheckboxSetting; import net.wurstclient.settings.SliderSetting; import net.wurstclient.settings.SliderSetting.ValueDisplay; -import net.wurstclient.util.BlockBreaker; +import net.wurstclient.util.*; import net.wurstclient.util.BlockBreaker.BlockBreakingParams; -import net.wurstclient.util.BlockPlacer; import net.wurstclient.util.BlockPlacer.BlockPlacingParams; -import net.wurstclient.util.BlockUtils; -import net.wurstclient.util.ChatUtils; -import net.wurstclient.util.InventoryUtils; -import net.wurstclient.util.RenderUtils; -import net.wurstclient.util.RotationUtils; @SearchTags({"auto librarian", "AutoVillager", "auto villager", "VillagerTrainer", "villager trainer", "LibrarianTrainer", @@ -104,6 +98,7 @@ public final class AutoLibrarianHack extends Hack + "Can be adjusted from 0 (off) to 100.", 1, 0, 100, 1, ValueDisplay.INTEGER.withLabel(0, "off")); + private final OverlayRenderer overlay = new OverlayRenderer(); private final HashSet experiencedVillagers = new HashSet<>(); @@ -112,8 +107,6 @@ public final class AutoLibrarianHack extends Hack private boolean placingJobSite; private boolean breakingJobSite; - private float progress; - private float prevProgress; public AutoLibrarianHack() { @@ -148,8 +141,7 @@ protected void onDisable() breakingJobSite = false; } - progress = 0; - prevProgress = 0; + overlay.resetProgress(); villager = null; jobSite = null; placingJobSite = false; @@ -290,19 +282,7 @@ private void breakJobSite() swingHand.getSelected().swing(Hand.MAIN_HAND); // update progress - if(MC.player.getAbilities().creativeMode - || BlockUtils.getHardness(jobSite) >= 1) - { - progress = 1; - prevProgress = 1; - return; - } - - prevProgress = progress; - progress = IMC.getInteractionManager().getCurrentBreakingProgress(); - - if(progress < prevProgress) - prevProgress = progress; + overlay.updateProgress(); } private void placeJobSite() @@ -550,38 +530,14 @@ public void onRender(MatrixStack matrixStack, float partialTicks) RenderUtils.drawCrossBox(box, matrixStack); } - if(breakingJobSite && jobSite != null) - { - matrixStack.push(); - - Box box = new Box(BlockPos.ORIGIN); - float p = prevProgress + (progress - prevProgress) * partialTicks; - float red = p * 2F; - float green = 2 - red; - - matrixStack.translate(jobSite.getX() - regionX, jobSite.getY(), - jobSite.getZ() - regionZ); - if(p < 1) - { - matrixStack.translate(0.5, 0.5, 0.5); - matrixStack.scale(p, p, p); - matrixStack.translate(-0.5, -0.5, -0.5); - } - - RenderSystem.setShaderColor(red, green, 0, 0.25F); - RenderUtils.drawSolidBox(box, matrixStack); - - RenderSystem.setShaderColor(red, green, 0, 0.5F); - RenderUtils.drawOutlinedBox(box, matrixStack); - - matrixStack.pop(); - } - matrixStack.pop(); // GL resets RenderSystem.setShaderColor(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); + + if(breakingJobSite) + overlay.render(matrixStack, partialTicks, jobSite); } } From 4fa783dd6f1956f1b1bcf0a320de68e78f87e3ef Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Fri, 19 May 2023 13:40:27 +0200 Subject: [PATCH 104/282] Use square & ceil helpers for AutoFarm range --- src/main/java/net/wurstclient/hacks/AutoFarmHack.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/AutoFarmHack.java b/src/main/java/net/wurstclient/hacks/AutoFarmHack.java index 4b1de48bca..de28b62746 100644 --- a/src/main/java/net/wurstclient/hacks/AutoFarmHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoFarmHack.java @@ -120,8 +120,8 @@ public void onUpdate() currentBlock = null; Vec3d eyesVec = RotationUtils.getEyesPos().subtract(0.5, 0.5, 0.5); BlockPos eyesBlock = BlockPos.ofFloored(RotationUtils.getEyesPos()); - double rangeSq = Math.pow(range.getValue(), 2); - int blockRange = (int)Math.ceil(range.getValue()); + double rangeSq = range.getValueSq(); + int blockRange = range.getValueCeil(); List blocks = getBlockStream(eyesBlock, blockRange) .filter(pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos)) <= rangeSq) From e370b9e46feaddeaa7ab40b625499bba50d03933 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Fri, 19 May 2023 17:08:41 +0200 Subject: [PATCH 105/282] Update Fabric API --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 6b47e69f35..747a5ca97f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ yarn_mappings=1.19.4+build.2 loader_version=0.14.19 #Fabric api -fabric_version=0.80.0+1.19.4 +fabric_version=0.81.1+1.19.4 # Mod Properties mod_version = v7.35-MC1.19.4 From 96947a11675762ac1f08df49e4c1a43fb59f0ac9 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Fri, 19 May 2023 17:14:23 +0200 Subject: [PATCH 106/282] [Wurst-Bot] Update to 1.20-pre3 --- gradle.properties | 6 +++--- src/main/java/net/wurstclient/WurstClient.java | 2 +- src/main/java/net/wurstclient/mixin/StatsScreenMixin.java | 2 +- src/main/java/net/wurstclient/mixin/TitleScreenMixin.java | 2 +- .../java/net/wurstclient/navigator/NavigatorMainScreen.java | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gradle.properties b/gradle.properties index 1f7d524f76..0a70294644 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,15 +4,15 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these at https://fabricmc.net/develop/ and # https://www.curseforge.com/minecraft/mc-mods/fabric-api -minecraft_version=1.20-pre2 -yarn_mappings=1.20-pre2+build.1 +minecraft_version=1.20-pre3 +yarn_mappings=1.20-pre3+build.1 loader_version=0.14.19 #Fabric api fabric_version=0.81.2+1.20 # Mod Properties -mod_version = v7.35-MC1.20-pre2 +mod_version = v7.35-MC1.20-pre3 maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index fbd080d4e3..5d4910491b 100644 --- a/src/main/java/net/wurstclient/WurstClient.java +++ b/src/main/java/net/wurstclient/WurstClient.java @@ -57,7 +57,7 @@ public enum WurstClient public static IMinecraftClient IMC; public static final String VERSION = "7.35"; - public static final String MC_VERSION = "1.20-pre2"; + public static final String MC_VERSION = "1.20-pre3"; private WurstAnalytics analytics; private EventManager eventManager; diff --git a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java index 187f0eeda4..5297484e74 100644 --- a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java @@ -55,7 +55,7 @@ private void onCreateButtons(CallbackInfo ci) .equals(I18n.translate("gui.done"))) continue; - button.setX(width / 2 + 2); + button.method_46421(width / 2 + 2); button.setWidth(150); } } diff --git a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java index 28488e077b..87f2248691 100644 --- a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java @@ -77,7 +77,7 @@ private void onTick(CallbackInfo ci) // adjust AltManager button if Realms button has been moved // happens when ModMenu is installed - altsButton.setY(realmsButton.getY()); + altsButton.method_46419(realmsButton.getY()); } /** diff --git a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java index 70cd9d694c..723c4d909c 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java @@ -74,7 +74,7 @@ protected void onResize() setFocused(searchBar); searchBar.setFocused(true); - searchBar.setX(middleX - 100); + searchBar.method_46421(middleX - 100); setContentHeight(navigatorDisplayList.size() / 3 * 20); } From ac184744ca45890eaf6ca31baf93cf49fd27da66 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Fri, 19 May 2023 17:21:06 +0200 Subject: [PATCH 107/282] Update to 1.20-pre3 --- src/main/java/net/wurstclient/mixin/StatsScreenMixin.java | 2 +- src/main/java/net/wurstclient/mixin/TitleScreenMixin.java | 2 +- .../java/net/wurstclient/navigator/NavigatorMainScreen.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java index 5297484e74..187f0eeda4 100644 --- a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java @@ -55,7 +55,7 @@ private void onCreateButtons(CallbackInfo ci) .equals(I18n.translate("gui.done"))) continue; - button.method_46421(width / 2 + 2); + button.setX(width / 2 + 2); button.setWidth(150); } } diff --git a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java index 87f2248691..28488e077b 100644 --- a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java @@ -77,7 +77,7 @@ private void onTick(CallbackInfo ci) // adjust AltManager button if Realms button has been moved // happens when ModMenu is installed - altsButton.method_46419(realmsButton.getY()); + altsButton.setY(realmsButton.getY()); } /** diff --git a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java index 723c4d909c..70cd9d694c 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java @@ -74,7 +74,7 @@ protected void onResize() setFocused(searchBar); searchBar.setFocused(true); - searchBar.method_46421(middleX - 100); + searchBar.setX(middleX - 100); setContentHeight(navigatorDisplayList.size() / 3 * 20); } From 14cdb81a21ab8f699ee22c2fe37df4c87999be7f Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Fri, 19 May 2023 17:23:27 +0200 Subject: [PATCH 108/282] [Wurst-Bot] Update to 1.20-pre4 --- gradle.properties | 6 +++--- src/main/java/net/wurstclient/WurstClient.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 0a70294644..53c8cdee2a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,15 +4,15 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these at https://fabricmc.net/develop/ and # https://www.curseforge.com/minecraft/mc-mods/fabric-api -minecraft_version=1.20-pre3 -yarn_mappings=1.20-pre3+build.1 +minecraft_version=1.20-pre4 +yarn_mappings=1.20-pre4+build.2 loader_version=0.14.19 #Fabric api fabric_version=0.81.2+1.20 # Mod Properties -mod_version = v7.35-MC1.20-pre3 +mod_version = v7.35-MC1.20-pre4 maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index 5d4910491b..43d659cd26 100644 --- a/src/main/java/net/wurstclient/WurstClient.java +++ b/src/main/java/net/wurstclient/WurstClient.java @@ -57,7 +57,7 @@ public enum WurstClient public static IMinecraftClient IMC; public static final String VERSION = "7.35"; - public static final String MC_VERSION = "1.20-pre3"; + public static final String MC_VERSION = "1.20-pre4"; private WurstAnalytics analytics; private EventManager eventManager; From 880809f0c39323df926648c1a5f1db66e95b198d Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sat, 20 May 2023 21:16:48 +0200 Subject: [PATCH 109/282] Use OverlayRenderer in AutoFarmHack --- .../net/wurstclient/hacks/AutoFarmHack.java | 70 +++++-------------- .../net/wurstclient/util/OverlayRenderer.java | 5 +- 2 files changed, 18 insertions(+), 57 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/AutoFarmHack.java b/src/main/java/net/wurstclient/hacks/AutoFarmHack.java index de28b62746..3be8ee1ce9 100644 --- a/src/main/java/net/wurstclient/hacks/AutoFarmHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoFarmHack.java @@ -49,6 +49,7 @@ import net.wurstclient.settings.SliderSetting.ValueDisplay; import net.wurstclient.util.BlockBreaker; import net.wurstclient.util.BlockUtils; +import net.wurstclient.util.OverlayRenderer; import net.wurstclient.util.RenderUtils; import net.wurstclient.util.RotationUtils; @@ -66,9 +67,8 @@ public final class AutoFarmHack extends Hack private final ArrayDeque> prevBlocks = new ArrayDeque<>(); private BlockPos currentBlock; - private float progress; - private float prevProgress; + private final OverlayRenderer overlay = new OverlayRenderer(); private VertexBuffer greenBuffer; private VertexBuffer cyanBuffer; private VertexBuffer redBuffer; @@ -107,6 +107,7 @@ public void onDisable() } prevBlocks.clear(); + overlay.resetProgress(); busy = false; Stream.of(greenBuffer, cyanBuffer, redBuffer).filter(Objects::nonNull) @@ -187,9 +188,6 @@ private List getBlocksToReplant(Vec3d eyesVec, BlockPos eyesBlock, @Override public void onRender(MatrixStack matrixStack, float partialTicks) { - if(WurstClient.MC.getBlockEntityRenderDispatcher().camera == null) - return; - // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); @@ -232,39 +230,14 @@ public void onRender(MatrixStack matrixStack, float partialTicks) VertexBuffer.unbind(); } - if(currentBlock != null) - { - matrixStack.push(); - - Box box = new Box(BlockPos.ORIGIN); - float p = prevProgress + (progress - prevProgress) * partialTicks; - float red = p * 2F; - float green = 2 - red; - - matrixStack.translate(currentBlock.getX() - regionX, - currentBlock.getY(), currentBlock.getZ() - regionZ); - if(p < 1) - { - matrixStack.translate(0.5, 0.5, 0.5); - matrixStack.scale(p, p, p); - matrixStack.translate(-0.5, -0.5, -0.5); - } - - RenderSystem.setShaderColor(red, green, 0, 0.25F); - RenderUtils.drawSolidBox(box, matrixStack); - - RenderSystem.setShaderColor(red, green, 0, 0.5F); - RenderUtils.drawOutlinedBox(box, matrixStack); - - matrixStack.pop(); - } - matrixStack.pop(); // GL resets RenderSystem.setShaderColor(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); + + overlay.render(matrixStack, partialTicks, currentBlock); } private Stream getBlockStream(BlockPos center, int range) @@ -467,23 +440,21 @@ private void harvest(List blocksToHarvest) { if(MC.player.getAbilities().creativeMode) { - Stream stream3 = blocksToHarvest.parallelStream(); + Stream stream = blocksToHarvest.parallelStream(); for(Set set : prevBlocks) - stream3 = stream3.filter(pos -> !set.contains(pos)); - List blocksToHarvest2 = - stream3.collect(Collectors.toList()); + stream = stream.filter(pos -> !set.contains(pos)); + List filteredBlocks = stream.collect(Collectors.toList()); - prevBlocks.addLast(new HashSet<>(blocksToHarvest2)); + prevBlocks.addLast(new HashSet<>(filteredBlocks)); while(prevBlocks.size() > 5) prevBlocks.removeFirst(); - if(!blocksToHarvest2.isEmpty()) - currentBlock = blocksToHarvest2.get(0); + if(!filteredBlocks.isEmpty()) + currentBlock = filteredBlocks.get(0); MC.interactionManager.cancelBlockBreaking(); - progress = 1; - prevProgress = 1; - BlockBreaker.breakBlocksWithPacketSpam(blocksToHarvest2); + overlay.resetProgress(); + BlockBreaker.breakBlocksWithPacketSpam(filteredBlocks); return; } @@ -498,18 +469,9 @@ private void harvest(List blocksToHarvest) MC.interactionManager.cancelBlockBreaking(); if(currentBlock != null && BlockUtils.getHardness(currentBlock) < 1) - { - prevProgress = progress; - progress = IMC.getInteractionManager().getCurrentBreakingProgress(); - - if(progress < prevProgress) - prevProgress = progress; - - }else - { - progress = 1; - prevProgress = 1; - } + overlay.updateProgress(); + else + overlay.resetProgress(); } private void updateVertexBuffers(List blocksToHarvest, diff --git a/src/main/java/net/wurstclient/util/OverlayRenderer.java b/src/main/java/net/wurstclient/util/OverlayRenderer.java index a11ab18941..7463568630 100644 --- a/src/main/java/net/wurstclient/util/OverlayRenderer.java +++ b/src/main/java/net/wurstclient/util/OverlayRenderer.java @@ -74,9 +74,8 @@ public void render(MatrixStack matrixStack, float partialTicks, pos.getZ() - regionZ); // get interpolated progress - boolean breaksInstantly = (MC.player.getAbilities().creativeMode - || BlockUtils.getHardness(pos) >= 1) - && BlockUtils.canBeClicked(pos); + boolean breaksInstantly = MC.player.getAbilities().creativeMode + || BlockUtils.getHardness(pos) >= 1; float p = breaksInstantly ? 1 : MathHelper.lerp(partialTicks, prevProgress, progress); From 68bb8cb95ca561da810386b28478d1964f69ca22 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 22 May 2023 17:36:21 +0200 Subject: [PATCH 110/282] Refactor NukerLegit to use BlockBreaker --- .../net/wurstclient/hacks/NukerLegitHack.java | 97 +++++-------------- 1 file changed, 24 insertions(+), 73 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/NukerLegitHack.java b/src/main/java/net/wurstclient/hacks/NukerLegitHack.java index c1567a15f9..cd2a9205b7 100644 --- a/src/main/java/net/wurstclient/hacks/NukerLegitHack.java +++ b/src/main/java/net/wurstclient/hacks/NukerLegitHack.java @@ -14,16 +14,12 @@ import java.util.function.Predicate; import java.util.stream.Collectors; -import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.Material; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.Vec3i; -import net.minecraft.util.shape.VoxelShape; import net.wurstclient.Category; import net.wurstclient.SearchTags; import net.wurstclient.events.LeftClickListener; @@ -36,6 +32,8 @@ import net.wurstclient.settings.EnumSetting; import net.wurstclient.settings.SliderSetting; import net.wurstclient.settings.SliderSetting.ValueDisplay; +import net.wurstclient.util.BlockBreaker; +import net.wurstclient.util.BlockBreaker.BlockBreakingParams; import net.wurstclient.util.BlockUtils; import net.wurstclient.util.OverlayRenderer; import net.wurstclient.util.RotationUtils; @@ -168,7 +166,7 @@ public void onUpdate() } // get valid blocks - Iterable validBlocks = getValidBlocks(range.getValue(), + Iterable validBlocks = getValidBlocks(range.getValueI(), mode.getSelected().getValidator(this)); // find closest valid block @@ -193,92 +191,45 @@ public void onUpdate() renderer.updateProgress(); } - private ArrayList getValidBlocks(double range, + private ArrayList getValidBlocks(int range, Predicate validator) { - Vec3d eyesVec = RotationUtils.getEyesPos().subtract(0.5, 0.5, 0.5); - double rangeSq = Math.pow(range + 0.5, 2); - int rangeI = (int)Math.ceil(range); + Vec3d eyesVec = RotationUtils.getEyesPos(); + BlockPos center = BlockPos.ofFloored(eyesVec); - BlockPos center = BlockPos.ofFloored(RotationUtils.getEyesPos()); - BlockPos min = center.add(-rangeI, -rangeI, -rangeI); - BlockPos max = center.add(rangeI, rangeI, rangeI); - - return BlockUtils.getAllInBox(min, max).stream() - .filter(pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos)) <= rangeSq) + return BlockUtils.getAllInBoxStream(center, range) .filter(BlockUtils::canBeClicked).filter(validator) .sorted(Comparator.comparingDouble( - pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos)))) + pos -> eyesVec.squaredDistanceTo(Vec3d.ofCenter(pos)))) .collect(Collectors.toCollection(ArrayList::new)); } private boolean breakBlockExtraLegit(BlockPos pos) { - Direction[] sides = Direction.values(); - - BlockState state = BlockUtils.getState(pos); - VoxelShape shape = state.getOutlineShape(MC.world, pos); - if(shape.isEmpty()) + BlockBreakingParams params = BlockBreaker.getBlockBreakingParams(pos); + if(!params.lineOfSight() || params.distanceSq() > range.getValueSq()) return false; - Vec3d eyesPos = RotationUtils.getEyesPos(); - Vec3d relCenter = shape.getBoundingBox().getCenter(); - Vec3d center = Vec3d.of(pos).add(relCenter); - - Vec3d[] hitVecs = new Vec3d[sides.length]; - for(int i = 0; i < sides.length; i++) - { - Vec3i dirVec = sides[i].getVector(); - Vec3d relHitVec = new Vec3d(relCenter.x * dirVec.getX(), - relCenter.y * dirVec.getY(), relCenter.z * dirVec.getZ()); - hitVecs[i] = center.add(relHitVec); - } + // face block + WURST.getRotationFaker().faceVectorClient(params.hitVec()); - double distanceSqToCenter = eyesPos.squaredDistanceTo(center); + WURST.getHax().autoToolHack.equipIfEnabled(pos); - for(Direction side : sides) - { - Vec3d hitVec = hitVecs[side.ordinal()]; - double distanceSqHitVec = eyesPos.squaredDistanceTo(hitVec); - - // check if hitVec is within range (4.25 blocks) - if(distanceSqHitVec > 18.0625) - continue; - - // check if side is facing towards player - if(distanceSqHitVec >= distanceSqToCenter) - continue; - - // check line of sight - if(MC.world.raycastBlock(eyesPos, hitVec, pos, shape, - state) != null) - continue; - - // face block - WURST.getRotationFaker().faceVectorClient(hitVec); - - if(currentBlock != null) - WURST.getHax().autoToolHack.equipIfEnabled(currentBlock); - - if(!MC.interactionManager.isBreakingBlock()) - MC.interactionManager.attackBlock(pos, side); - - // if attack key is down but nothing happens, - // release it for one tick - if(MC.options.attackKey.isPressed() - && !MC.interactionManager.isBreakingBlock()) - { - MC.options.attackKey.setPressed(false); - return true; - } - - // damage block - MC.options.attackKey.setPressed(true); + if(!MC.interactionManager.isBreakingBlock()) + MC.interactionManager.attackBlock(pos, params.side()); + // if attack key is down but nothing happens, + // release it for one tick + if(MC.options.attackKey.isPressed() + && !MC.interactionManager.isBreakingBlock()) + { + MC.options.attackKey.setPressed(false); return true; } - return false; + // damage block + MC.options.attackKey.setPressed(true); + return true; } @Override From 650ca14b8f8e75375eb948c0f7d73a4f4526b345 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Tue, 23 May 2023 17:23:31 +0200 Subject: [PATCH 111/282] [Wurst-Bot] Update to 1.20-pre5 --- gradle.properties | 10 +++++----- src/main/java/net/wurstclient/WurstClient.java | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gradle.properties b/gradle.properties index 53c8cdee2a..428b14ff11 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,15 +4,15 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these at https://fabricmc.net/develop/ and # https://www.curseforge.com/minecraft/mc-mods/fabric-api -minecraft_version=1.20-pre4 -yarn_mappings=1.20-pre4+build.2 -loader_version=0.14.19 +minecraft_version=1.20-pre5 +yarn_mappings=1.20-pre5+build.1 +loader_version=0.14.20 #Fabric api -fabric_version=0.81.2+1.20 +fabric_version=0.81.3+1.20 # Mod Properties -mod_version = v7.35-MC1.20-pre4 +mod_version = v7.35-MC1.20-pre5 maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index 43d659cd26..94d479af2e 100644 --- a/src/main/java/net/wurstclient/WurstClient.java +++ b/src/main/java/net/wurstclient/WurstClient.java @@ -57,7 +57,7 @@ public enum WurstClient public static IMinecraftClient IMC; public static final String VERSION = "7.35"; - public static final String MC_VERSION = "1.20-pre4"; + public static final String MC_VERSION = "1.20-pre5"; private WurstAnalytics analytics; private EventManager eventManager; From ee57b3027df5b69b9c4551fed20bee41d198f645 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 24 May 2023 12:01:32 +0200 Subject: [PATCH 112/282] Fix relHitVec calculation The previous code assumed that the center of a block is the same as its size divided by two, which works for most blocks but not all of them. For example, an upside down slab has its center on the Y axis at 0.75, but half of its height is only 0.25. Breaking a slab from the top with the old code would place relHitVec's Y coordinate at 0.75+0.75=1.5 (floating half a block above the slab's top surface), with the new code it's 0.75+0.25=1 (exactly on the surface where it should be). --- src/main/java/net/wurstclient/util/BlockBreaker.java | 11 +++++++---- src/main/java/net/wurstclient/util/BlockPlacer.java | 11 +++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/wurstclient/util/BlockBreaker.java b/src/main/java/net/wurstclient/util/BlockBreaker.java index 2f416792fa..16398f6f4f 100644 --- a/src/main/java/net/wurstclient/util/BlockBreaker.java +++ b/src/main/java/net/wurstclient/util/BlockBreaker.java @@ -16,6 +16,7 @@ import net.minecraft.util.Hand; import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Box; import net.minecraft.util.math.Direction; import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3i; @@ -66,15 +67,17 @@ public static BlockBreakingParams getBlockBreakingParams(BlockPos pos) return null; Vec3d eyesPos = RotationUtils.getEyesPos(); - Vec3d relCenter = shape.getBoundingBox().getCenter(); - Vec3d center = Vec3d.of(pos).add(relCenter); + Box box = shape.getBoundingBox(); + Vec3d halfSize = new Vec3d(box.maxX - box.minX, box.maxY - box.minY, + box.maxZ - box.minZ).multiply(0.5); + Vec3d center = Vec3d.of(pos).add(box.getCenter()); Vec3d[] hitVecs = new Vec3d[sides.length]; for(int i = 0; i < sides.length; i++) { Vec3i dirVec = sides[i].getVector(); - Vec3d relHitVec = new Vec3d(relCenter.x * dirVec.getX(), - relCenter.y * dirVec.getY(), relCenter.z * dirVec.getZ()); + Vec3d relHitVec = new Vec3d(halfSize.x * dirVec.getX(), + halfSize.y * dirVec.getY(), halfSize.z * dirVec.getZ()); hitVecs[i] = center.add(relHitVec); } diff --git a/src/main/java/net/wurstclient/util/BlockPlacer.java b/src/main/java/net/wurstclient/util/BlockPlacer.java index 91144943e5..60231d1b4f 100644 --- a/src/main/java/net/wurstclient/util/BlockPlacer.java +++ b/src/main/java/net/wurstclient/util/BlockPlacer.java @@ -12,6 +12,7 @@ import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Box; import net.minecraft.util.math.Direction; import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3i; @@ -87,12 +88,14 @@ public static BlockPlacingParams getBlockPlacingParams(BlockPos pos) if(shape.isEmpty() || state.getMaterial().isReplaceable()) continue; - Vec3d relCenter = shape.getBoundingBox().getCenter(); - Vec3d center = Vec3d.of(neighbor).add(relCenter); + Box box = shape.getBoundingBox(); + Vec3d halfSize = new Vec3d(box.maxX - box.minX, box.maxY - box.minY, + box.maxZ - box.minZ).multiply(0.5); + Vec3d center = Vec3d.of(neighbor).add(box.getCenter()); Vec3i dirVec = sides[i].getOpposite().getVector(); - Vec3d relHitVec = new Vec3d(relCenter.x * dirVec.getX(), - relCenter.y * dirVec.getY(), relCenter.z * dirVec.getZ()); + Vec3d relHitVec = new Vec3d(halfSize.x * dirVec.getX(), + halfSize.y * dirVec.getY(), halfSize.z * dirVec.getZ()); hitVecs[i] = center.add(relHitVec); } From 542d7b23526e355a6a9bf7fc2a3080a3c7d4995d Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Thu, 25 May 2023 13:29:57 +0200 Subject: [PATCH 113/282] Remove AutoFarmHack.getBlockStream() --- .../java/net/wurstclient/hacks/AutoFarmHack.java | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/AutoFarmHack.java b/src/main/java/net/wurstclient/hacks/AutoFarmHack.java index 3be8ee1ce9..58b7a72f74 100644 --- a/src/main/java/net/wurstclient/hacks/AutoFarmHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoFarmHack.java @@ -124,7 +124,8 @@ public void onUpdate() double rangeSq = range.getValueSq(); int blockRange = range.getValueCeil(); - List blocks = getBlockStream(eyesBlock, blockRange) + List blocks = BlockUtils + .getAllInBoxStream(eyesBlock, blockRange) .filter(pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos)) <= rangeSq) .filter(BlockUtils::canBeClicked).collect(Collectors.toList()); @@ -175,7 +176,7 @@ private List getBlocksToHarvest(Vec3d eyesVec, private List getBlocksToReplant(Vec3d eyesVec, BlockPos eyesBlock, double rangeSq, int blockRange) { - return getBlockStream(eyesBlock, blockRange) + return BlockUtils.getAllInBoxStream(eyesBlock, blockRange) .filter(pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos)) <= rangeSq) .filter( pos -> BlockUtils.getState(pos).getMaterial().isReplaceable()) @@ -240,14 +241,6 @@ public void onRender(MatrixStack matrixStack, float partialTicks) overlay.render(matrixStack, partialTicks, currentBlock); } - private Stream getBlockStream(BlockPos center, int range) - { - BlockPos min = center.add(-range, -range, -range); - BlockPos max = center.add(range, range, range); - - return BlockUtils.getAllInBox(min, max).stream(); - } - private boolean shouldBeHarvested(BlockPos pos) { Block block = BlockUtils.getBlock(pos); From d84ef2939ececf41ec4ad3c0d43502b6df0f59a3 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Thu, 25 May 2023 17:39:11 +0200 Subject: [PATCH 114/282] Use BlockPlacer in AutoFarmHack --- .../net/wurstclient/hacks/AutoFarmHack.java | 76 +++++-------------- 1 file changed, 18 insertions(+), 58 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/AutoFarmHack.java b/src/main/java/net/wurstclient/hacks/AutoFarmHack.java index 58b7a72f74..c283d81d5b 100644 --- a/src/main/java/net/wurstclient/hacks/AutoFarmHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoFarmHack.java @@ -32,12 +32,11 @@ import net.minecraft.item.Items; import net.minecraft.network.packet.c2s.play.HandSwingC2SPacket; import net.minecraft.registry.tag.BlockTags; +import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; -import net.minecraft.util.math.Direction; import net.minecraft.util.math.Vec3d; -import net.minecraft.util.shape.VoxelShape; import net.wurstclient.Category; import net.wurstclient.SearchTags; import net.wurstclient.WurstClient; @@ -48,6 +47,8 @@ import net.wurstclient.settings.SliderSetting; import net.wurstclient.settings.SliderSetting.ValueDisplay; import net.wurstclient.util.BlockBreaker; +import net.wurstclient.util.BlockPlacer; +import net.wurstclient.util.BlockPlacer.BlockPlacingParams; import net.wurstclient.util.BlockUtils; import net.wurstclient.util.OverlayRenderer; import net.wurstclient.util.RenderUtils; @@ -357,75 +358,34 @@ else if(player.getInventory().getEmptySlot() != -1) private void placeBlockSimple(BlockPos pos) { - Direction side = null; - Direction[] sides = Direction.values(); - - Vec3d eyesPos = RotationUtils.getEyesPos(); - Vec3d posVec = Vec3d.ofCenter(pos); - double distanceSqPosVec = eyesPos.squaredDistanceTo(posVec); - - Vec3d[] hitVecs = new Vec3d[sides.length]; - for(int i = 0; i < sides.length; i++) - hitVecs[i] = - posVec.add(Vec3d.of(sides[i].getVector()).multiply(0.5)); - - for(int i = 0; i < sides.length; i++) - { - // check if neighbor can be right clicked - BlockPos neighbor = pos.offset(sides[i]); - if(!BlockUtils.canBeClicked(neighbor)) - continue; - - // check line of sight - BlockState neighborState = BlockUtils.getState(neighbor); - VoxelShape neighborShape = - neighborState.getOutlineShape(MC.world, neighbor); - if(MC.world.raycastBlock(eyesPos, hitVecs[i], neighbor, - neighborShape, neighborState) != null) - continue; - - side = sides[i]; - break; - } - - if(side == null) - for(int i = 0; i < sides.length; i++) - { - // check if neighbor can be right clicked - if(!BlockUtils.canBeClicked(pos.offset(sides[i]))) - continue; - - // check if side is facing away from player - if(distanceSqPosVec > eyesPos.squaredDistanceTo(hitVecs[i])) - continue; - - side = sides[i]; - break; - } - - if(side == null) + // should never happen, but just in case + if(!BlockUtils.getState(pos).isReplaceable()) return; - Vec3d hitVec = hitVecs[side.ordinal()]; + BlockPlacingParams params = BlockPlacer.getBlockPlacingParams(pos); + if(params == null || params.distanceSq() > range.getValueSq()) + return; // face block - WURST.getRotationFaker().faceVectorPacket(hitVec); - if(RotationUtils.getAngleToLastReportedLookVec(hitVec) > 1) + WURST.getRotationFaker().faceVectorPacket(params.hitVec()); + if(RotationUtils.getAngleToLastReportedLookVec(params.hitVec()) > 1) return; - // check timer + // check cooldown if(IMC.getItemUseCooldown() > 0) return; + Hand hand = Hand.MAIN_HAND; + // place block - IMC.getInteractionManager().rightClickBlock(pos.offset(side), - side.getOpposite(), hitVec); + ActionResult result = MC.interactionManager.interactBlock(MC.player, + hand, params.toHitResult()); // swing arm - MC.player.networkHandler - .sendPacket(new HandSwingC2SPacket(Hand.MAIN_HAND)); + if(result.isAccepted() && result.shouldSwingHand()) + MC.player.networkHandler.sendPacket(new HandSwingC2SPacket(hand)); - // reset timer + // reset cooldown IMC.setItemUseCooldown(4); } From 4c3fc11b0d315ecd6522a07071f55bbbf4b9cff2 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Thu, 25 May 2023 19:21:57 +0200 Subject: [PATCH 115/282] [Wurst-Bot] Update to 1.20-pre6 --- gradle.properties | 8 ++++---- src/main/java/net/wurstclient/WurstClient.java | 2 +- src/main/java/net/wurstclient/mixin/StatsScreenMixin.java | 2 +- src/main/java/net/wurstclient/mixin/TitleScreenMixin.java | 2 +- .../net/wurstclient/navigator/NavigatorMainScreen.java | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gradle.properties b/gradle.properties index 428b14ff11..9ef5445b03 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,15 +4,15 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these at https://fabricmc.net/develop/ and # https://www.curseforge.com/minecraft/mc-mods/fabric-api -minecraft_version=1.20-pre5 -yarn_mappings=1.20-pre5+build.1 +minecraft_version=1.20-pre6 +yarn_mappings=1.20-pre6+build.2 loader_version=0.14.20 #Fabric api -fabric_version=0.81.3+1.20 +fabric_version=0.82.1+1.20 # Mod Properties -mod_version = v7.35-MC1.20-pre5 +mod_version = v7.35-MC1.20-pre6 maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index 94d479af2e..450cd537c7 100644 --- a/src/main/java/net/wurstclient/WurstClient.java +++ b/src/main/java/net/wurstclient/WurstClient.java @@ -57,7 +57,7 @@ public enum WurstClient public static IMinecraftClient IMC; public static final String VERSION = "7.35"; - public static final String MC_VERSION = "1.20-pre5"; + public static final String MC_VERSION = "1.20-pre6"; private WurstAnalytics analytics; private EventManager eventManager; diff --git a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java index 187f0eeda4..5297484e74 100644 --- a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java @@ -55,7 +55,7 @@ private void onCreateButtons(CallbackInfo ci) .equals(I18n.translate("gui.done"))) continue; - button.setX(width / 2 + 2); + button.method_46421(width / 2 + 2); button.setWidth(150); } } diff --git a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java index 28488e077b..87f2248691 100644 --- a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java @@ -77,7 +77,7 @@ private void onTick(CallbackInfo ci) // adjust AltManager button if Realms button has been moved // happens when ModMenu is installed - altsButton.setY(realmsButton.getY()); + altsButton.method_46419(realmsButton.getY()); } /** diff --git a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java index 70cd9d694c..723c4d909c 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java @@ -74,7 +74,7 @@ protected void onResize() setFocused(searchBar); searchBar.setFocused(true); - searchBar.setX(middleX - 100); + searchBar.method_46421(middleX - 100); setContentHeight(navigatorDisplayList.size() / 3 * 20); } From ad0876da2dfec5b008e501eebb5c659100ccbc3d Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Thu, 25 May 2023 19:44:04 +0200 Subject: [PATCH 116/282] Update to 1.20-pre6 --- src/main/java/net/wurstclient/mixin/StatsScreenMixin.java | 2 +- src/main/java/net/wurstclient/mixin/TitleScreenMixin.java | 2 +- .../java/net/wurstclient/navigator/NavigatorMainScreen.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java index 5297484e74..187f0eeda4 100644 --- a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java @@ -55,7 +55,7 @@ private void onCreateButtons(CallbackInfo ci) .equals(I18n.translate("gui.done"))) continue; - button.method_46421(width / 2 + 2); + button.setX(width / 2 + 2); button.setWidth(150); } } diff --git a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java index 87f2248691..28488e077b 100644 --- a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java @@ -77,7 +77,7 @@ private void onTick(CallbackInfo ci) // adjust AltManager button if Realms button has been moved // happens when ModMenu is installed - altsButton.method_46419(realmsButton.getY()); + altsButton.setY(realmsButton.getY()); } /** diff --git a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java index 723c4d909c..70cd9d694c 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java @@ -74,7 +74,7 @@ protected void onResize() setFocused(searchBar); searchBar.setFocused(true); - searchBar.method_46421(middleX - 100); + searchBar.setX(middleX - 100); setContentHeight(navigatorDisplayList.size() / 3 * 20); } From c65f6da123091cfb1427fad98f010d7186ce6988 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Fri, 26 May 2023 19:58:23 +0200 Subject: [PATCH 117/282] Move AutoFarm rendering to a separate class --- .../net/wurstclient/hacks/AutoFarmHack.java | 165 ++-------------- .../hacks/autofarm/AutoFarmRenderer.java | 184 ++++++++++++++++++ 2 files changed, 198 insertions(+), 151 deletions(-) create mode 100644 src/main/java/net/wurstclient/hacks/autofarm/AutoFarmRenderer.java diff --git a/src/main/java/net/wurstclient/hacks/AutoFarmHack.java b/src/main/java/net/wurstclient/hacks/AutoFarmHack.java index c283d81d5b..fb102e0dbe 100644 --- a/src/main/java/net/wurstclient/hacks/AutoFarmHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoFarmHack.java @@ -7,25 +7,18 @@ */ package net.wurstclient.hacks; -import java.util.*; +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; -import org.joml.Matrix4f; -import org.lwjgl.opengl.GL11; - -import com.mojang.blaze3d.systems.RenderSystem; - import net.minecraft.block.*; -import net.minecraft.client.gl.ShaderProgram; -import net.minecraft.client.gl.VertexBuffer; import net.minecraft.client.network.ClientPlayerEntity; -import net.minecraft.client.render.BufferBuilder; -import net.minecraft.client.render.BufferBuilder.BuiltBuffer; -import net.minecraft.client.render.GameRenderer; -import net.minecraft.client.render.Tessellator; -import net.minecraft.client.render.VertexFormat; -import net.minecraft.client.render.VertexFormats; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -35,14 +28,13 @@ import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Box; import net.minecraft.util.math.Vec3d; import net.wurstclient.Category; import net.wurstclient.SearchTags; -import net.wurstclient.WurstClient; import net.wurstclient.events.RenderListener; import net.wurstclient.events.UpdateListener; import net.wurstclient.hack.Hack; +import net.wurstclient.hacks.autofarm.AutoFarmRenderer; import net.wurstclient.settings.CheckboxSetting; import net.wurstclient.settings.SliderSetting; import net.wurstclient.settings.SliderSetting.ValueDisplay; @@ -51,7 +43,6 @@ import net.wurstclient.util.BlockPlacer.BlockPlacingParams; import net.wurstclient.util.BlockUtils; import net.wurstclient.util.OverlayRenderer; -import net.wurstclient.util.RenderUtils; import net.wurstclient.util.RotationUtils; @SearchTags({"auto farm", "AutoHarvest", "auto harvest"}) @@ -65,14 +56,11 @@ public final class AutoFarmHack extends Hack new CheckboxSetting("Replant", true); private final HashMap plants = new HashMap<>(); - private final ArrayDeque> prevBlocks = new ArrayDeque<>(); private BlockPos currentBlock; + private final AutoFarmRenderer renderer = new AutoFarmRenderer(); private final OverlayRenderer overlay = new OverlayRenderer(); - private VertexBuffer greenBuffer; - private VertexBuffer cyanBuffer; - private VertexBuffer redBuffer; private boolean busy; @@ -111,9 +99,7 @@ public void onDisable() overlay.resetProgress(); busy = false; - Stream.of(greenBuffer, cyanBuffer, redBuffer).filter(Objects::nonNull) - .forEach(VertexBuffer::close); - greenBuffer = cyanBuffer = redBuffer = null; + renderer.reset(); } @Override @@ -162,7 +148,9 @@ public void onUpdate() harvest(blocksToHarvest); busy = !blocksToHarvest.isEmpty() || !blocksToReplant.isEmpty(); - updateVertexBuffers(blocksToHarvest, blocksToReplant); + + renderer.updateVertexBuffers(blocksToHarvest, plants.keySet(), + blocksToReplant); } private List getBlocksToHarvest(Vec3d eyesVec, @@ -190,55 +178,7 @@ private List getBlocksToReplant(Vec3d eyesVec, BlockPos eyesBlock, @Override public void onRender(MatrixStack matrixStack, float partialTicks) { - // GL settings - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glEnable(GL11.GL_CULL_FACE); - GL11.glDisable(GL11.GL_DEPTH_TEST); - - matrixStack.push(); - - BlockPos camPos = RenderUtils.getCameraBlockPos(); - int regionX = (camPos.getX() >> 9) * 512; - int regionZ = (camPos.getZ() >> 9) * 512; - RenderUtils.applyRegionalRenderOffset(matrixStack, regionX, regionZ); - - RenderSystem.setShader(GameRenderer::getPositionProgram); - Matrix4f viewMatrix = matrixStack.peek().getPositionMatrix(); - Matrix4f projMatrix = RenderSystem.getProjectionMatrix(); - ShaderProgram shader = RenderSystem.getShader(); - - if(greenBuffer != null) - { - RenderSystem.setShaderColor(0, 1, 0, 0.5F); - greenBuffer.bind(); - greenBuffer.draw(viewMatrix, projMatrix, shader); - VertexBuffer.unbind(); - } - - if(cyanBuffer != null) - { - RenderSystem.setShaderColor(0, 1, 1, 0.5F); - cyanBuffer.bind(); - cyanBuffer.draw(viewMatrix, projMatrix, shader); - VertexBuffer.unbind(); - } - - if(redBuffer != null) - { - RenderSystem.setShaderColor(1, 0, 0, 0.5F); - redBuffer.bind(); - redBuffer.draw(viewMatrix, projMatrix, shader); - VertexBuffer.unbind(); - } - - matrixStack.pop(); - - // GL resets - RenderSystem.setShaderColor(1, 1, 1, 1); - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glDisable(GL11.GL_BLEND); - + renderer.render(matrixStack); overlay.render(matrixStack, partialTicks, currentBlock); } @@ -427,83 +367,6 @@ private void harvest(List blocksToHarvest) overlay.resetProgress(); } - private void updateVertexBuffers(List blocksToHarvest, - List blocksToReplant) - { - if(WurstClient.MC.getBlockEntityRenderDispatcher().camera == null) - return; - - Tessellator tessellator = RenderSystem.renderThreadTesselator(); - BufferBuilder bufferBuilder = tessellator.getBuffer(); - - BlockPos camPos = RenderUtils.getCameraBlockPos(); - int regionX = (camPos.getX() >> 9) * 512; - int regionZ = (camPos.getZ() >> 9) * 512; - - if(greenBuffer != null) - greenBuffer.close(); - - greenBuffer = new VertexBuffer(); - - bufferBuilder.begin(VertexFormat.DrawMode.DEBUG_LINES, - VertexFormats.POSITION); - - double boxMin = 1 / 16.0; - double boxMax = 15 / 16.0; - Box box = new Box(boxMin, boxMin, boxMin, boxMax, boxMax, boxMax); - - for(BlockPos pos : blocksToHarvest) - { - Box renderBox = box.offset(pos).offset(-regionX, 0, -regionZ); - RenderUtils.drawOutlinedBox(renderBox, bufferBuilder); - } - - BuiltBuffer buffer = bufferBuilder.end(); - greenBuffer.bind(); - greenBuffer.upload(buffer); - VertexBuffer.unbind(); - - if(cyanBuffer != null) - cyanBuffer.close(); - - cyanBuffer = new VertexBuffer(); - - bufferBuilder.begin(VertexFormat.DrawMode.DEBUG_LINES, - VertexFormats.POSITION); - - Box node = new Box(0.25, 0.25, 0.25, 0.75, 0.75, 0.75); - - for(BlockPos pos : plants.keySet()) - { - Box renderNode = node.offset(pos).offset(-regionX, 0, -regionZ); - RenderUtils.drawNode(renderNode, bufferBuilder); - } - - buffer = bufferBuilder.end(); - cyanBuffer.bind(); - cyanBuffer.upload(buffer); - VertexBuffer.unbind(); - - if(redBuffer != null) - redBuffer.close(); - - redBuffer = new VertexBuffer(); - - bufferBuilder.begin(VertexFormat.DrawMode.DEBUG_LINES, - VertexFormats.POSITION); - - for(BlockPos pos : blocksToReplant) - { - Box renderBox = box.offset(pos).offset(-regionX, 0, -regionZ); - RenderUtils.drawOutlinedBox(renderBox, bufferBuilder); - } - - buffer = bufferBuilder.end(); - redBuffer.bind(); - redBuffer.upload(buffer); - VertexBuffer.unbind(); - } - /** * Returns true if AutoFarm is currently harvesting or replanting something. */ diff --git a/src/main/java/net/wurstclient/hacks/autofarm/AutoFarmRenderer.java b/src/main/java/net/wurstclient/hacks/autofarm/AutoFarmRenderer.java new file mode 100644 index 0000000000..5915f0fede --- /dev/null +++ b/src/main/java/net/wurstclient/hacks/autofarm/AutoFarmRenderer.java @@ -0,0 +1,184 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.hacks.autofarm; + +import java.util.List; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Stream; + +import org.joml.Matrix4f; +import org.lwjgl.opengl.GL11; + +import com.mojang.blaze3d.systems.RenderSystem; + +import net.minecraft.client.gl.ShaderProgram; +import net.minecraft.client.gl.VertexBuffer; +import net.minecraft.client.render.BufferBuilder; +import net.minecraft.client.render.BufferBuilder.BuiltBuffer; +import net.minecraft.client.render.GameRenderer; +import net.minecraft.client.render.VertexFormat; +import net.minecraft.client.render.VertexFormats; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Box; +import net.minecraft.util.math.Vec3d; +import net.wurstclient.util.RenderUtils; + +public final class AutoFarmRenderer +{ + private VertexBuffer greenBuffer; + private VertexBuffer cyanBuffer; + private VertexBuffer redBuffer; + + public void reset() + { + Stream.of(greenBuffer, cyanBuffer, redBuffer).filter(Objects::nonNull) + .forEach(VertexBuffer::close); + greenBuffer = cyanBuffer = redBuffer = null; + } + + public void render(MatrixStack matrixStack) + { + // GL settings + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glEnable(GL11.GL_CULL_FACE); + GL11.glDisable(GL11.GL_DEPTH_TEST); + + matrixStack.push(); + + BlockPos camPos = RenderUtils.getCameraBlockPos(); + int regionX = (camPos.getX() >> 9) * 512; + int regionZ = (camPos.getZ() >> 9) * 512; + RenderUtils.applyRegionalRenderOffset(matrixStack, regionX, regionZ); + + RenderSystem.setShader(GameRenderer::getPositionProgram); + Matrix4f viewMatrix = matrixStack.peek().getPositionMatrix(); + Matrix4f projMatrix = RenderSystem.getProjectionMatrix(); + ShaderProgram shader = RenderSystem.getShader(); + + if(greenBuffer != null) + { + RenderSystem.setShaderColor(0, 1, 0, 0.5F); + greenBuffer.bind(); + greenBuffer.draw(viewMatrix, projMatrix, shader); + VertexBuffer.unbind(); + } + + if(cyanBuffer != null) + { + RenderSystem.setShaderColor(0, 1, 1, 0.5F); + cyanBuffer.bind(); + cyanBuffer.draw(viewMatrix, projMatrix, shader); + VertexBuffer.unbind(); + } + + if(redBuffer != null) + { + RenderSystem.setShaderColor(1, 0, 0, 0.5F); + redBuffer.bind(); + redBuffer.draw(viewMatrix, projMatrix, shader); + VertexBuffer.unbind(); + } + + matrixStack.pop(); + + // GL resets + RenderSystem.setShaderColor(1, 1, 1, 1); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glDisable(GL11.GL_BLEND); + } + + public void updateVertexBuffers(List blocksToHarvest, + Set plants, List blocksToReplant) + { + BufferBuilder bufferBuilder = + RenderSystem.renderThreadTesselator().getBuffer(); + + BlockPos camPos = RenderUtils.getCameraBlockPos(); + int regionX = (camPos.getX() >> 9) * 512; + int regionZ = (camPos.getZ() >> 9) * 512; + Vec3d regionOffset = new Vec3d(-regionX, 0, -regionZ); + + double boxMin = 1 / 16.0; + double boxMax = 15 / 16.0; + Box box = new Box(boxMin, boxMin, boxMin, boxMax, boxMax, boxMax); + Box node = new Box(0.25, 0.25, 0.25, 0.75, 0.75, 0.75); + + updateGreenBuffer(blocksToHarvest, bufferBuilder, box, regionOffset); + updateCyanBuffer(plants, bufferBuilder, node, regionOffset); + updateRedBuffer(blocksToReplant, bufferBuilder, box, regionOffset); + } + + private void updateGreenBuffer(List blocksToHarvest, + BufferBuilder bufferBuilder, Box box, Vec3d regionOffset) + { + if(greenBuffer != null) + greenBuffer.close(); + + greenBuffer = new VertexBuffer(); + bufferBuilder.begin(VertexFormat.DrawMode.DEBUG_LINES, + VertexFormats.POSITION); + + for(BlockPos pos : blocksToHarvest) + { + Box renderBox = box.offset(pos).offset(regionOffset); + RenderUtils.drawOutlinedBox(renderBox, bufferBuilder); + } + + BuiltBuffer buffer = bufferBuilder.end(); + greenBuffer.bind(); + greenBuffer.upload(buffer); + VertexBuffer.unbind(); + } + + private void updateCyanBuffer(Set plants, + BufferBuilder bufferBuilder, Box node, Vec3d regionOffset) + { + if(cyanBuffer != null) + cyanBuffer.close(); + + cyanBuffer = new VertexBuffer(); + bufferBuilder.begin(VertexFormat.DrawMode.DEBUG_LINES, + VertexFormats.POSITION); + + for(BlockPos pos : plants) + { + Box renderNode = node.offset(pos).offset(regionOffset); + RenderUtils.drawNode(renderNode, bufferBuilder); + } + + BuiltBuffer buffer = bufferBuilder.end(); + cyanBuffer.bind(); + cyanBuffer.upload(buffer); + VertexBuffer.unbind(); + } + + private void updateRedBuffer(List blocksToReplant, + BufferBuilder bufferBuilder, Box box, Vec3d regionOffset) + { + if(redBuffer != null) + redBuffer.close(); + + redBuffer = new VertexBuffer(); + bufferBuilder.begin(VertexFormat.DrawMode.DEBUG_LINES, + VertexFormats.POSITION); + + for(BlockPos pos : blocksToReplant) + { + Box renderBox = box.offset(pos).offset(regionOffset); + RenderUtils.drawOutlinedBox(renderBox, bufferBuilder); + } + + BuiltBuffer buffer = bufferBuilder.end(); + redBuffer.bind(); + redBuffer.upload(buffer); + VertexBuffer.unbind(); + } +} From 78ab5bdcbda23c7019c203f8bc4ffb6c0b415c22 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sat, 27 May 2023 10:44:45 +0200 Subject: [PATCH 118/282] Re-order AutoFarm's methods --- .../net/wurstclient/hacks/AutoFarmHack.java | 86 +++++++++---------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/AutoFarmHack.java b/src/main/java/net/wurstclient/hacks/AutoFarmHack.java index fb102e0dbe..1d255478a0 100644 --- a/src/main/java/net/wurstclient/hacks/AutoFarmHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoFarmHack.java @@ -153,33 +153,46 @@ public void onUpdate() blocksToReplant); } - private List getBlocksToHarvest(Vec3d eyesVec, - List blocks) + @Override + public void onRender(MatrixStack matrixStack, float partialTicks) { - return blocks.parallelStream().filter(this::shouldBeHarvested) - .sorted(Comparator.comparingDouble( - pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos)))) - .collect(Collectors.toList()); + renderer.render(matrixStack); + overlay.render(matrixStack, partialTicks, currentBlock); } - private List getBlocksToReplant(Vec3d eyesVec, BlockPos eyesBlock, - double rangeSq, int blockRange) + /** + * Returns true if AutoFarm is currently harvesting or replanting something. + */ + public boolean isBusy() { - return BlockUtils.getAllInBoxStream(eyesBlock, blockRange) - .filter(pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos)) <= rangeSq) - .filter( - pos -> BlockUtils.getState(pos).getMaterial().isReplaceable()) - .filter(pos -> plants.containsKey(pos)).filter(this::canBeReplanted) - .sorted(Comparator.comparingDouble( - pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos)))) - .collect(Collectors.toList()); + return busy; } - @Override - public void onRender(MatrixStack matrixStack, float partialTicks) + private void registerPlants(List blocks) { - renderer.render(matrixStack); - overlay.render(matrixStack, partialTicks, currentBlock); + HashMap seeds = new HashMap<>(); + seeds.put(Blocks.WHEAT, Items.WHEAT_SEEDS); + seeds.put(Blocks.CARROTS, Items.CARROT); + seeds.put(Blocks.POTATOES, Items.POTATO); + seeds.put(Blocks.BEETROOTS, Items.BEETROOT_SEEDS); + seeds.put(Blocks.PUMPKIN_STEM, Items.PUMPKIN_SEEDS); + seeds.put(Blocks.MELON_STEM, Items.MELON_SEEDS); + seeds.put(Blocks.NETHER_WART, Items.NETHER_WART); + seeds.put(Blocks.COCOA, Items.COCOA_BEANS); + + plants.putAll(blocks.parallelStream() + .filter(pos -> seeds.containsKey(BlockUtils.getBlock(pos))) + .collect(Collectors.toMap(pos -> pos, + pos -> seeds.get(BlockUtils.getBlock(pos))))); + } + + private List getBlocksToHarvest(Vec3d eyesVec, + List blocks) + { + return blocks.parallelStream().filter(this::shouldBeHarvested) + .sorted(Comparator.comparingDouble( + pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos)))) + .collect(Collectors.toList()); } private boolean shouldBeHarvested(BlockPos pos) @@ -213,22 +226,17 @@ private boolean shouldBeHarvested(BlockPos pos) return false; } - private void registerPlants(List blocks) + private List getBlocksToReplant(Vec3d eyesVec, BlockPos eyesBlock, + double rangeSq, int blockRange) { - HashMap seeds = new HashMap<>(); - seeds.put(Blocks.WHEAT, Items.WHEAT_SEEDS); - seeds.put(Blocks.CARROTS, Items.CARROT); - seeds.put(Blocks.POTATOES, Items.POTATO); - seeds.put(Blocks.BEETROOTS, Items.BEETROOT_SEEDS); - seeds.put(Blocks.PUMPKIN_STEM, Items.PUMPKIN_SEEDS); - seeds.put(Blocks.MELON_STEM, Items.MELON_SEEDS); - seeds.put(Blocks.NETHER_WART, Items.NETHER_WART); - seeds.put(Blocks.COCOA, Items.COCOA_BEANS); - - plants.putAll(blocks.parallelStream() - .filter(pos -> seeds.containsKey(BlockUtils.getBlock(pos))) - .collect(Collectors.toMap(pos -> pos, - pos -> seeds.get(BlockUtils.getBlock(pos))))); + return BlockUtils.getAllInBoxStream(eyesBlock, blockRange) + .filter(pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos)) <= rangeSq) + .filter( + pos -> BlockUtils.getState(pos).getMaterial().isReplaceable()) + .filter(pos -> plants.containsKey(pos)).filter(this::canBeReplanted) + .sorted(Comparator.comparingDouble( + pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos)))) + .collect(Collectors.toList()); } private boolean canBeReplanted(BlockPos pos) @@ -366,12 +374,4 @@ private void harvest(List blocksToHarvest) else overlay.resetProgress(); } - - /** - * Returns true if AutoFarm is currently harvesting or replanting something. - */ - public boolean isBusy() - { - return busy; - } } From f3eef8cea2c2ed16ff8fc37fb4735cafd63a00ed Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sat, 27 May 2023 14:26:47 +0200 Subject: [PATCH 119/282] Further clean up AutoFarm --- .../net/wurstclient/hacks/AutoFarmHack.java | 56 +++++++++++-------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/AutoFarmHack.java b/src/main/java/net/wurstclient/hacks/AutoFarmHack.java index 1d255478a0..dc21084ec4 100644 --- a/src/main/java/net/wurstclient/hacks/AutoFarmHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoFarmHack.java @@ -55,6 +55,18 @@ public final class AutoFarmHack extends Hack private final CheckboxSetting replant = new CheckboxSetting("Replant", true); + private final HashMap seeds = new HashMap<>(); + { + seeds.put(Blocks.WHEAT, Items.WHEAT_SEEDS); + seeds.put(Blocks.CARROTS, Items.CARROT); + seeds.put(Blocks.POTATOES, Items.POTATO); + seeds.put(Blocks.BEETROOTS, Items.BEETROOT_SEEDS); + seeds.put(Blocks.PUMPKIN_STEM, Items.PUMPKIN_SEEDS); + seeds.put(Blocks.MELON_STEM, Items.MELON_SEEDS); + seeds.put(Blocks.NETHER_WART, Items.NETHER_WART); + seeds.put(Blocks.COCOA, Items.COCOA_BEANS); + } + private final HashMap plants = new HashMap<>(); private final ArrayDeque> prevBlocks = new ArrayDeque<>(); private BlockPos currentBlock; @@ -116,7 +128,7 @@ public void onUpdate() .filter(pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos)) <= rangeSq) .filter(BlockUtils::canBeClicked).collect(Collectors.toList()); - registerPlants(blocks); + updatePlants(blocks); List blocksToHarvest = new ArrayList<>(); List blocksToReplant = new ArrayList<>(); @@ -168,22 +180,16 @@ public boolean isBusy() return busy; } - private void registerPlants(List blocks) + private void updatePlants(List blocks) { - HashMap seeds = new HashMap<>(); - seeds.put(Blocks.WHEAT, Items.WHEAT_SEEDS); - seeds.put(Blocks.CARROTS, Items.CARROT); - seeds.put(Blocks.POTATOES, Items.POTATO); - seeds.put(Blocks.BEETROOTS, Items.BEETROOT_SEEDS); - seeds.put(Blocks.PUMPKIN_STEM, Items.PUMPKIN_SEEDS); - seeds.put(Blocks.MELON_STEM, Items.MELON_SEEDS); - seeds.put(Blocks.NETHER_WART, Items.NETHER_WART); - seeds.put(Blocks.COCOA, Items.COCOA_BEANS); - - plants.putAll(blocks.parallelStream() - .filter(pos -> seeds.containsKey(BlockUtils.getBlock(pos))) - .collect(Collectors.toMap(pos -> pos, - pos -> seeds.get(BlockUtils.getBlock(pos))))); + for(BlockPos pos : blocks) + { + Item seed = seeds.get(BlockUtils.getBlock(pos)); + if(seed == null) + continue; + + plants.put(pos, seed); + } } private List getBlocksToHarvest(Vec3d eyesVec, @@ -202,26 +208,33 @@ private boolean shouldBeHarvested(BlockPos pos) if(block instanceof CropBlock) return ((CropBlock)block).isMature(state); + + if(block instanceof NetherWartBlock) + return state.get(NetherWartBlock.AGE) >= 3; + + if(block instanceof CocoaBlock) + return state.get(CocoaBlock.AGE) >= 2; + if(block instanceof GourdBlock) return true; + if(block instanceof SugarCaneBlock) return BlockUtils.getBlock(pos.down()) instanceof SugarCaneBlock && !(BlockUtils .getBlock(pos.down(2)) instanceof SugarCaneBlock); + if(block instanceof CactusBlock) return BlockUtils.getBlock(pos.down()) instanceof CactusBlock && !(BlockUtils.getBlock(pos.down(2)) instanceof CactusBlock); + if(block instanceof KelpPlantBlock) return BlockUtils.getBlock(pos.down()) instanceof KelpPlantBlock && !(BlockUtils .getBlock(pos.down(2)) instanceof KelpPlantBlock); - if(block instanceof NetherWartBlock) - return state.get(NetherWartBlock.AGE) >= 3; + if(block instanceof BambooBlock) return BlockUtils.getBlock(pos.down()) instanceof BambooBlock && !(BlockUtils.getBlock(pos.down(2)) instanceof BambooBlock); - if(block instanceof CocoaBlock) - return state.get(CocoaBlock.AGE) >= 2; return false; } @@ -231,8 +244,7 @@ private List getBlocksToReplant(Vec3d eyesVec, BlockPos eyesBlock, { return BlockUtils.getAllInBoxStream(eyesBlock, blockRange) .filter(pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos)) <= rangeSq) - .filter( - pos -> BlockUtils.getState(pos).getMaterial().isReplaceable()) + .filter(pos -> BlockUtils.getState(pos).isReplaceable()) .filter(pos -> plants.containsKey(pos)).filter(this::canBeReplanted) .sorted(Comparator.comparingDouble( pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos)))) From 28448c934ffd9cce63881640a446337dada5b518 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 29 May 2023 13:01:30 +0200 Subject: [PATCH 120/282] Add InventoryUtils.indexOf() methods Not currently used anywhere, but useful to have for debugging, as PlayerInventory.indexOf() and PlayerInventory.getSlotWithStack() don't quite do the same thing. --- .../net/wurstclient/util/InventoryUtils.java | 70 +++++++++++++++---- 1 file changed, 58 insertions(+), 12 deletions(-) diff --git a/src/main/java/net/wurstclient/util/InventoryUtils.java b/src/main/java/net/wurstclient/util/InventoryUtils.java index 02a3aad1ba..de41474633 100644 --- a/src/main/java/net/wurstclient/util/InventoryUtils.java +++ b/src/main/java/net/wurstclient/util/InventoryUtils.java @@ -25,6 +25,63 @@ public enum InventoryUtils private static final MinecraftClient MC = WurstClient.MC; private static final IMinecraftClient IMC = WurstClient.IMC; + public static int indexOf(Item item) + { + return indexOf(stack -> stack.isOf(item), 36, false); + } + + public static int indexOf(Item item, int maxInvSlot) + { + return indexOf(stack -> stack.isOf(item), maxInvSlot, false); + } + + public static int indexOf(Item item, int maxInvSlot, boolean includeOffhand) + { + return indexOf(stack -> stack.isOf(item), maxInvSlot, includeOffhand); + } + + public static int indexOf(Predicate predicate) + { + return indexOf(predicate, 36, false); + } + + public static int indexOf(Predicate predicate, int maxInvSlot) + { + return indexOf(predicate, maxInvSlot, false); + } + + /** + * Searches the player's inventory from slot 0 to {@code maxInvSlot-1} for + * the first item that matches the given predicate and returns its slot, or + * -1 if no such item was found. + * + * @param predicate + * checks if an item is the one you want + * @param maxInvSlot + * the maximum slot to search (exclusive), usually 9 for the + * hotbar or 36 for the whole inventory + * @param includeOffhand + * also search the offhand (slot 40), even if maxInvSlot is lower + * @return + * the slot of the item, or -1 if no such item was found + */ + public static int indexOf(Predicate predicate, int maxInvSlot, + boolean includeOffhand) + { + PlayerInventory inventory = MC.player.getInventory(); + + // create a stream of all slots that we want to search + IntStream stream = IntStream.range(0, maxInvSlot); + if(includeOffhand) + stream = IntStream.concat(stream, IntStream.of(40)); + + // find the slot of the item we want + int slot = stream.filter(i -> predicate.test(inventory.getStack(i))) + .findFirst().orElse(-1); + + return slot; + } + public static boolean selectItem(Item item) { return selectItem(stack -> stack.isOf(item), 36, false); @@ -78,18 +135,7 @@ public static boolean selectItem(Predicate predicate, public static boolean selectItem(Predicate predicate, int maxInvSlot, boolean takeFromOffhand) { - PlayerInventory inventory = MC.player.getInventory(); - - // create a stream of all slots that we want to search - IntStream stream = IntStream.range(0, maxInvSlot); - if(takeFromOffhand) - stream = IntStream.concat(stream, IntStream.of(40)); - - // find the slot of the item we want - int slot = stream.filter(i -> predicate.test(inventory.getStack(i))) - .findFirst().orElse(-1); - - return selectItem(slot); + return selectItem(indexOf(predicate, maxInvSlot, takeFromOffhand)); } /** From 7a8ce6b70f9ff862219b561c240baf01ffeb43c8 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 29 May 2023 13:05:52 +0200 Subject: [PATCH 121/282] Clean up AutoFarm's replanting logic --- .../net/wurstclient/hacks/AutoFarmHack.java | 192 ++++++++---------- 1 file changed, 87 insertions(+), 105 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/AutoFarmHack.java b/src/main/java/net/wurstclient/hacks/AutoFarmHack.java index dc21084ec4..6de6c02133 100644 --- a/src/main/java/net/wurstclient/hacks/AutoFarmHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoFarmHack.java @@ -7,21 +7,13 @@ */ package net.wurstclient.hacks; -import java.util.ArrayDeque; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Set; +import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; import net.minecraft.block.*; -import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.network.packet.c2s.play.HandSwingC2SPacket; import net.minecraft.registry.tag.BlockTags; @@ -42,6 +34,7 @@ import net.wurstclient.util.BlockPlacer; import net.wurstclient.util.BlockPlacer.BlockPlacingParams; import net.wurstclient.util.BlockUtils; +import net.wurstclient.util.InventoryUtils; import net.wurstclient.util.OverlayRenderer; import net.wurstclient.util.RotationUtils; @@ -69,7 +62,7 @@ public final class AutoFarmHack extends Hack private final HashMap plants = new HashMap<>(); private final ArrayDeque> prevBlocks = new ArrayDeque<>(); - private BlockPos currentBlock; + private BlockPos currentlyHarvesting; private final AutoFarmRenderer renderer = new AutoFarmRenderer(); private final OverlayRenderer overlay = new OverlayRenderer(); @@ -100,11 +93,11 @@ public void onDisable() EVENTS.remove(UpdateListener.class, this); EVENTS.remove(RenderListener.class, this); - if(currentBlock != null) + if(currentlyHarvesting != null) { IMC.getInteractionManager().setBreakingBlock(true); MC.interactionManager.cancelBlockBreaking(); - currentBlock = null; + currentlyHarvesting = null; } prevBlocks.clear(); @@ -117,50 +110,48 @@ public void onDisable() @Override public void onUpdate() { - currentBlock = null; + currentlyHarvesting = null; Vec3d eyesVec = RotationUtils.getEyesPos().subtract(0.5, 0.5, 0.5); BlockPos eyesBlock = BlockPos.ofFloored(RotationUtils.getEyesPos()); double rangeSq = range.getValueSq(); int blockRange = range.getValueCeil(); - List blocks = BlockUtils + // get nearby, non-empty blocks + ArrayList blocks = BlockUtils .getAllInBoxStream(eyesBlock, blockRange) .filter(pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos)) <= rangeSq) - .filter(BlockUtils::canBeClicked).collect(Collectors.toList()); + .filter(BlockUtils::canBeClicked) + .collect(Collectors.toCollection(ArrayList::new)); + // check for any new plants and add them to the map updatePlants(blocks); - List blocksToHarvest = new ArrayList<>(); - List blocksToReplant = new ArrayList<>(); + ArrayList blocksToHarvest = new ArrayList<>(); + ArrayList blocksToReplant = new ArrayList<>(); + // don't place or break any blocks while Freecam is enabled if(!WURST.getHax().freecamHack.isEnabled()) { + // check which of the nearby blocks can be harvested blocksToHarvest = getBlocksToHarvest(eyesVec, blocks); + // do a new search to find empty blocks that can be replanted if(replant.isChecked()) blocksToReplant = getBlocksToReplant(eyesVec, eyesBlock, rangeSq, blockRange); } - boolean replanting = false; - while(!blocksToReplant.isEmpty()) - { - BlockPos pos = blocksToReplant.get(0); - Item neededItem = plants.get(pos); - if(tryToReplant(pos, neededItem)) - { - replanting = true; - break; - } - - blocksToReplant.removeIf(p -> plants.get(p) == neededItem); - } + // first, try to replant + boolean replanting = replant(blocksToReplant); + // if we can't replant, harvest instead if(!replanting) harvest(blocksToHarvest); - busy = !blocksToHarvest.isEmpty() || !blocksToReplant.isEmpty(); + // upate busy state + busy = replanting || currentlyHarvesting != null; + // update renderer renderer.updateVertexBuffers(blocksToHarvest, plants.keySet(), blocksToReplant); } @@ -169,7 +160,7 @@ public void onUpdate() public void onRender(MatrixStack matrixStack, float partialTicks) { renderer.render(matrixStack); - overlay.render(matrixStack, partialTicks, currentBlock); + overlay.render(matrixStack, partialTicks, currentlyHarvesting); } /** @@ -192,13 +183,13 @@ private void updatePlants(List blocks) } } - private List getBlocksToHarvest(Vec3d eyesVec, - List blocks) + private ArrayList getBlocksToHarvest(Vec3d eyesVec, + ArrayList blocks) { return blocks.parallelStream().filter(this::shouldBeHarvested) .sorted(Comparator.comparingDouble( pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos)))) - .collect(Collectors.toList()); + .collect(Collectors.toCollection(ArrayList::new)); } private boolean shouldBeHarvested(BlockPos pos) @@ -239,8 +230,8 @@ private boolean shouldBeHarvested(BlockPos pos) return false; } - private List getBlocksToReplant(Vec3d eyesVec, BlockPos eyesBlock, - double rangeSq, int blockRange) + private ArrayList getBlocksToReplant(Vec3d eyesVec, + BlockPos eyesBlock, double rangeSq, int blockRange) { return BlockUtils.getAllInBoxStream(eyesBlock, blockRange) .filter(pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos)) <= rangeSq) @@ -248,7 +239,7 @@ private List getBlocksToReplant(Vec3d eyesVec, BlockPos eyesBlock, .filter(pos -> plants.containsKey(pos)).filter(this::canBeReplanted) .sorted(Comparator.comparingDouble( pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos)))) - .collect(Collectors.toList()); + .collect(Collectors.toCollection(ArrayList::new)); } private boolean canBeReplanted(BlockPos pos) @@ -272,83 +263,73 @@ private boolean canBeReplanted(BlockPos pos) return false; } - private boolean tryToReplant(BlockPos pos, Item neededItem) + private boolean replant(List blocksToReplant) { - ClientPlayerEntity player = MC.player; - ItemStack heldItem = player.getMainHandStack(); + // check cooldown + if(IMC.getItemUseCooldown() > 0) + return false; - if(!heldItem.isEmpty() && heldItem.getItem() == neededItem) - { - placeBlockSimple(pos); - return IMC.getItemUseCooldown() <= 0; - } + // check if already holding one of the seeds needed for blocksToReplant + Optional heldSeed = blocksToReplant.stream().map(plants::get) + .distinct().filter(item -> MC.player.isHolding(item)).findFirst(); - for(int slot = 0; slot < 36; slot++) + // if so, try to replant the blocks that need that seed + if(heldSeed.isPresent()) { - if(slot == player.getInventory().selectedSlot) - continue; + // get the seed and the hand that is holding it + Item item = heldSeed.get(); + Hand hand = MC.player.getMainHandStack().isOf(item) ? Hand.MAIN_HAND + : Hand.OFF_HAND; - ItemStack stack = player.getInventory().getStack(slot); - if(stack.isEmpty() || stack.getItem() != neededItem) - continue; + // filter out blocks that need a different seed + ArrayList blocksToReplantWithHeldSeed = + blocksToReplant.stream().filter(pos -> plants.get(pos) == item) + .collect(Collectors.toCollection(ArrayList::new)); - if(slot < 9) - player.getInventory().selectedSlot = slot; - else if(player.getInventory().getEmptySlot() < 9) - IMC.getInteractionManager().windowClick_QUICK_MOVE(slot); - else if(player.getInventory().getEmptySlot() != -1) - { - IMC.getInteractionManager().windowClick_QUICK_MOVE( - player.getInventory().selectedSlot + 36); - IMC.getInteractionManager().windowClick_QUICK_MOVE(slot); - }else + for(BlockPos pos : blocksToReplantWithHeldSeed) { - IMC.getInteractionManager().windowClick_PICKUP( - player.getInventory().selectedSlot + 36); - IMC.getInteractionManager().windowClick_PICKUP(slot); - IMC.getInteractionManager().windowClick_PICKUP( - player.getInventory().selectedSlot + 36); + // skip over blocks that we can't reach + BlockPlacingParams params = + BlockPlacer.getBlockPlacingParams(pos); + if(params == null || params.distanceSq() > range.getValueSq()) + continue; + + // face block + WURST.getRotationFaker().faceVectorPacket(params.hitVec()); + + // place seed + ActionResult result = MC.interactionManager + .interactBlock(MC.player, hand, params.toHitResult()); + + // swing arm + if(result.isAccepted() && result.shouldSwingHand()) + MC.player.networkHandler + .sendPacket(new HandSwingC2SPacket(hand)); + + // reset cooldown + IMC.setItemUseCooldown(4); + return true; } + } + + // otherwise, find a block that we can reach and have seeds for + for(BlockPos pos : blocksToReplant) + { + // skip over blocks that we can't reach + BlockPlacingParams params = BlockPlacer.getBlockPlacingParams(pos); + if(params == null || params.distanceSq() > range.getValueSq()) + continue; - return true; + // try to select the seed (returns false if we don't have it) + Item item = plants.get(pos); + if(InventoryUtils.selectItem(item)) + return true; } + // if we couldn't replant anything, return false return false; } - private void placeBlockSimple(BlockPos pos) - { - // should never happen, but just in case - if(!BlockUtils.getState(pos).isReplaceable()) - return; - - BlockPlacingParams params = BlockPlacer.getBlockPlacingParams(pos); - if(params == null || params.distanceSq() > range.getValueSq()) - return; - - // face block - WURST.getRotationFaker().faceVectorPacket(params.hitVec()); - if(RotationUtils.getAngleToLastReportedLookVec(params.hitVec()) > 1) - return; - - // check cooldown - if(IMC.getItemUseCooldown() > 0) - return; - - Hand hand = Hand.MAIN_HAND; - - // place block - ActionResult result = MC.interactionManager.interactBlock(MC.player, - hand, params.toHitResult()); - - // swing arm - if(result.isAccepted() && result.shouldSwingHand()) - MC.player.networkHandler.sendPacket(new HandSwingC2SPacket(hand)); - - // reset cooldown - IMC.setItemUseCooldown(4); - } - private void harvest(List blocksToHarvest) { if(MC.player.getAbilities().creativeMode) @@ -363,7 +344,7 @@ private void harvest(List blocksToHarvest) prevBlocks.removeFirst(); if(!filteredBlocks.isEmpty()) - currentBlock = filteredBlocks.get(0); + currentlyHarvesting = filteredBlocks.get(0); MC.interactionManager.cancelBlockBreaking(); overlay.resetProgress(); @@ -374,14 +355,15 @@ private void harvest(List blocksToHarvest) for(BlockPos pos : blocksToHarvest) if(BlockBreaker.breakOneBlock(pos)) { - currentBlock = pos; + currentlyHarvesting = pos; break; } - if(currentBlock == null) + if(currentlyHarvesting == null) MC.interactionManager.cancelBlockBreaking(); - if(currentBlock != null && BlockUtils.getHardness(currentBlock) < 1) + if(currentlyHarvesting != null + && BlockUtils.getHardness(currentlyHarvesting) < 1) overlay.updateProgress(); else overlay.resetProgress(); From 67aeb439d55cbbf196b1ad843f67c98786b74565 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Tue, 30 May 2023 11:08:49 +0200 Subject: [PATCH 122/282] [Wurst-Bot] Update to 1.20-pre7 --- gradle.properties | 8 +- .../java/net/wurstclient/WurstClient.java | 2 +- .../wurstclient/mixin/StatsScreenMixin.java | 154 +++++++------- .../wurstclient/mixin/TitleScreenMixin.java | 188 +++++++++--------- 4 files changed, 176 insertions(+), 176 deletions(-) diff --git a/gradle.properties b/gradle.properties index 9ef5445b03..7235d988d7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,15 +4,15 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these at https://fabricmc.net/develop/ and # https://www.curseforge.com/minecraft/mc-mods/fabric-api -minecraft_version=1.20-pre6 -yarn_mappings=1.20-pre6+build.2 -loader_version=0.14.20 +minecraft_version=1.20-pre7 +yarn_mappings=1.20-pre7+build.2 +loader_version=0.14.21 #Fabric api fabric_version=0.82.1+1.20 # Mod Properties -mod_version = v7.35-MC1.20-pre6 +mod_version = v7.35-MC1.20-pre7 maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index 450cd537c7..7143a19a40 100644 --- a/src/main/java/net/wurstclient/WurstClient.java +++ b/src/main/java/net/wurstclient/WurstClient.java @@ -57,7 +57,7 @@ public enum WurstClient public static IMinecraftClient IMC; public static final String VERSION = "7.35"; - public static final String MC_VERSION = "1.20-pre6"; + public static final String MC_VERSION = "1.20-pre7"; private WurstAnalytics analytics; private EventManager eventManager; diff --git a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java index 187f0eeda4..31ba96df23 100644 --- a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java @@ -1,77 +1,77 @@ -/* - * Copyright (c) 2014-2023 Wurst-Imperium and contributors. - * - * This source code is subject to the terms of the GNU General Public - * License, version 3. If a copy of the GPL was not distributed with this - * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt - */ -package net.wurstclient.mixin; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import net.minecraft.client.gui.Drawable; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.StatsListener; -import net.minecraft.client.gui.screen.StatsScreen; -import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.client.gui.widget.ClickableWidget; -import net.minecraft.client.resource.language.I18n; -import net.minecraft.text.Text; -import net.wurstclient.WurstClient; -import net.wurstclient.mixinterface.IScreen; - -@Mixin(StatsScreen.class) -public abstract class StatsScreenMixin extends Screen implements StatsListener -{ - private StatsScreenMixin(WurstClient wurst, Text text_1) - { - super(text_1); - } - - @Inject(at = {@At("TAIL")}, method = {"createButtons()V"}) - private void onCreateButtons(CallbackInfo ci) - { - if(WurstClient.INSTANCE.getOtfs().disableOtf.shouldHideEnableButton()) - return; - - ButtonWidget toggleWurstButton = - ButtonWidget.builder(Text.literal(""), this::toggleWurst) - .dimensions(width / 2 - 152, height - 28, 150, 20).build(); - - updateWurstButtonText(toggleWurstButton); - addDrawableChild(toggleWurstButton); - - for(Drawable d : ((IScreen)this).getButtons()) - { - if(!(d instanceof ClickableWidget)) - continue; - - ClickableWidget button = (ClickableWidget)d; - - if(!button.getMessage().getString() - .equals(I18n.translate("gui.done"))) - continue; - - button.setX(width / 2 + 2); - button.setWidth(150); - } - } - - private void toggleWurst(ButtonWidget button) - { - WurstClient wurst = WurstClient.INSTANCE; - wurst.setEnabled(!wurst.isEnabled()); - - updateWurstButtonText(button); - } - - private void updateWurstButtonText(ButtonWidget button) - { - WurstClient wurst = WurstClient.INSTANCE; - String text = (wurst.isEnabled() ? "Disable" : "Enable") + " Wurst"; - button.setMessage(Text.literal(text)); - } -} +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import net.minecraft.client.gui.Drawable; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.screen.StatsListener; +import net.minecraft.client.gui.screen.StatsScreen; +import net.minecraft.client.gui.widget.ButtonWidget; +import net.minecraft.client.gui.widget.ClickableWidget; +import net.minecraft.client.resource.language.I18n; +import net.minecraft.text.Text; +import net.wurstclient.WurstClient; +import net.wurstclient.mixinterface.IScreen; + +@Mixin(StatsScreen.class) +public abstract class StatsScreenMixin extends Screen implements StatsListener +{ + private StatsScreenMixin(WurstClient wurst, Text text_1) + { + super(text_1); + } + + @Inject(at = {@At("TAIL")}, method = {"createButtons()V"}) + private void onCreateButtons(CallbackInfo ci) + { + if(WurstClient.INSTANCE.getOtfs().disableOtf.shouldHideEnableButton()) + return; + + ButtonWidget toggleWurstButton = + ButtonWidget.builder(Text.literal(""), this::toggleWurst) + .dimensions(width / 2 - 152, height - 28, 150, 20).build(); + + updateWurstButtonText(toggleWurstButton); + addDrawableChild(toggleWurstButton); + + for(Drawable d : ((IScreen)this).getButtons()) + { + if(!(d instanceof ClickableWidget)) + continue; + + ClickableWidget button = (ClickableWidget)d; + + if(!button.getMessage().getString() + .equals(I18n.translate("gui.done"))) + continue; + + button.setX(width / 2 + 2); + button.setWidth(150); + } + } + + private void toggleWurst(ButtonWidget button) + { + WurstClient wurst = WurstClient.INSTANCE; + wurst.setEnabled(!wurst.isEnabled()); + + updateWurstButtonText(button); + } + + private void updateWurstButtonText(ButtonWidget button) + { + WurstClient wurst = WurstClient.INSTANCE; + String text = (wurst.isEnabled() ? "Disable" : "Enable") + " Wurst"; + button.setMessage(Text.literal(text)); + } +} diff --git a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java index 28488e077b..bbe585269c 100644 --- a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java @@ -1,94 +1,94 @@ -/* - * Copyright (c) 2014-2023 Wurst-Imperium and contributors. - * - * This source code is subject to the terms of the GNU General Public - * License, version 3. If a copy of the GPL was not distributed with this - * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt - */ -package net.wurstclient.mixin; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -import net.minecraft.client.gui.Drawable; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.TitleScreen; -import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.client.gui.widget.ClickableWidget; -import net.minecraft.client.resource.language.I18n; -import net.minecraft.text.Text; -import net.wurstclient.WurstClient; -import net.wurstclient.altmanager.screens.AltManagerScreen; -import net.wurstclient.mixinterface.IScreen; - -@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 = {"init()V"}) - private void onInitWidgetsNormal(CallbackInfo ci) - { - if(!WurstClient.INSTANCE.isEnabled()) - return; - - for(Drawable d : ((IScreen)this).getButtons()) - { - if(!(d instanceof ClickableWidget)) - continue; - - ClickableWidget button = (ClickableWidget)d; - if(!button.getMessage().getString() - .equals(I18n.translate("menu.online"))) - continue; - - 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 = ButtonWidget - .builder(Text.literal("Alt Manager"), - b -> client.setScreen(new AltManagerScreen(this, - WurstClient.INSTANCE.getAltManager()))) - .dimensions(width / 2 + 2, realmsButton.getY(), 98, 20).build()); - } - - @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.setY(realmsButton.getY()); - } - - /** - * Stops the multiplayer button being grayed out if the user's Microsoft - * account is parental-control'd or banned from online play. - */ - @Inject(at = @At("HEAD"), - method = "getMultiplayerDisabledText()Lnet/minecraft/text/Text;", - cancellable = true) - private void onGetMultiplayerDisabledText(CallbackInfoReturnable cir) - { - cir.setReturnValue(null); - } -} +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import net.minecraft.client.gui.Drawable; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.screen.TitleScreen; +import net.minecraft.client.gui.widget.ButtonWidget; +import net.minecraft.client.gui.widget.ClickableWidget; +import net.minecraft.client.resource.language.I18n; +import net.minecraft.text.Text; +import net.wurstclient.WurstClient; +import net.wurstclient.altmanager.screens.AltManagerScreen; +import net.wurstclient.mixinterface.IScreen; + +@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 = {"init()V"}) + private void onInitWidgetsNormal(CallbackInfo ci) + { + if(!WurstClient.INSTANCE.isEnabled()) + return; + + for(Drawable d : ((IScreen)this).getButtons()) + { + if(!(d instanceof ClickableWidget)) + continue; + + ClickableWidget button = (ClickableWidget)d; + if(!button.getMessage().getString() + .equals(I18n.translate("menu.online"))) + continue; + + 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 = ButtonWidget + .builder(Text.literal("Alt Manager"), + b -> client.setScreen(new AltManagerScreen(this, + WurstClient.INSTANCE.getAltManager()))) + .dimensions(width / 2 + 2, realmsButton.getY(), 98, 20).build()); + } + + @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.setY(realmsButton.getY()); + } + + /** + * Stops the multiplayer button being grayed out if the user's Microsoft + * account is parental-control'd or banned from online play. + */ + @Inject(at = @At("HEAD"), + method = "getMultiplayerDisabledText()Lnet/minecraft/text/Text;", + cancellable = true) + private void onGetMultiplayerDisabledText(CallbackInfoReturnable cir) + { + cir.setReturnValue(null); + } +} From ae410456c5bcb15b7574243bfb36f43219cdf82f Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Tue, 30 May 2023 11:29:19 +0200 Subject: [PATCH 123/282] Change version to 7.35.1 --- gradle.properties | 2 +- src/main/java/net/wurstclient/WurstClient.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 747a5ca97f..b13ad16a96 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ loader_version=0.14.19 fabric_version=0.81.1+1.19.4 # Mod Properties -mod_version = v7.35-MC1.19.4 +mod_version = v7.35.1-MC1.19.4 maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index fe5abe63b6..1282fec59c 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 MinecraftClient MC; public static IMinecraftClient IMC; - public static final String VERSION = "7.35"; + public static final String VERSION = "7.35.1"; public static final String MC_VERSION = "1.19.4"; private WurstAnalytics analytics; From b0fb08ff710534410d10958c436f523520125517 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Tue, 30 May 2023 11:34:31 +0200 Subject: [PATCH 124/282] Update Fabric stuff --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index b13ad16a96..d4abd8105a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,10 +6,10 @@ org.gradle.jvmargs=-Xmx1G # https://www.curseforge.com/minecraft/mc-mods/fabric-api minecraft_version=1.19.4 yarn_mappings=1.19.4+build.2 -loader_version=0.14.19 +loader_version=0.14.21 #Fabric api -fabric_version=0.81.1+1.19.4 +fabric_version=0.82.0+1.19.4 # Mod Properties mod_version = v7.35.1-MC1.19.4 From d1416ca74d82c558c1496fc3246c8598338f4d3d Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 31 May 2023 16:05:12 +0200 Subject: [PATCH 125/282] [Wurst-Bot] Update to 1.20-rc1 --- gradle.properties | 8 ++++---- src/main/java/net/wurstclient/WurstClient.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index 885bb2f39b..496290f728 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,15 +4,15 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these at https://fabricmc.net/develop/ and # https://www.curseforge.com/minecraft/mc-mods/fabric-api -minecraft_version=1.20-pre7 -yarn_mappings=1.20-pre7+build.2 +minecraft_version=1.20-rc1 +yarn_mappings=1.20-rc1+build.1 loader_version=0.14.21 #Fabric api -fabric_version=0.82.1+1.20 +fabric_version=0.83.0+1.20 # Mod Properties -mod_version = v7.35.1-MC1.20-pre7 +mod_version = v7.35.1-MC1.20-rc1 maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index 827ae272cf..12b5e8491b 100644 --- a/src/main/java/net/wurstclient/WurstClient.java +++ b/src/main/java/net/wurstclient/WurstClient.java @@ -57,7 +57,7 @@ public enum WurstClient public static IMinecraftClient IMC; public static final String VERSION = "7.35.1"; - public static final String MC_VERSION = "1.20-pre7"; + public static final String MC_VERSION = "1.20-rc1"; private WurstAnalytics analytics; private EventManager eventManager; From 81f0121e7c35bdb8cdcfe056b9a949d92b3a692e Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 4 Jun 2023 11:41:08 +0200 Subject: [PATCH 126/282] Allow connection to shadowbanned servers --- .../mixin/AllowedAddressResolverMixin.java | 60 +++++++++++++++++++ src/main/resources/wurst.mixins.json | 1 + 2 files changed, 61 insertions(+) create mode 100644 src/main/java/net/wurstclient/mixin/AllowedAddressResolverMixin.java diff --git a/src/main/java/net/wurstclient/mixin/AllowedAddressResolverMixin.java b/src/main/java/net/wurstclient/mixin/AllowedAddressResolverMixin.java new file mode 100644 index 0000000000..1fe53f1edf --- /dev/null +++ b/src/main/java/net/wurstclient/mixin/AllowedAddressResolverMixin.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.mixin; + +import java.util.Optional; + +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import net.minecraft.client.network.Address; +import net.minecraft.client.network.AddressResolver; +import net.minecraft.client.network.AllowedAddressResolver; +import net.minecraft.client.network.RedirectResolver; +import net.minecraft.client.network.ServerAddress; +import net.wurstclient.WurstClient; + +@Mixin(AllowedAddressResolver.class) +public class AllowedAddressResolverMixin +{ + @Shadow + @Final + private AddressResolver addressResolver; + + @Shadow + @Final + private RedirectResolver redirectResolver; + + /** + * This mixin allows users to connect to servers that have been shadowbanned + * by Mojang, such as CS:GO and GTA clones that are apparently "too + * adult-oriented" for having pixelated guns. + */ + @Inject(at = @At("HEAD"), + method = "resolve(Lnet/minecraft/client/network/ServerAddress;)Ljava/util/Optional;", + cancellable = true) + public void resolve(ServerAddress address, + CallbackInfoReturnable> cir) + { + if(!WurstClient.INSTANCE.isEnabled()) + return; + + Optional

optionalAddress = addressResolver.resolve(address); + Optional optionalRedirect = + redirectResolver.lookupRedirect(address); + + if(optionalRedirect.isPresent()) + optionalAddress = addressResolver.resolve(optionalRedirect.get()); + + cir.setReturnValue(optionalAddress); + } +} diff --git a/src/main/resources/wurst.mixins.json b/src/main/resources/wurst.mixins.json index e8a7224bcc..383cf6a263 100644 --- a/src/main/resources/wurst.mixins.json +++ b/src/main/resources/wurst.mixins.json @@ -8,6 +8,7 @@ "client": [ "AbstractBlockStateMixin", "AbstractSignEditScreenMixin", + "AllowedAddressResolverMixin", "ArmorItemMixin", "BackgroundRendererMixin", "BlockEntityRenderDispatcherMixin", From 5bd1319c11fdcb25e83b3d6a93526e4cab3eb5be Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 7 Jun 2023 17:17:49 +0200 Subject: [PATCH 127/282] [Wurst-Bot] Update to 1.20 --- gradle.properties | 6 +++--- src/main/java/net/wurstclient/WurstClient.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 496290f728..adcb17ec3c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,15 +4,15 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these at https://fabricmc.net/develop/ and # https://www.curseforge.com/minecraft/mc-mods/fabric-api -minecraft_version=1.20-rc1 -yarn_mappings=1.20-rc1+build.1 +minecraft_version=1.20 +yarn_mappings=1.20+build.1 loader_version=0.14.21 #Fabric api fabric_version=0.83.0+1.20 # Mod Properties -mod_version = v7.35.1-MC1.20-rc1 +mod_version = v7.35.1-MC1.20 maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index 12b5e8491b..d2525c8b91 100644 --- a/src/main/java/net/wurstclient/WurstClient.java +++ b/src/main/java/net/wurstclient/WurstClient.java @@ -57,7 +57,7 @@ public enum WurstClient public static IMinecraftClient IMC; public static final String VERSION = "7.35.1"; - public static final String MC_VERSION = "1.20-rc1"; + public static final String MC_VERSION = "1.20"; private WurstAnalytics analytics; private EventManager eventManager; From d58cceea60459ad734c3d2650d5c89c64216827c Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Fri, 9 Jun 2023 22:29:23 +0200 Subject: [PATCH 128/282] Update to 1.20.1-rc1 --- gradle.properties | 8 ++++---- src/main/java/net/wurstclient/WurstClient.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index adcb17ec3c..3f9a96e12f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,15 +4,15 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these at https://fabricmc.net/develop/ and # https://www.curseforge.com/minecraft/mc-mods/fabric-api -minecraft_version=1.20 -yarn_mappings=1.20+build.1 +minecraft_version=1.20.1-rc1 +yarn_mappings=1.20.1-rc1+build.1 loader_version=0.14.21 #Fabric api -fabric_version=0.83.0+1.20 +fabric_version=0.83.0+1.20.1 # Mod Properties -mod_version = v7.35.1-MC1.20 +mod_version = v7.35.1-MC1.20.1-rc1 maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index d2525c8b91..e5378b5222 100644 --- a/src/main/java/net/wurstclient/WurstClient.java +++ b/src/main/java/net/wurstclient/WurstClient.java @@ -57,7 +57,7 @@ public enum WurstClient public static IMinecraftClient IMC; public static final String VERSION = "7.35.1"; - public static final String MC_VERSION = "1.20"; + public static final String MC_VERSION = "1.20.1-rc1"; private WurstAnalytics analytics; private EventManager eventManager; From db1dedb2fee8f26223e40a35df2142dbd651e660 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 12 Jun 2023 16:42:41 +0200 Subject: [PATCH 129/282] [Wurst-Bot] Update to 1.20.1 --- gradle.properties | 6 +++--- src/main/java/net/wurstclient/WurstClient.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 3f9a96e12f..d98c334d2d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,15 +4,15 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these at https://fabricmc.net/develop/ and # https://www.curseforge.com/minecraft/mc-mods/fabric-api -minecraft_version=1.20.1-rc1 -yarn_mappings=1.20.1-rc1+build.1 +minecraft_version=1.20.1 +yarn_mappings=1.20.1+build.1 loader_version=0.14.21 #Fabric api fabric_version=0.83.0+1.20.1 # Mod Properties -mod_version = v7.35.1-MC1.20.1-rc1 +mod_version = v7.35.1-MC1.20.1 maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index e5378b5222..014f2cb0dd 100644 --- a/src/main/java/net/wurstclient/WurstClient.java +++ b/src/main/java/net/wurstclient/WurstClient.java @@ -57,7 +57,7 @@ public enum WurstClient public static IMinecraftClient IMC; public static final String VERSION = "7.35.1"; - public static final String MC_VERSION = "1.20.1-rc1"; + public static final String MC_VERSION = "1.20.1"; private WurstAnalytics analytics; private EventManager eventManager; From ce0265081c1f844df185d4fe6032f29fe5723ad5 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Tue, 13 Jun 2023 10:55:48 +0200 Subject: [PATCH 130/282] Remove "contents: read" permission I don't think this permission is actually necessary. --- .github/workflows/gradle.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 4286e2293c..bf8f667769 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -21,9 +21,6 @@ on: - 'gradle**' - 'build.gradle' -permissions: - contents: read - jobs: build: From 1cb64f04a3827c54315151e944cad15f9345e13e Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Tue, 13 Jun 2023 11:03:37 +0200 Subject: [PATCH 131/282] Allow CI to run on any branch --- .github/workflows/gradle.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index bf8f667769..a73c7a70b8 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -9,13 +9,11 @@ name: Java CI with Gradle on: push: - branches: [ "master" ] paths: - '**.java' - 'gradle**' - 'build.gradle' pull_request: - branches: [ "master" ] paths: - '**.java' - 'gradle**' @@ -23,9 +21,7 @@ on: jobs: build: - runs-on: ubuntu-latest - steps: - uses: actions/checkout@v3 - name: Set up JDK 17 From 50b81da8bbf0ac85935a8467b8df1c113c827bdc Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Tue, 13 Jun 2023 11:10:52 +0200 Subject: [PATCH 132/282] Add gradle wrapper validation --- .github/workflows/gradle.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index a73c7a70b8..62f01a7f8d 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -1,10 +1,5 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. # This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle - name: Java CI with Gradle on: @@ -24,6 +19,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - uses: gradle/wrapper-validation-action@v1 - name: Set up JDK 17 uses: actions/setup-java@v3 with: From dae1a9db39d79fc3607efc3bbcae38af342c622a Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Tue, 13 Jun 2023 11:11:55 +0200 Subject: [PATCH 133/282] Add org.gradle.parallel=true --- gradle.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/gradle.properties b/gradle.properties index adcb17ec3c..ece0b6d652 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,6 @@ # Done to increase the memory available to gradle. org.gradle.jvmargs=-Xmx1G +org.gradle.parallel=true # Fabric Properties # check these at https://fabricmc.net/develop/ and From 2749eb4874d5a65fd0c324622fc3da5f6c43f888 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Tue, 13 Jun 2023 14:01:56 +0200 Subject: [PATCH 134/282] Update jsonsyntax.yml --- .github/workflows/jsonsyntax.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/jsonsyntax.yml b/.github/workflows/jsonsyntax.yml index 1daceaffd9..2a5f77c761 100644 --- a/.github/workflows/jsonsyntax.yml +++ b/.github/workflows/jsonsyntax.yml @@ -2,7 +2,6 @@ name: JSON syntax on: push: - branches: [ "master" ] paths: - '**.json' pull_request: @@ -14,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: json-syntax-check + - name: Check JSON syntax uses: limitusus/json-syntax-check@v2 with: pattern: "\\.json$" From 8d0701ec13a96554d2760578694a36507fab2001 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Tue, 20 Jun 2023 16:46:57 +0200 Subject: [PATCH 135/282] Add NoChatReportsOtf to chat category so it shows up in ClickGUI --- .../net/wurstclient/other_features/NoChatReportsOtf.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/net/wurstclient/other_features/NoChatReportsOtf.java b/src/main/java/net/wurstclient/other_features/NoChatReportsOtf.java index dea62aefb0..c6e38a451b 100644 --- a/src/main/java/net/wurstclient/other_features/NoChatReportsOtf.java +++ b/src/main/java/net/wurstclient/other_features/NoChatReportsOtf.java @@ -17,6 +17,7 @@ import net.minecraft.network.message.MessageChain; import net.minecraft.network.message.MessageSignatureData; import net.minecraft.text.Text; +import net.wurstclient.Category; import net.wurstclient.DontBlock; import net.wurstclient.SearchTags; import net.wurstclient.WurstClient; @@ -118,6 +119,12 @@ public void doPrimaryAction() disableSignatures.setChecked(!disableSignatures.isChecked()); } + @Override + public Category getCategory() + { + return Category.CHAT; + } + // See ChatHudMixin, ClientPlayNetworkHandlerMixin.onOnServerMetadata(), // MinecraftClientMixin.onGetProfileKeys() } From 49dc39c48e4f843df2874f96b8fc17500ef1d232 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Fri, 7 Jul 2023 11:10:38 +0200 Subject: [PATCH 136/282] Improve documentation in GameRendererMixin --- .../net/wurstclient/mixin/GameRendererMixin.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/wurstclient/mixin/GameRendererMixin.java b/src/main/java/net/wurstclient/mixin/GameRendererMixin.java index f29ddfaadd..8452a05c6d 100644 --- a/src/main/java/net/wurstclient/mixin/GameRendererMixin.java +++ b/src/main/java/net/wurstclient/mixin/GameRendererMixin.java @@ -37,6 +37,10 @@ public abstract class GameRendererMixin { private boolean cancelNextBobView; + /** + * Fires the CameraTransformViewBobbingEvent event and records whether the + * next view-bobbing call should be cancelled. + */ @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/GameRenderer;bobView(Lnet/minecraft/client/util/math/MatrixStack;F)V", ordinal = 0), @@ -52,6 +56,10 @@ private void onRenderWorldViewBobbing(float tickDelta, long limitTime, cancelNextBobView = true; } + /** + * Cancels the view-bobbing call if requested by the last + * CameraTransformViewBobbingEvent. + */ @Inject(at = @At("HEAD"), method = "bobView(Lnet/minecraft/client/util/math/MatrixStack;F)V", cancellable = true) @@ -65,9 +73,14 @@ private void onBobView(MatrixStack matrices, float tickDelta, cancelNextBobView = false; } + /** + * This mixin is injected into a random method call later in the + * renderWorld() method to ensure that cancelNextBobView is always reset + * after the view-bobbing call. + */ @Inject(at = @At("HEAD"), method = "renderHand(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/Camera;F)V") - private void renderHand(MatrixStack matrices, Camera camera, + private void onRenderHand(MatrixStack matrices, Camera camera, float tickDelta, CallbackInfo ci) { cancelNextBobView = false; From d9ccc4094e414063dc8489c8d8c9aef37b0812b3 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Fri, 7 Jul 2023 11:27:32 +0200 Subject: [PATCH 137/282] Remove Redirect in ClientPlayerEntityMixin to improve mod compatibility Fixes #397 Fixes #440 Fixes #573 Fixes #605 Fixes #607 Fixes https://wurstforum.net/d/15 --- .../mixin/ClientPlayerEntityMixin.java | 41 ++++++++++++++++--- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/wurstclient/mixin/ClientPlayerEntityMixin.java b/src/main/java/net/wurstclient/mixin/ClientPlayerEntityMixin.java index 0f3351b507..ed1e2cd5e5 100644 --- a/src/main/java/net/wurstclient/mixin/ClientPlayerEntityMixin.java +++ b/src/main/java/net/wurstclient/mixin/ClientPlayerEntityMixin.java @@ -13,7 +13,6 @@ import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @@ -57,6 +56,7 @@ public class ClientPlayerEntityMixin extends AbstractClientPlayerEntity protected MinecraftClient client; private Screen tempCurrentScreen; + private boolean hideNextItemUse; public ClientPlayerEntityMixin(WurstClient wurst, ClientWorld world, GameProfile profile) @@ -72,15 +72,46 @@ private void onTick(CallbackInfo ci) EventManager.fire(UpdateEvent.INSTANCE); } - @Redirect(at = @At(value = "INVOKE", + /** + * This mixin runs just before the tickMovement() method calls + * isUsingItem(), so that the onIsUsingItem() mixin knows which + * call to intercept. + */ + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isUsingItem()Z", ordinal = 0), method = "tickMovement()V") - private boolean wurstIsUsingItem(ClientPlayerEntity player) + private void onTickMovementItemUse(CallbackInfo ci) { if(WurstClient.INSTANCE.getHax().noSlowdownHack.isEnabled()) - return false; + hideNextItemUse = true; + } + + /** + * Pretends that the player is not using an item when instructed to do so by + * the onTickMovement() mixin. + */ + @Inject(at = @At("HEAD"), method = "isUsingItem()Z", cancellable = true) + private void onIsUsingItem(CallbackInfoReturnable cir) + { + if(!hideNextItemUse) + return; - return player.isUsingItem(); + cir.setReturnValue(false); + hideNextItemUse = false; + } + + /** + * This mixin is injected into a random field access later in the + * tickMovement() method to ensure that hideNextItemUse is always reset + * after the item use slowdown calculation. + */ + @Inject(at = @At(value = "FIELD", + target = "Lnet/minecraft/client/network/ClientPlayerEntity;ticksToNextAutojump:I", + opcode = Opcodes.GETFIELD, + ordinal = 0), method = "tickMovement()V") + private void afterIsUsingItem(CallbackInfo ci) + { + hideNextItemUse = false; } @Inject(at = @At("HEAD"), method = "sendMovementPackets()V") From ceebaebac10fe203e3bf1ca9a3aebc457aedf452 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Fri, 7 Jul 2023 21:58:51 +0200 Subject: [PATCH 138/282] Fix crash when files within encryption folder have incorrect permissions Now this will just disable AltManager's file IO, the same way it does when access to the ".Wurst encryption" folder itself is denied. --- .../java/net/wurstclient/altmanager/Encryption.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/wurstclient/altmanager/Encryption.java b/src/main/java/net/wurstclient/altmanager/Encryption.java index fea011940c..9bd2fbbbd1 100644 --- a/src/main/java/net/wurstclient/altmanager/Encryption.java +++ b/src/main/java/net/wurstclient/altmanager/Encryption.java @@ -195,6 +195,7 @@ public void toEncryptedJson(JsonObject json, Path path) } private KeyPair getRsaKeyPair(Path publicFile, Path privateFile) + throws IOException { if(Files.notExists(publicFile) || Files.notExists(privateFile)) return createRsaKeys(publicFile, privateFile); @@ -213,7 +214,7 @@ private KeyPair getRsaKeyPair(Path publicFile, Path privateFile) } } - private SecretKey getAesKey(Path path, KeyPair pair) + private SecretKey getAesKey(Path path, KeyPair pair) throws IOException { if(Files.notExists(path)) return createAesKey(path, pair); @@ -232,6 +233,7 @@ private SecretKey getAesKey(Path path, KeyPair pair) } private KeyPair createRsaKeys(Path publicFile, Path privateFile) + throws IOException { try { @@ -268,14 +270,14 @@ private KeyPair createRsaKeys(Path publicFile, Path privateFile) return pair; - }catch(GeneralSecurityException | IOException e) + }catch(GeneralSecurityException e) { throw new CrashException( CrashReport.create(e, "Creating RSA keypair")); } } - private SecretKey createAesKey(Path path, KeyPair pair) + private SecretKey createAesKey(Path path, KeyPair pair) throws IOException { try { @@ -293,7 +295,7 @@ private SecretKey createAesKey(Path path, KeyPair pair) return key; - }catch(GeneralSecurityException | IOException e) + }catch(GeneralSecurityException e) { throw new CrashException(CrashReport.create(e, "Creating AES key")); } From 43c6a64f011e9c44572e08119b96329cfca7d304 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 9 Jul 2023 11:49:35 +0200 Subject: [PATCH 139/282] Replace Reddit links with WurstForum --- .github/ISSUE_TEMPLATE/config.yml | 4 ++-- .../java/net/wurstclient/options/WurstOptionsScreen.java | 9 +++++---- src/main/resources/fabric.mod.json | 1 + 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index e91fc221de..c3c1d33356 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,7 +1,7 @@ blank_issues_enabled: true contact_links: - - name: Reddit Community - url: https://www.reddit.com/r/WurstClient/ + - name: WurstForum + url: https://wurstforum.net/?utm_source=GitHub&utm_medium=Wurst7+repo about: For general discussion, support, memes, etc. - name: Contact Alexander url: https://www.wurstclient.net/contact/?utm_source=GitHub&utm_medium=Wurst7&utm_campaign=Issues&utm_content=Contact+Alexander diff --git a/src/main/java/net/wurstclient/options/WurstOptionsScreen.java b/src/main/java/net/wurstclient/options/WurstOptionsScreen.java index 6a3d9bc547..8cce4e9d9d 100644 --- a/src/main/java/net/wurstclient/options/WurstOptionsScreen.java +++ b/src/main/java/net/wurstclient/options/WurstOptionsScreen.java @@ -128,11 +128,12 @@ private void addLinkButtons() b -> os.open( "https://wurst.wiki/?utm_source=Wurst+Client&utm_medium=Wurst+Options&utm_content=Wurst+Wiki")); - new WurstOptionsButton(54, 72, () -> "Twitter", "@Wurst_Imperium", - b -> os.open("https://www.wurstclient.net/twitter/")); + new WurstOptionsButton(54, 72, () -> "WurstForum", "WurstForum.net", + b -> os.open( + "https://wurstforum.net/?utm_source=Wurst+Client&utm_medium=Wurst+Options&utm_content=WurstForum")); - new WurstOptionsButton(54, 96, () -> "Reddit", "r/WurstClient", - b -> os.open("https://www.wurstclient.net/reddit/")); + new WurstOptionsButton(54, 96, () -> "Twitter", "@Wurst_Imperium", + b -> os.open("https://www.wurstclient.net/twitter/")); new WurstOptionsButton(54, 120, () -> "Donate", "WurstClient.net/donate", b -> os.open( diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 535036d121..456d1aaa8c 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -45,6 +45,7 @@ "modmenu": { "links": { "Wiki": "https://wurst.wiki/?utm_source=Wurst+Client&utm_medium=ModMenu&utm_content=Wiki", + "Forum": "https://wurstforum.net/?utm_source=Wurst+Client&utm_medium=ModMenu&utm_content=Forum", "Donate": "https://www.wurstclient.net/donate/?utm_source=Wurst+Client&utm_medium=ModMenu&utm_content=Donate" } } From ac22a81da761242539f5fabad35c7136cc86c175 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 10 Jul 2023 16:20:36 +0200 Subject: [PATCH 140/282] Make NoFall not mess with elytra flight by default --- .../net/wurstclient/hacks/NoFallHack.java | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/NoFallHack.java b/src/main/java/net/wurstclient/hacks/NoFallHack.java index 6521160dc2..304131e5aa 100644 --- a/src/main/java/net/wurstclient/hacks/NoFallHack.java +++ b/src/main/java/net/wurstclient/hacks/NoFallHack.java @@ -13,14 +13,33 @@ import net.wurstclient.SearchTags; import net.wurstclient.events.UpdateListener; import net.wurstclient.hack.Hack; +import net.wurstclient.settings.CheckboxSetting; @SearchTags({"no fall"}) public final class NoFallHack extends Hack implements UpdateListener { + private final CheckboxSetting allowElytra = new CheckboxSetting( + "Allow elytra", + "Also tries to prevent fall damage while you are flying with an elytra.\n\n" + + "\u00a7c\u00a7lWARNING:\u00a7r This can sometimes cause you to" + + " stop flying unexpectedly.", + false); + public NoFallHack() { super("NoFall"); setCategory(Category.MOVEMENT); + addSetting(allowElytra); + } + + @Override + public String getRenderName() + { + if(MC.player != null && MC.player.isFallFlying() + && !allowElytra.isChecked()) + return getName() + " (paused)"; + + return getName(); } @Override @@ -39,13 +58,22 @@ public void onDisable() public void onUpdate() { ClientPlayerEntity player = MC.player; - if(player.fallDistance <= (player.isFallFlying() ? 1 : 2)) + boolean fallFlying = player.isFallFlying(); + + // pause when flying with elytra, unless allowed + if(fallFlying && !allowElytra.isChecked()) + return; + + // ignore small falls that can't cause damage + if(player.fallDistance <= (fallFlying ? 1 : 2)) return; - if(player.isFallFlying() && player.isSneaking() + // attempt to fix elytra weirdness, if allowed + if(fallFlying && player.isSneaking() && !isFallingFastEnoughToCauseDamage(player)) return; + // send packet to stop fall damage player.networkHandler.sendPacket(new OnGroundOnly(true)); } From c81f36b6ef8e2a773e2d21b0d75fd13d1b2bda0e Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 10 Jul 2023 16:47:55 +0200 Subject: [PATCH 141/282] Change version to 7.35.2 --- gradle.properties | 2 +- src/main/java/net/wurstclient/WurstClient.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 5e734f76f4..198dc8bed4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ loader_version=0.14.21 fabric_version=0.83.0+1.20.1 # Mod Properties -mod_version = v7.35.1-MC1.20.1 +mod_version = v7.35.2-MC1.20.1 maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index 014f2cb0dd..68ea455322 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 MinecraftClient MC; public static IMinecraftClient IMC; - public static final String VERSION = "7.35.1"; + public static final String VERSION = "7.35.2"; public static final String MC_VERSION = "1.20.1"; private WurstAnalytics analytics; From c8f245358d6b53b3ba0f66c6238fb14327517df9 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 12 Jul 2023 16:55:27 +0200 Subject: [PATCH 142/282] Update Fabric stuff --- build.gradle | 2 +- gradle.properties | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index a009a9c92c..532612defe 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { } plugins { - id 'fabric-loom' version '1.2-SNAPSHOT' + id 'fabric-loom' version '1.3-SNAPSHOT' id 'maven-publish' } diff --git a/gradle.properties b/gradle.properties index 198dc8bed4..266fd8a598 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,11 +6,11 @@ org.gradle.parallel=true # check these at https://fabricmc.net/develop/ and # https://www.curseforge.com/minecraft/mc-mods/fabric-api minecraft_version=1.20.1 -yarn_mappings=1.20.1+build.1 +yarn_mappings=1.20.1+build.9 loader_version=0.14.21 #Fabric api -fabric_version=0.83.0+1.20.1 +fabric_version=0.85.0+1.20.1 # Mod Properties mod_version = v7.35.2-MC1.20.1 From 632aaf78afc7b3a8d75c5cbee31b11cfe998da1a Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 17 Jul 2023 18:21:07 +0200 Subject: [PATCH 143/282] Add TextFieldSetting --- src/main/java/net/wurstclient/Feature.java | 14 +- .../components/TextFieldEditButton.java | 157 ++++++++++++++++++ .../clickgui/screens/EditTextFieldScreen.java | 112 +++++++++++++ .../net/wurstclient/settings/Setting.java | 14 +- .../settings/TextFieldSetting.java | 136 +++++++++++++++ .../java/net/wurstclient/util/ChatUtils.java | 22 +++ 6 files changed, 431 insertions(+), 24 deletions(-) create mode 100644 src/main/java/net/wurstclient/clickgui/components/TextFieldEditButton.java create mode 100644 src/main/java/net/wurstclient/clickgui/screens/EditTextFieldScreen.java create mode 100644 src/main/java/net/wurstclient/settings/TextFieldSetting.java diff --git a/src/main/java/net/wurstclient/Feature.java b/src/main/java/net/wurstclient/Feature.java index bb95082731..4c40b7aa5d 100644 --- a/src/main/java/net/wurstclient/Feature.java +++ b/src/main/java/net/wurstclient/Feature.java @@ -10,18 +10,15 @@ import java.util.Collections; import java.util.LinkedHashMap; import java.util.LinkedHashSet; -import java.util.List; import java.util.Map; import java.util.Set; -import java.util.StringJoiner; import net.minecraft.client.MinecraftClient; -import net.minecraft.text.StringVisitable; -import net.minecraft.text.Style; import net.wurstclient.event.EventManager; import net.wurstclient.keybinds.PossibleKeybind; import net.wurstclient.mixinterface.IMinecraftClient; import net.wurstclient.settings.Setting; +import net.wurstclient.util.ChatUtils; public abstract class Feature { @@ -48,14 +45,7 @@ public abstract class Feature public String getWrappedDescription(int width) { - List lines = MC.textRenderer.getTextHandler() - .wrapLines(getDescription(), width, Style.EMPTY); - - StringJoiner joiner = new StringJoiner("\n"); - lines.stream().map(StringVisitable::getString) - .forEach(s -> joiner.add(s)); - - return joiner.toString(); + return ChatUtils.wrapText(getDescription(), width); } public Category getCategory() diff --git a/src/main/java/net/wurstclient/clickgui/components/TextFieldEditButton.java b/src/main/java/net/wurstclient/clickgui/components/TextFieldEditButton.java new file mode 100644 index 0000000000..f97dceb1ed --- /dev/null +++ b/src/main/java/net/wurstclient/clickgui/components/TextFieldEditButton.java @@ -0,0 +1,157 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.clickgui.components; + +import java.util.Objects; + +import org.joml.Matrix4f; +import org.lwjgl.opengl.GL11; + +import com.mojang.blaze3d.systems.RenderSystem; + +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.render.BufferBuilder; +import net.minecraft.client.render.GameRenderer; +import net.minecraft.client.render.Tessellator; +import net.minecraft.client.render.VertexFormat; +import net.minecraft.client.render.VertexFormats; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.text.Style; +import net.wurstclient.WurstClient; +import net.wurstclient.clickgui.ClickGui; +import net.wurstclient.clickgui.Component; +import net.wurstclient.clickgui.screens.EditTextFieldScreen; +import net.wurstclient.settings.TextFieldSetting; +import net.wurstclient.util.ChatUtils; + +public final class TextFieldEditButton extends Component +{ + protected static final MinecraftClient MC = WurstClient.MC; + private final TextFieldSetting setting; + + public TextFieldEditButton(TextFieldSetting setting) + { + this.setting = Objects.requireNonNull(setting); + setWidth(getDefaultWidth()); + setHeight(getDefaultHeight()); + } + + @Override + public void handleMouseClick(double mouseX, double mouseY, int mouseButton) + { + if(mouseY < getY() + 11) + return; + + switch(mouseButton) + { + case 0: + MC.setScreen(new EditTextFieldScreen(MC.currentScreen, setting)); + break; + + case 1: + setting.resetToDefault(); + break; + } + } + + @Override + public void render(DrawContext context, int mouseX, int mouseY, + float partialTicks) + { + ClickGui gui = WurstClient.INSTANCE.getGui(); + float[] bgColor = gui.getBgColor(); + float[] acColor = gui.getAcColor(); + int txtColor = gui.getTxtColor(); + float opacity = gui.getOpacity(); + + int x1 = getX(); + int x2 = x1 + getWidth(); + int y1 = getY(); + int y2 = y1 + getHeight(); + int y3 = y1 + 11; + + int scroll = getParent().isScrollingEnabled() + ? getParent().getScrollOffset() : 0; + boolean hovering = mouseX >= x1 && mouseY >= y1 && mouseX < x2 + && mouseY < y2 && mouseY >= -scroll + && mouseY < getParent().getHeight() - 13 - scroll; + boolean hText = hovering && mouseY < y3; + boolean hBox = hovering && mouseY >= y3; + + TextRenderer tr = MC.textRenderer; + MatrixStack matrixStack = context.getMatrices(); + Matrix4f matrix = matrixStack.peek().getPositionMatrix(); + Tessellator tessellator = RenderSystem.renderThreadTesselator(); + BufferBuilder bufferBuilder = tessellator.getBuffer(); + RenderSystem.setShader(GameRenderer::getPositionProgram); + + // tooltip + if(hText) + gui.setTooltip(ChatUtils.wrapText(setting.getDescription(), 200)); + else if(hBox) + gui.setTooltip(ChatUtils.wrapText(setting.getValue(), 200)); + + // background + RenderSystem.setShaderColor(bgColor[0], bgColor[1], bgColor[2], + opacity); + bufferBuilder.begin(VertexFormat.DrawMode.QUADS, + VertexFormats.POSITION); + bufferBuilder.vertex(matrix, x1, y1, 0).next(); + bufferBuilder.vertex(matrix, x1, y2, 0).next(); + bufferBuilder.vertex(matrix, x2, y2, 0).next(); + bufferBuilder.vertex(matrix, x2, y1, 0).next(); + tessellator.draw(); + + // box + RenderSystem.setShaderColor(bgColor[0], bgColor[1], bgColor[2], + hBox ? opacity * 1.5F : opacity); + bufferBuilder.begin(VertexFormat.DrawMode.QUADS, + VertexFormats.POSITION); + bufferBuilder.vertex(matrix, x1, y3, 0).next(); + bufferBuilder.vertex(matrix, x1, y2, 0).next(); + bufferBuilder.vertex(matrix, x2, y2, 0).next(); + bufferBuilder.vertex(matrix, x2, y3, 0).next(); + tessellator.draw(); + RenderSystem.setShaderColor(acColor[0], acColor[1], acColor[2], 0.5F); + bufferBuilder.begin(VertexFormat.DrawMode.DEBUG_LINE_STRIP, + VertexFormats.POSITION); + bufferBuilder.vertex(matrix, x1, y3, 0).next(); + bufferBuilder.vertex(matrix, x1, y2, 0).next(); + bufferBuilder.vertex(matrix, x2, y2, 0).next(); + bufferBuilder.vertex(matrix, x2, y3, 0).next(); + bufferBuilder.vertex(matrix, x1, y3, 0).next(); + tessellator.draw(); + + int maxLength = tr.getTextHandler().getLimitedStringLength( + setting.getValue(), getWidth() - 8, Style.EMPTY); + String value = setting.getValue(); + if(maxLength < value.length()) + value = value.substring(0, maxLength) + "..."; + + // setting name and value + RenderSystem.setShaderColor(1, 1, 1, 1); + context.drawText(tr, setting.getName(), x1, y1 + 2, txtColor, false); + context.drawText(tr, value, x1 + 2, y3 + 2, txtColor, false); + GL11.glEnable(GL11.GL_BLEND); + } + + @Override + public int getDefaultWidth() + { + TextRenderer tr = MC.textRenderer; + return tr.getWidth(setting.getName()) + 4; + } + + @Override + public int getDefaultHeight() + { + return 22; + } +} diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditTextFieldScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditTextFieldScreen.java new file mode 100644 index 0000000000..3dfa0fd981 --- /dev/null +++ b/src/main/java/net/wurstclient/clickgui/screens/EditTextFieldScreen.java @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.clickgui.screens; + +import org.lwjgl.glfw.GLFW; + +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.gui.widget.TextFieldWidget; +import net.minecraft.text.Text; +import net.wurstclient.settings.TextFieldSetting; + +public final class EditTextFieldScreen extends Screen +{ + private final Screen prevScreen; + private final TextFieldSetting setting; + + private TextFieldWidget valueField; + private ButtonWidget doneButton; + + public EditTextFieldScreen(Screen prevScreen, TextFieldSetting setting) + { + super(Text.literal("")); + this.prevScreen = prevScreen; + this.setting = setting; + } + + @Override + public void init() + { + int x1 = width / 2 - 100; + int y1 = 60; + int y2 = height / 3 * 2; + + TextRenderer tr = client.textRenderer; + + valueField = new TextFieldWidget(tr, x1, y1, 200, 20, Text.literal("")); + valueField.setMaxLength(Integer.MAX_VALUE); + valueField.setText(setting.getValue()); + valueField.setSelectionStart(0); + + addSelectableChild(valueField); + setFocused(valueField); + valueField.setFocused(true); + + doneButton = ButtonWidget.builder(Text.literal("Done"), b -> done()) + .dimensions(x1, y2, 200, 20).build(); + addDrawableChild(doneButton); + } + + private void done() + { + String value = valueField.getText(); + setting.setValue(value); + + client.setScreen(prevScreen); + } + + @Override + public boolean keyPressed(int keyCode, int scanCode, int int_3) + { + switch(keyCode) + { + case GLFW.GLFW_KEY_ENTER: + done(); + break; + + case GLFW.GLFW_KEY_ESCAPE: + client.setScreen(prevScreen); + break; + } + + return super.keyPressed(keyCode, scanCode, int_3); + } + + @Override + public void tick() + { + valueField.tick(); + } + + @Override + public void render(DrawContext context, int mouseX, int mouseY, + float partialTicks) + { + renderBackground(context); + context.drawCenteredTextWithShadow(client.textRenderer, + setting.getName(), width / 2, 20, 0xFFFFFF); + + valueField.render(context, mouseX, mouseY, partialTicks); + super.render(context, mouseX, mouseY, partialTicks); + } + + @Override + public boolean shouldPause() + { + return false; + } + + @Override + public boolean shouldCloseOnEsc() + { + return false; + } +} diff --git a/src/main/java/net/wurstclient/settings/Setting.java b/src/main/java/net/wurstclient/settings/Setting.java index 536f52bcda..b8d6ef421c 100644 --- a/src/main/java/net/wurstclient/settings/Setting.java +++ b/src/main/java/net/wurstclient/settings/Setting.java @@ -7,18 +7,15 @@ */ package net.wurstclient.settings; -import java.util.List; import java.util.Objects; import java.util.Set; -import java.util.StringJoiner; import com.google.gson.JsonElement; -import net.minecraft.text.StringVisitable; -import net.minecraft.text.Style; import net.wurstclient.WurstClient; import net.wurstclient.clickgui.Component; import net.wurstclient.keybinds.PossibleKeybind; +import net.wurstclient.util.ChatUtils; public abstract class Setting { @@ -43,14 +40,7 @@ public final String getDescription() public final String getWrappedDescription(int width) { - List lines = WurstClient.MC.textRenderer - .getTextHandler().wrapLines(getDescription(), width, Style.EMPTY); - - StringJoiner joiner = new StringJoiner("\n"); - lines.stream().map(StringVisitable::getString) - .forEach(s -> joiner.add(s)); - - return joiner.toString(); + return ChatUtils.wrapText(getDescription(), width); } public abstract Component getComponent(); diff --git a/src/main/java/net/wurstclient/settings/TextFieldSetting.java b/src/main/java/net/wurstclient/settings/TextFieldSetting.java new file mode 100644 index 0000000000..0e1f12879a --- /dev/null +++ b/src/main/java/net/wurstclient/settings/TextFieldSetting.java @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.settings; + +import java.util.LinkedHashSet; +import java.util.Objects; +import java.util.Set; +import java.util.function.Predicate; + +import com.google.gson.JsonElement; +import com.google.gson.JsonPrimitive; + +import net.wurstclient.WurstClient; +import net.wurstclient.clickgui.Component; +import net.wurstclient.clickgui.components.TextFieldEditButton; +import net.wurstclient.keybinds.PossibleKeybind; +import net.wurstclient.util.json.JsonException; +import net.wurstclient.util.json.JsonUtils; + +public final class TextFieldSetting extends Setting +{ + private String value = ""; + private final String defaultValue; + private final Predicate validator; + + public TextFieldSetting(String name, String description, + String defaultValue, Predicate validator) + { + super(name, description); + + Objects.requireNonNull(defaultValue); + Objects.requireNonNull(validator); + if(!validator.test(defaultValue)) + throw new IllegalArgumentException( + "Default value is not valid: " + defaultValue); + + value = defaultValue; + this.defaultValue = defaultValue; + this.validator = validator; + } + + public TextFieldSetting(String name, String defaultValue, + Predicate validator) + { + this(name, "", defaultValue, validator); + } + + public TextFieldSetting(String name, String description, + String defaultValue) + { + this(name, description, defaultValue, s -> true); + } + + public TextFieldSetting(String name, String defaultValue) + { + this(name, "", defaultValue, s -> true); + } + + /** + * @return this setting's value. Cannot be null. + */ + public String getValue() + { + return value; + } + + public String getDefaultValue() + { + return defaultValue; + } + + /** + * Sets this setting's value. Fails silently if the given value is invalid. + */ + public void setValue(String value) + { + if(value == null) + return; + + if(this.value.equals(value)) + return; + + if(!validator.test(value)) + return; + + this.value = value; + WurstClient.INSTANCE.saveSettings(); + } + + public void resetToDefault() + { + value = defaultValue; + WurstClient.INSTANCE.saveSettings(); + } + + @Override + public Component getComponent() + { + return new TextFieldEditButton(this); + } + + @Override + public void fromJson(JsonElement json) + { + try + { + String newValue = JsonUtils.getAsString(json); + if(!validator.test(newValue)) + throw new JsonException(); + + value = newValue; + + }catch(JsonException e) + { + e.printStackTrace(); + resetToDefault(); + } + } + + @Override + public JsonElement toJson() + { + return new JsonPrimitive(value); + } + + @Override + public Set getPossibleKeybinds(String featureName) + { + return new LinkedHashSet<>(); + } +} diff --git a/src/main/java/net/wurstclient/util/ChatUtils.java b/src/main/java/net/wurstclient/util/ChatUtils.java index 63e79b72c8..210771b1f5 100644 --- a/src/main/java/net/wurstclient/util/ChatUtils.java +++ b/src/main/java/net/wurstclient/util/ChatUtils.java @@ -7,11 +7,16 @@ */ package net.wurstclient.util; +import java.util.List; +import java.util.StringJoiner; + import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.hud.ChatHud; import net.minecraft.client.gui.hud.ChatHudLine; import net.minecraft.text.MutableText; import net.minecraft.text.OrderedText; +import net.minecraft.text.StringVisitable; +import net.minecraft.text.Style; import net.minecraft.text.Text; import net.wurstclient.WurstClient; @@ -78,4 +83,21 @@ public static String getAsString(OrderedText text) text.accept(visitor); return visitor.toString(); } + + public static final String wrapText(String text, int width) + { + return wrapText(text, width, Style.EMPTY); + } + + public static final String wrapText(String text, int width, Style style) + { + List lines = MC.textRenderer.getTextHandler() + .wrapLines(text, width, Style.EMPTY); + + StringJoiner joiner = new StringJoiner("\n"); + lines.stream().map(StringVisitable::getString) + .forEach(s -> joiner.add(s)); + + return joiner.toString(); + } } From 85e49f6963ec80ca2eca45cd802a4630083636fc Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 17 Jul 2023 18:40:42 +0200 Subject: [PATCH 144/282] Add TextFieldSettings to AutoComplete --- .../hacks/autocomplete/ModelSettings.java | 20 ++++++++++++++++++- .../OobaboogaMessageCompleter.java | 2 +- .../autocomplete/OpenAiMessageCompleter.java | 4 ++-- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java b/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java index 701e51b863..6d926591ab 100644 --- a/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java +++ b/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java @@ -17,6 +17,7 @@ import net.wurstclient.settings.Setting; import net.wurstclient.settings.SliderSetting; import net.wurstclient.settings.SliderSetting.ValueDisplay; +import net.wurstclient.settings.TextFieldSetting; public final class ModelSettings { @@ -172,11 +173,28 @@ public String toString() + " etc.", false); + public final TextFieldSetting openaiChatEndpoint = new TextFieldSetting( + "OpenAI chat endpoint", "Endpoint for OpenAI's chat completion API.", + "https://api.openai.com/v1/chat/completions"); + + public final TextFieldSetting openaiLegacyEndpoint = + new TextFieldSetting("OpenAI legacy endpoint", + "Endpoint for OpenAI's legacy completion API.", + "https://api.openai.com/v1/completions"); + + public final TextFieldSetting oobaboogaEndpoint = + new TextFieldSetting("Oobabooga endpoint", + "Endpoint for your Oobabooga web UI instance.\n" + + "Remember to start the Oobabooga server with the" + + " \u00a7e--extensions api\u00a7r flag.", + "http://127.0.0.1:5000/api/v1/generate"); + private final List settings = Collections.unmodifiableList(Arrays.asList(openAiModel, maxTokens, temperature, topP, presencePenalty, frequencyPenalty, repetitionPenalty, encoderRepetitionPenalty, stopSequence, - contextLength, filterServerMessages)); + contextLength, filterServerMessages, openaiChatEndpoint, + openaiLegacyEndpoint, oobaboogaEndpoint)); public void forEach(Consumer action) { diff --git a/src/main/java/net/wurstclient/hacks/autocomplete/OobaboogaMessageCompleter.java b/src/main/java/net/wurstclient/hacks/autocomplete/OobaboogaMessageCompleter.java index 38b75202cb..8ee7ce5176 100644 --- a/src/main/java/net/wurstclient/hacks/autocomplete/OobaboogaMessageCompleter.java +++ b/src/main/java/net/wurstclient/hacks/autocomplete/OobaboogaMessageCompleter.java @@ -50,7 +50,7 @@ protected WsonObject requestCompletion(JsonObject parameters) throws IOException, JsonException { // set up the API request - URL url = new URL("http://127.0.0.1:5000/api/v1/generate"); + URL url = new URL(modelSettings.oobaboogaEndpoint.getValue()); HttpURLConnection conn = (HttpURLConnection)url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); diff --git a/src/main/java/net/wurstclient/hacks/autocomplete/OpenAiMessageCompleter.java b/src/main/java/net/wurstclient/hacks/autocomplete/OpenAiMessageCompleter.java index 30aadd874c..39b66bcaf4 100644 --- a/src/main/java/net/wurstclient/hacks/autocomplete/OpenAiMessageCompleter.java +++ b/src/main/java/net/wurstclient/hacks/autocomplete/OpenAiMessageCompleter.java @@ -65,8 +65,8 @@ protected WsonObject requestCompletion(JsonObject parameters) { // get the API URL URL url = modelSettings.openAiModel.getSelected().isChatModel() - ? new URL("https://api.openai.com/v1/chat/completions") - : new URL("https://api.openai.com/v1/completions"); + ? new URL(modelSettings.openaiChatEndpoint.getValue()) + : new URL(modelSettings.openaiLegacyEndpoint.getValue()); // set up the API request HttpURLConnection conn = (HttpURLConnection)url.openConnection(); From dc1e45637f30e005b84d9eb2d6061be7292ad5b1 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 17 Jul 2023 18:59:43 +0200 Subject: [PATCH 145/282] Update AutoComplete's list of OpenAI models --- .../hacks/autocomplete/ModelSettings.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java b/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java index 6d926591ab..7f8c4a848f 100644 --- a/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java +++ b/src/main/java/net/wurstclient/hacks/autocomplete/ModelSettings.java @@ -37,10 +37,26 @@ public final class ModelSettings public enum OpenAiModel { - TEXT_DAVINCI_003("text-davinci-003", false), GPT_3_5_TURBO("gpt-3.5-turbo", true), + GPT_3_5_TURBO_0613("gpt-3.5-turbo-0613", true), + GPT_3_5_TURBO_0301("gpt-3.5-turbo-0301", true), + GPT_3_5_TURBO_16K("gpt-3.5-turbo-16k", true), + GPT_3_5_TURBO_16K_0613("gpt-3.5-turbo-16k-0613", true), GPT_4("gpt-4", true), - GPT_4_32K("gpt-4-32k", true); + GPT_4_0613("gpt-4-0613", true), + GPT_4_0314("gpt-4-0314", true), + GPT_4_32K("gpt-4-32k", true), + GPT_4_32K_0613("gpt-4-32k-0613", true), + TEXT_DAVINCI_003("text-davinci-003", false), + TEXT_DAVINCI_002("text-davinci-002", false), + TEXT_DAVINCI_001("text-davinci-001", false), + DAVINCI("davinci", false), + TEXT_CURIE_001("text-curie-001", false), + CURIE("curie", false), + TEXT_BABBAGE_001("text-babbage-001", false), + BABBAGE("babbage", false), + TEXT_ADA_001("text-ada-001", false), + ADA("ada", false); private final String name; private final boolean chat; From aaef51f202bd1d73e05722e2dfecde2a80e3a0a7 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 19 Jul 2023 22:27:09 +0200 Subject: [PATCH 146/282] Replace AutoEatHack.moveFoodToHotbar() with InventoryUtils --- .../net/wurstclient/hacks/AutoEatHack.java | 24 ++----------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/AutoEatHack.java b/src/main/java/net/wurstclient/hacks/AutoEatHack.java index 94e505487d..488858cdfc 100644 --- a/src/main/java/net/wurstclient/hacks/AutoEatHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoEatHack.java @@ -36,11 +36,11 @@ import net.wurstclient.SearchTags; import net.wurstclient.events.UpdateListener; import net.wurstclient.hack.Hack; -import net.wurstclient.mixinterface.IClientPlayerInteractionManager; import net.wurstclient.settings.CheckboxSetting; import net.wurstclient.settings.EnumSetting; import net.wurstclient.settings.SliderSetting; import net.wurstclient.settings.SliderSetting.ValueDisplay; +import net.wurstclient.util.InventoryUtils; @SearchTags({"auto eat", "AutoFood", "auto food", "AutoFeeder", "auto feeder", "AutoFeeding", "auto feeding", "AutoSoup", "auto soup"}) @@ -190,7 +190,7 @@ private void eat(int maxPoints) }else { - moveFoodToHotbar(foodSlot); + InventoryUtils.selectItem(foodSlot); return; } @@ -244,26 +244,6 @@ private int findBestFoodSlot(int maxPoints) return bestSlot; } - private void moveFoodToHotbar(int foodSlot) - { - PlayerInventory inventory = MC.player.getInventory(); - IClientPlayerInteractionManager im = IMC.getInteractionManager(); - - if(inventory.getEmptySlot() < 9) - im.windowClick_QUICK_MOVE(foodSlot); - else if(inventory.getEmptySlot() != -1) - { - im.windowClick_QUICK_MOVE(inventory.selectedSlot + 36); - im.windowClick_QUICK_MOVE(foodSlot); - - }else - { - im.windowClick_PICKUP(inventory.selectedSlot + 36); - im.windowClick_PICKUP(foodSlot); - im.windowClick_PICKUP(inventory.selectedSlot + 36); - } - } - private boolean shouldEat() { if(MC.player.getAbilities().creativeMode) From 285f9b3b1e287ecfd32492e355cf9d7ae998ddbd Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 24 Jul 2023 19:03:50 +0200 Subject: [PATCH 147/282] Separate FacingSetting and SwingHandSetting from AutoLibrarian --- .../wurstclient/hacks/AutoLibrarianHack.java | 26 ++++++++++++++++--- .../FacingSetting.java | 26 +++++++++---------- .../SwingHandSetting.java | 25 +++++++++--------- 3 files changed, 48 insertions(+), 29 deletions(-) rename src/main/java/net/wurstclient/{hacks/autolibrarian => settings}/FacingSetting.java (59%) rename src/main/java/net/wurstclient/{hacks/autolibrarian => settings}/SwingHandSetting.java (63%) diff --git a/src/main/java/net/wurstclient/hacks/AutoLibrarianHack.java b/src/main/java/net/wurstclient/hacks/AutoLibrarianHack.java index 08534e16f3..1463e7c0d9 100644 --- a/src/main/java/net/wurstclient/hacks/AutoLibrarianHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoLibrarianHack.java @@ -43,14 +43,14 @@ import net.wurstclient.events.UpdateListener; import net.wurstclient.hack.Hack; import net.wurstclient.hacks.autolibrarian.BookOffer; -import net.wurstclient.hacks.autolibrarian.FacingSetting; -import net.wurstclient.hacks.autolibrarian.SwingHandSetting; import net.wurstclient.hacks.autolibrarian.UpdateBooksSetting; import net.wurstclient.mixinterface.IKeyBinding; import net.wurstclient.settings.BookOffersSetting; import net.wurstclient.settings.CheckboxSetting; +import net.wurstclient.settings.FacingSetting; import net.wurstclient.settings.SliderSetting; import net.wurstclient.settings.SliderSetting.ValueDisplay; +import net.wurstclient.settings.SwingHandSetting; import net.wurstclient.util.*; import net.wurstclient.util.BlockBreaker.BlockBreakingParams; import net.wurstclient.util.BlockPlacer.BlockPlacingParams; @@ -89,8 +89,26 @@ public final class AutoLibrarianHack extends Hack private final SliderSetting range = new SliderSetting("Range", 5, 1, 6, 0.05, ValueDisplay.DECIMAL); - private final FacingSetting facing = new FacingSetting(); - private final SwingHandSetting swingHand = new SwingHandSetting(); + private final FacingSetting facing = + new FacingSetting("How to face the villager and job site.\n\n" + + "\u00a7lOff\u00a7r - Don't face the villager at all. Will be" + + " detected by anti-cheat plugins.\n\n" + + "\u00a7lServer-side\u00a7r - Face the villager on the" + + " server-side, while still letting you move the camera freely on" + + " the client-side.\n\n" + + "\u00a7lClient-side\u00a7r - Face the villager by moving your" + + " camera on the client-side. This is the most legit option, but" + + " can be disorienting to look at."); + + private final SwingHandSetting swingHand = + new SwingHandSetting("How to swing your hand when interacting with the" + + " villager and job site.\n\n" + + "\u00a7lOff\u00a7r - Don't swing your hand at all. Will be detected" + + " by anti-cheat plugins.\n\n" + + "\u00a7lServer-side\u00a7r - Swing your hand on the server-side," + + " without playing the animation on the client-side.\n\n" + + "\u00a7lClient-side\u00a7r - Swing your hand on the client-side." + + " This is the most legit option."); private final SliderSetting repairMode = new SliderSetting("Repair mode", "Prevents AutoLibrarian from using your axe when its durability reaches" diff --git a/src/main/java/net/wurstclient/hacks/autolibrarian/FacingSetting.java b/src/main/java/net/wurstclient/settings/FacingSetting.java similarity index 59% rename from src/main/java/net/wurstclient/hacks/autolibrarian/FacingSetting.java rename to src/main/java/net/wurstclient/settings/FacingSetting.java index ca27ed3fc2..b4b1aa3b28 100644 --- a/src/main/java/net/wurstclient/hacks/autolibrarian/FacingSetting.java +++ b/src/main/java/net/wurstclient/settings/FacingSetting.java @@ -5,30 +5,30 @@ * License, version 3. If a copy of the GPL was not distributed with this * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt */ -package net.wurstclient.hacks.autolibrarian; +package net.wurstclient.settings; import java.util.function.Consumer; import net.minecraft.util.math.Vec3d; import net.wurstclient.WurstClient; -import net.wurstclient.settings.EnumSetting; public final class FacingSetting extends EnumSetting { protected static final WurstClient WURST = WurstClient.INSTANCE; - public FacingSetting() + public FacingSetting(String description) { - super("Facing", "How to face the villager and job site.\n\n" - + "\u00a7lOff\u00a7r - Don't face the villager at all. Will be" - + " detected by anti-cheat plugins.\n\n" - + "\u00a7lServer-side\u00a7r - Face the villager on the" - + " server-side, while still letting you move the camera freely on" - + " the client-side.\n\n" - + "\u00a7lClient-side\u00a7r - Face the villager by moving your" - + " camera on the client-side. This is the most legit option, but" - + " can be disorienting to look at.", Facing.values(), - Facing.SERVER); + super("Facing", description, Facing.values(), Facing.SERVER); + } + + public FacingSetting(String description, Facing selected) + { + super("Facing", description, Facing.values(), selected); + } + + public FacingSetting(String name, String description, Facing selected) + { + super(name, description, Facing.values(), selected); } public enum Facing diff --git a/src/main/java/net/wurstclient/hacks/autolibrarian/SwingHandSetting.java b/src/main/java/net/wurstclient/settings/SwingHandSetting.java similarity index 63% rename from src/main/java/net/wurstclient/hacks/autolibrarian/SwingHandSetting.java rename to src/main/java/net/wurstclient/settings/SwingHandSetting.java index 1998bb94c3..3c1e0a30d4 100644 --- a/src/main/java/net/wurstclient/hacks/autolibrarian/SwingHandSetting.java +++ b/src/main/java/net/wurstclient/settings/SwingHandSetting.java @@ -5,7 +5,7 @@ * License, version 3. If a copy of the GPL was not distributed with this * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt */ -package net.wurstclient.hacks.autolibrarian; +package net.wurstclient.settings; import java.util.function.Consumer; @@ -13,24 +13,25 @@ import net.minecraft.network.packet.c2s.play.HandSwingC2SPacket; import net.minecraft.util.Hand; import net.wurstclient.WurstClient; -import net.wurstclient.settings.EnumSetting; public final class SwingHandSetting extends EnumSetting { protected static final MinecraftClient MC = WurstClient.MC; - public SwingHandSetting() + public SwingHandSetting(String description) { - super("Swing hand", "How to swing your hand when interacting with the" - + " villager and job site.\n\n" - + "\u00a7lOff\u00a7r - Don't swing your hand at all. Will be detected" - + " by anti-cheat plugins.\n\n" - + "\u00a7lServer-side\u00a7r - Swing your hand on the server-side," - + " without playing the animation on the client-side.\n\n" - + "\u00a7lClient-side\u00a7r - Swing your hand on the client-side." - + " This is the most legit option.", SwingHand.values(), - SwingHand.SERVER); + super("Swing hand", description, SwingHand.values(), SwingHand.SERVER); + } + + public SwingHandSetting(String description, SwingHand selected) + { + super("Swing hand", description, SwingHand.values(), selected); + } + + public SwingHandSetting(String name, String description, SwingHand selected) + { + super(name, description, SwingHand.values(), selected); } public enum SwingHand From 729237c16119aaa0f4476ce2b156ed07812e4505 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Tue, 25 Jul 2023 02:46:09 +0200 Subject: [PATCH 148/282] Rewrite BuildRandom --- .../wurstclient/hacks/BuildRandomHack.java | 287 ++++++++---------- 1 file changed, 130 insertions(+), 157 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/BuildRandomHack.java b/src/main/java/net/wurstclient/hacks/BuildRandomHack.java index 02f3663b10..3192e5330d 100644 --- a/src/main/java/net/wurstclient/hacks/BuildRandomHack.java +++ b/src/main/java/net/wurstclient/hacks/BuildRandomHack.java @@ -16,46 +16,92 @@ import net.minecraft.client.render.GameRenderer; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.BlockItem; -import net.minecraft.item.ItemStack; -import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; +import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; -import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.RaycastContext; import net.wurstclient.Category; import net.wurstclient.SearchTags; import net.wurstclient.events.RenderListener; import net.wurstclient.events.UpdateListener; import net.wurstclient.hack.Hack; import net.wurstclient.settings.CheckboxSetting; -import net.wurstclient.settings.EnumSetting; +import net.wurstclient.settings.FacingSetting; +import net.wurstclient.settings.SliderSetting; +import net.wurstclient.settings.SliderSetting.ValueDisplay; +import net.wurstclient.settings.SwingHandSetting; +import net.wurstclient.util.BlockPlacer; +import net.wurstclient.util.BlockPlacer.BlockPlacingParams; import net.wurstclient.util.BlockUtils; import net.wurstclient.util.RenderUtils; import net.wurstclient.util.RotationUtils; -import net.wurstclient.util.RotationUtils.Rotation; @SearchTags({"build random", "RandomBuild", "random build", "PlaceRandom", "place random", "RandomPlace", "random place"}) public final class BuildRandomHack extends Hack implements UpdateListener, RenderListener { - private final EnumSetting mode = new EnumSetting<>("Mode", - "\u00a7lFast\u00a7r mode can place blocks behind other blocks.\n" - + "\u00a7lLegit\u00a7r mode can bypass NoCheat+.", - Mode.values(), Mode.FAST); + private final SliderSetting range = + new SliderSetting("Range", 5, 1, 6, 0.05, ValueDisplay.DECIMAL); - private final CheckboxSetting checkItem = new CheckboxSetting( - "Check held item", - "Only builds when you are actually holding a block.\n" - + "Turn this off to build with fire, water, lava, spawn eggs, or if you just want to right click with an empty hand in random places.", - true); + private SliderSetting maxAttempts = new SliderSetting("Max attempts", + "Maximum number of random positions that BuildRandom will try to place" + + " a block at in one tick.\n\n" + + "Higher values speed up the building process at the cost of" + + " increased lag.", + 128, 1, 1024, 1, ValueDisplay.INTEGER); + + private final CheckboxSetting checkItem = + new CheckboxSetting("Check held item", + "Only builds when you are actually holding a block.\n" + + "Turn this off to build with fire, water, lava, spawn eggs," + + " or if you just want to right click with an empty hand" + + " in random places.", + true); + + private final CheckboxSetting checkLOS = + new CheckboxSetting("Check line of sight", + "Ensure that BuildRandom won't try to place blocks behind walls.", + false); + + private final FacingSetting facing = new FacingSetting( + "How BuildRandom should face the randomly placed blocks.\n\n" + + "\u00a7lOff\u00a7r - Don't face the blocks at all. Will be" + + " detected by anti-cheat plugins.\n\n" + + "\u00a7lServer-side\u00a7r - Face the blocks on the" + + " server-side, while still letting you move the camera freely on" + + " the client-side.\n\n" + + "\u00a7lClient-side\u00a7r - Face the blocks by moving your" + + " camera on the client-side. This is the most legit option, but" + + " can be VERY disorienting to look at."); + + private final SwingHandSetting swingHand = new SwingHandSetting( + "How BuildRandom should swing your hand when placing blocks.\n\n" + + "\u00a7lOff\u00a7r - Don't swing your hand at all. Will be detected" + + " by anti-cheat plugins.\n\n" + + "\u00a7lServer-side\u00a7r - Swing your hand on the server-side," + + " without playing the animation on the client-side.\n\n" + + "\u00a7lClient-side\u00a7r - Swing your hand on the client-side." + + " This is the most legit option."); private final CheckboxSetting fastPlace = new CheckboxSetting("Always FastPlace", "Builds as if FastPlace was enabled, even if it's not.", false); + private final CheckboxSetting placeWhileBreaking = new CheckboxSetting( + "Place while breaking", + "Builds even while you are breaking a block.\n" + + "Possible with hacks, but wouldn't work in vanilla. May look suspicious.", + false); + + private final CheckboxSetting placeWhileRiding = new CheckboxSetting( + "Place while riding", + "Builds even while you are riding a vehicle.\n" + + "Possible with hacks, but wouldn't work in vanilla. May look suspicious.", + false); + + private final CheckboxSetting indicator = new CheckboxSetting("Indicator", + "Shows where BuildRandom is placing blocks.", true); + private final Random random = new Random(); private BlockPos lastPos; @@ -63,9 +109,16 @@ public BuildRandomHack() { super("BuildRandom"); setCategory(Category.BLOCKS); - addSetting(mode); + addSetting(range); + addSetting(maxAttempts); addSetting(checkItem); + addSetting(checkLOS); + addSetting(facing); + addSetting(swingHand); addSetting(fastPlace); + addSetting(placeWhileBreaking); + addSetting(placeWhileRiding); + addSetting(indicator); } @Override @@ -91,45 +144,88 @@ public void onUpdate() if(WURST.getHax().freecamHack.isEnabled()) return; - // check timer if(!fastPlace.isChecked() && IMC.getItemUseCooldown() > 0) return; - if(!checkHeldItem()) + if(checkItem.isChecked() && !MC.player.isHolding( + stack -> !stack.isEmpty() && stack.getItem() instanceof BlockItem)) return; - // set mode & range - boolean legitMode = mode.getSelected() == Mode.LEGIT; - int range = legitMode ? 5 : 6; - int bound = range * 2 + 1; + if(!placeWhileBreaking.isChecked() + && MC.interactionManager.isBreakingBlock()) + return; + + if(!placeWhileRiding.isChecked() && MC.player.isRiding()) + return; + int maxAttempts = this.maxAttempts.getValueI(); + int blockRange = range.getValueCeil(); + int bound = blockRange * 2 + 1; BlockPos pos; int attempts = 0; do { // generate random position - pos = BlockPos.ofFloored(MC.player.getPos()).add( - random.nextInt(bound) - range, random.nextInt(bound) - range, - random.nextInt(bound) - range); + pos = BlockPos.ofFloored(RotationUtils.getEyesPos()).add( + random.nextInt(bound) - blockRange, + random.nextInt(bound) - blockRange, + random.nextInt(bound) - blockRange); attempts++; - }while(attempts < 128 && !tryToPlaceBlock(legitMode, pos)); + }while(attempts < maxAttempts && !tryToPlaceBlock(pos)); } - private boolean checkHeldItem() + private boolean tryToPlaceBlock(BlockPos pos) { - if(!checkItem.isChecked()) - return true; + if(!BlockUtils.getState(pos).isReplaceable()) + return false; + + BlockPlacingParams params = BlockPlacer.getBlockPlacingParams(pos); + if(params == null || params.distanceSq() > range.getValueSq()) + return false; + if(checkLOS.isChecked() && !params.lineOfSight()) + return false; + + IMC.setItemUseCooldown(4); + facing.getSelected().face(params.hitVec()); + lastPos = pos; + + // right-click the block in the same way vanilla Minecraft would + for(Hand hand : Hand.values()) + { + // place block and return true if successful + ActionResult blockResult = MC.interactionManager + .interactBlock(MC.player, hand, params.toHitResult()); + if(blockResult.isAccepted()) + { + if(blockResult.shouldSwingHand()) + swingHand.getSelected().swing(hand); + + return true; + } + + // return on ActionResult.FAIL without trying the other hand + if(blockResult == ActionResult.FAIL) + return true; + + // if ActionResult.PASS and hand is not empty, call interactItem() + if(!MC.player.getStackInHand(hand).isEmpty()) + { + ActionResult itemResult = + MC.interactionManager.interactItem(MC.player, hand); + if(itemResult.isAccepted() && itemResult.shouldSwingHand()) + swingHand.getSelected().swing(hand); + } + } - ItemStack stack = MC.player.getInventory().getMainHandStack(); - return !stack.isEmpty() && stack.getItem() instanceof BlockItem; + return true; } @Override public void onRender(MatrixStack matrixStack, float partialTicks) { - if(lastPos == null) + if(lastPos == null || !indicator.isChecked()) return; // GL settings @@ -166,127 +262,4 @@ public void onRender(MatrixStack matrixStack, float partialTicks) GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); } - - private boolean tryToPlaceBlock(boolean legitMode, BlockPos pos) - { - if(!BlockUtils.getState(pos).isReplaceable()) - return false; - - if(legitMode) - { - if(!placeBlockLegit(pos)) - return false; - }else - { - if(!placeBlockSimple_old(pos)) - return false; - - MC.player.swingHand(Hand.MAIN_HAND); - } - IMC.setItemUseCooldown(4); - - lastPos = pos; - return true; - } - - private boolean placeBlockLegit(BlockPos pos) - { - Vec3d eyesPos = RotationUtils.getEyesPos(); - Vec3d posVec = Vec3d.ofCenter(pos); - double distanceSqPosVec = eyesPos.squaredDistanceTo(posVec); - - for(Direction side : Direction.values()) - { - BlockPos neighbor = pos.offset(side); - - // check if neighbor can be right clicked - if(!BlockUtils.canBeClicked(neighbor)) - continue; - - Vec3d dirVec = Vec3d.of(side.getVector()); - Vec3d hitVec = posVec.add(dirVec.multiply(0.5)); - - // check if hitVec is within range (4.25 blocks) - if(eyesPos.squaredDistanceTo(hitVec) > 18.0625) - continue; - - // check if side is visible (facing away from player) - if(distanceSqPosVec > eyesPos.squaredDistanceTo(posVec.add(dirVec))) - continue; - - // check line of sight - if(MC.world - .raycast(new RaycastContext(eyesPos, hitVec, - RaycastContext.ShapeType.COLLIDER, - RaycastContext.FluidHandling.NONE, MC.player)) - .getType() != HitResult.Type.MISS) - continue; - - // face block - Rotation rotation = RotationUtils.getNeededRotations(hitVec); - PlayerMoveC2SPacket.LookAndOnGround packet = - new PlayerMoveC2SPacket.LookAndOnGround(rotation.getYaw(), - rotation.getPitch(), MC.player.isOnGround()); - MC.player.networkHandler.sendPacket(packet); - - // place block - IMC.getInteractionManager().rightClickBlock(neighbor, - side.getOpposite(), hitVec); - MC.player.swingHand(Hand.MAIN_HAND); - IMC.setItemUseCooldown(4); - - return true; - } - - return false; - } - - private boolean placeBlockSimple_old(BlockPos pos) - { - Vec3d eyesPos = RotationUtils.getEyesPos(); - Vec3d posVec = Vec3d.ofCenter(pos); - - for(Direction side : Direction.values()) - { - BlockPos neighbor = pos.offset(side); - - // check if neighbor can be right clicked - if(!BlockUtils.canBeClicked(neighbor)) - continue; - - Vec3d hitVec = posVec.add(Vec3d.of(side.getVector()).multiply(0.5)); - - // check if hitVec is within range (6 blocks) - if(eyesPos.squaredDistanceTo(hitVec) > 36) - continue; - - // place block - IMC.getInteractionManager().rightClickBlock(neighbor, - side.getOpposite(), hitVec); - - return true; - } - - return false; - } - - private enum Mode - { - FAST("Fast"), - - LEGIT("Legit"); - - private final String name; - - private Mode(String name) - { - this.name = name; - } - - @Override - public String toString() - { - return name; - } - } } From bbf9fadb3bc4fc11533f065f7fe91fba6b262793 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Tue, 25 Jul 2023 02:46:40 +0200 Subject: [PATCH 149/282] Change version to 7.36 --- gradle.properties | 2 +- src/main/java/net/wurstclient/WurstClient.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 266fd8a598..1acb75bb53 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ loader_version=0.14.21 fabric_version=0.85.0+1.20.1 # Mod Properties -mod_version = v7.35.2-MC1.20.1 +mod_version = v7.36-MC1.20.1 maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index 68ea455322..4aa6b458c7 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 MinecraftClient MC; public static IMinecraftClient IMC; - public static final String VERSION = "7.35.2"; + public static final String VERSION = "7.36"; public static final String MC_VERSION = "1.20.1"; private WurstAnalytics analytics; From 4abfeb353e6447cd12ded184145de60ccf91705c Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 26 Jul 2023 18:35:37 +0200 Subject: [PATCH 150/282] Fix NoFall not handling CreativeFlight and creative mode correctly --- .../net/wurstclient/hacks/NoFallHack.java | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/NoFallHack.java b/src/main/java/net/wurstclient/hacks/NoFallHack.java index 304131e5aa..6745cc182e 100644 --- a/src/main/java/net/wurstclient/hacks/NoFallHack.java +++ b/src/main/java/net/wurstclient/hacks/NoFallHack.java @@ -35,8 +35,14 @@ public NoFallHack() @Override public String getRenderName() { - if(MC.player != null && MC.player.isFallFlying() - && !allowElytra.isChecked()) + ClientPlayerEntity player = MC.player; + if(player == null) + return getName(); + + if(player.isFallFlying() && !allowElytra.isChecked()) + return getName() + " (paused)"; + + if(player.isCreative()) return getName() + " (paused)"; return getName(); @@ -57,15 +63,21 @@ public void onDisable() @Override public void onUpdate() { + // do nothing in creative mode, since there is no fall damage anyway ClientPlayerEntity player = MC.player; - boolean fallFlying = player.isFallFlying(); + if(player.isCreative()) + return; // pause when flying with elytra, unless allowed + boolean fallFlying = player.isFallFlying(); if(fallFlying && !allowElytra.isChecked()) return; - - // ignore small falls that can't cause damage - if(player.fallDistance <= (fallFlying ? 1 : 2)) + + // ignore small falls that can't cause damage, + // unless CreativeFlight is enabled in survival mode + boolean creativeFlying = WURST.getHax().creativeFlightHack.isEnabled() + && player.getAbilities().flying; + if(!creativeFlying && player.fallDistance <= (fallFlying ? 1 : 2)) return; // attempt to fix elytra weirdness, if allowed From 503fdb84fdbb6f4caceb5ac060e72b5b197e2769 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Tue, 1 Aug 2023 21:13:59 +0200 Subject: [PATCH 151/282] Add wiki data export button --- src/main/java/net/wurstclient/hack/Hack.java | 5 + .../wurstclient/other_feature/OtfList.java | 1 + .../other_features/WikiDataExportOtf.java | 91 +++++++++++++++++++ .../settings/BlockListSetting.java | 18 ++++ .../wurstclient/settings/BlockSetting.java | 13 +++ .../settings/BookOffersSetting.java | 24 +++++ .../wurstclient/settings/CheckboxSetting.java | 12 +++ .../wurstclient/settings/ColorSetting.java | 12 +++ .../net/wurstclient/settings/EnumSetting.java | 19 ++++ .../net/wurstclient/settings/FileSetting.java | 16 ++++ .../wurstclient/settings/ItemListSetting.java | 16 ++++ .../net/wurstclient/settings/Setting.java | 17 ++++ .../wurstclient/settings/SliderSetting.java | 17 ++++ .../settings/TextFieldSetting.java | 12 +++ 14 files changed, 273 insertions(+) create mode 100644 src/main/java/net/wurstclient/other_features/WikiDataExportOtf.java diff --git a/src/main/java/net/wurstclient/hack/Hack.java b/src/main/java/net/wurstclient/hack/Hack.java index 4243803520..44ae05ff2e 100644 --- a/src/main/java/net/wurstclient/hack/Hack.java +++ b/src/main/java/net/wurstclient/hack/Hack.java @@ -49,6 +49,11 @@ public final String getDescription() return WURST.translate(description); } + public final String getDescriptionKey() + { + return description; + } + @Override public final Category getCategory() { diff --git a/src/main/java/net/wurstclient/other_feature/OtfList.java b/src/main/java/net/wurstclient/other_feature/OtfList.java index 2e190b8ab7..5076b5feab 100644 --- a/src/main/java/net/wurstclient/other_feature/OtfList.java +++ b/src/main/java/net/wurstclient/other_feature/OtfList.java @@ -30,6 +30,7 @@ public final class OtfList public final TabGuiOtf tabGuiOtf = new TabGuiOtf(); public final TranslationsOtf translationsOtf = new TranslationsOtf(); public final VanillaSpoofOtf vanillaSpoofOtf = new VanillaSpoofOtf(); + public final WikiDataExportOtf wikiDataExportOtf = new WikiDataExportOtf(); public final WurstCapesOtf wurstCapesOtf = new WurstCapesOtf(); public final WurstLogoOtf wurstLogoOtf = new WurstLogoOtf(); public final ZoomOtf zoomOtf = new ZoomOtf(); diff --git a/src/main/java/net/wurstclient/other_features/WikiDataExportOtf.java b/src/main/java/net/wurstclient/other_features/WikiDataExportOtf.java new file mode 100644 index 0000000000..2da74da2ea --- /dev/null +++ b/src/main/java/net/wurstclient/other_features/WikiDataExportOtf.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.other_features; + +import java.nio.file.Path; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; + +import net.wurstclient.Category; +import net.wurstclient.Feature; +import net.wurstclient.hack.Hack; +import net.wurstclient.keybinds.Keybind; +import net.wurstclient.keybinds.KeybindList; +import net.wurstclient.other_feature.OtherFeature; +import net.wurstclient.settings.Setting; +import net.wurstclient.util.ChatUtils; +import net.wurstclient.util.json.JsonUtils; + +public final class WikiDataExportOtf extends OtherFeature +{ + public WikiDataExportOtf() + { + super("WikiDataExport", + "Creates a JSON file full of technical details about all the" + + " different features and settings in this version of Wurst." + + " Primarily used to update the Wurst Wiki."); + } + + @Override + public String getPrimaryAction() + { + return "Export Data"; + } + + @Override + public void doPrimaryAction() + { + try + { + Path exportFile = WURST.getWurstFolder().resolve("wiki-data.json"); + + JsonObject json = new JsonObject(); + for(Hack hack : WURST.getHax().getAllHax()) + json.add(hack.getName(), hackToJson(hack)); + + JsonUtils.toJson(json, exportFile); + + }catch(Exception e) + { + ChatUtils.error("Failed to export data: " + e.getMessage()); + e.printStackTrace(); + } + } + + private JsonObject hackToJson(Hack hack) + { + JsonObject json = new JsonObject(); + json.addProperty("name", hack.getName()); + json.addProperty("descriptionKey", hack.getDescriptionKey()); + Category category = hack.getCategory(); + if(category != null) + json.addProperty("category", category.getName()); + json.addProperty("keybind", getDefaultKeybind(hack)); + json.addProperty("stateSaved", hack.isStateSaved()); + + JsonArray settings = new JsonArray(); + for(Setting setting : hack.getSettings().values()) + settings.add(setting.exportWikiData()); + json.add("settings", settings); + return json; + } + + private String getDefaultKeybind(Feature feature) + { + String name = feature.getName().toLowerCase().replace(" ", "_"); + if(name.startsWith(".")) + name = name.substring(1); + + for(Keybind keybind : KeybindList.DEFAULT_KEYBINDS) + if(keybind.getCommands().toLowerCase().contains(name)) + return keybind.getKey(); + + return null; + } +} diff --git a/src/main/java/net/wurstclient/settings/BlockListSetting.java b/src/main/java/net/wurstclient/settings/BlockListSetting.java index fd31b9a9f6..afc3d329d3 100644 --- a/src/main/java/net/wurstclient/settings/BlockListSetting.java +++ b/src/main/java/net/wurstclient/settings/BlockListSetting.java @@ -17,6 +17,7 @@ import com.google.gson.JsonArray; import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import net.minecraft.block.Block; import net.minecraft.registry.Registries; @@ -112,6 +113,23 @@ public JsonElement toJson() return json; } + @Override + public JsonObject exportWikiData() + { + JsonObject json = new JsonObject(); + + json.addProperty("name", getName()); + json.addProperty("descriptionKey", getDescriptionKey()); + json.addProperty("type", "BlockList"); + + JsonArray defaultBlocksJson = new JsonArray(); + for(String blockName : defaultNames) + defaultBlocksJson.add(blockName); + json.add("defaultBlocks", defaultBlocksJson); + + return json; + } + @Override public Set getPossibleKeybinds(String featureName) { diff --git a/src/main/java/net/wurstclient/settings/BlockSetting.java b/src/main/java/net/wurstclient/settings/BlockSetting.java index 503a256fa6..b0ad53f1ae 100644 --- a/src/main/java/net/wurstclient/settings/BlockSetting.java +++ b/src/main/java/net/wurstclient/settings/BlockSetting.java @@ -12,6 +12,7 @@ import java.util.Set; import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; import net.minecraft.block.AirBlock; @@ -127,6 +128,18 @@ public JsonElement toJson() return new JsonPrimitive(blockName); } + @Override + public JsonObject exportWikiData() + { + JsonObject json = new JsonObject(); + json.addProperty("name", getName()); + json.addProperty("descriptionKey", getDescriptionKey()); + json.addProperty("type", "Block"); + json.addProperty("defaultValue", defaultName); + json.addProperty("allowAir", allowAir); + return json; + } + @Override public Set getPossibleKeybinds(String featureName) { diff --git a/src/main/java/net/wurstclient/settings/BookOffersSetting.java b/src/main/java/net/wurstclient/settings/BookOffersSetting.java index 4cc10c9f9f..46dcbe636e 100644 --- a/src/main/java/net/wurstclient/settings/BookOffersSetting.java +++ b/src/main/java/net/wurstclient/settings/BookOffersSetting.java @@ -199,6 +199,30 @@ public JsonElement toJson() return json; } + @Override + public JsonObject exportWikiData() + { + JsonObject json = new JsonObject(); + json.addProperty("name", getName()); + json.addProperty("descriptionKey", getDescriptionKey()); + json.addProperty("type", "BookOffers"); + + JsonArray jsonDefaultOffers = new JsonArray(); + for(BookOffer offer : defaultOffers) + { + JsonObject jsonOffer = new JsonObject(); + jsonOffer.addProperty("id", offer.id()); + jsonOffer.addProperty("level", offer.level()); + if(offer.price() < 64) + jsonOffer.addProperty("max_price", offer.price()); + + jsonDefaultOffers.add(jsonOffer); + } + json.add("defaultOffers", jsonDefaultOffers); + + return json; + } + @Override public Set getPossibleKeybinds(String featureName) { diff --git a/src/main/java/net/wurstclient/settings/CheckboxSetting.java b/src/main/java/net/wurstclient/settings/CheckboxSetting.java index 4cb6649617..d6e750a50c 100644 --- a/src/main/java/net/wurstclient/settings/CheckboxSetting.java +++ b/src/main/java/net/wurstclient/settings/CheckboxSetting.java @@ -11,6 +11,7 @@ import java.util.Set; import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; import net.wurstclient.WurstClient; @@ -102,6 +103,17 @@ public final JsonElement toJson() return new JsonPrimitive(checked); } + @Override + public JsonObject exportWikiData() + { + JsonObject json = new JsonObject(); + json.addProperty("name", getName()); + json.addProperty("descriptionKey", getDescriptionKey()); + json.addProperty("type", "Checkbox"); + json.addProperty("checkedByDefault", checkedByDefault); + return json; + } + @Override public final Set getPossibleKeybinds(String featureName) { diff --git a/src/main/java/net/wurstclient/settings/ColorSetting.java b/src/main/java/net/wurstclient/settings/ColorSetting.java index f4e42c8afd..bc16de00ee 100644 --- a/src/main/java/net/wurstclient/settings/ColorSetting.java +++ b/src/main/java/net/wurstclient/settings/ColorSetting.java @@ -13,6 +13,7 @@ import java.util.Set; import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; import net.wurstclient.WurstClient; @@ -113,6 +114,17 @@ public JsonElement toJson() return new JsonPrimitive(ColorUtils.toHex(color)); } + @Override + public JsonObject exportWikiData() + { + JsonObject json = new JsonObject(); + json.addProperty("name", getName()); + json.addProperty("descriptionKey", getDescriptionKey()); + json.addProperty("type", "Color"); + json.addProperty("defaultColor", ColorUtils.toHex(defaultColor)); + return json; + } + @Override public Set getPossibleKeybinds(String featureName) { diff --git a/src/main/java/net/wurstclient/settings/EnumSetting.java b/src/main/java/net/wurstclient/settings/EnumSetting.java index 9f7e075887..51f47983ec 100644 --- a/src/main/java/net/wurstclient/settings/EnumSetting.java +++ b/src/main/java/net/wurstclient/settings/EnumSetting.java @@ -10,7 +10,9 @@ import java.util.LinkedHashSet; import java.util.Objects; +import com.google.gson.JsonArray; import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; import net.wurstclient.WurstClient; @@ -112,6 +114,23 @@ public JsonElement toJson() return new JsonPrimitive(selected.toString()); } + @Override + public JsonObject exportWikiData() + { + JsonObject json = new JsonObject(); + json.addProperty("name", getName()); + json.addProperty("descriptionKey", getDescriptionKey()); + json.addProperty("type", "Enum"); + + JsonArray values = new JsonArray(); + for(T value : this.values) + values.add(value.toString()); + json.add("values", values); + json.addProperty("defaultValue", defaultSelected.toString()); + + return json; + } + @Override public LinkedHashSet getPossibleKeybinds( String featureName) diff --git a/src/main/java/net/wurstclient/settings/FileSetting.java b/src/main/java/net/wurstclient/settings/FileSetting.java index 8d8e80b339..cac273b407 100644 --- a/src/main/java/net/wurstclient/settings/FileSetting.java +++ b/src/main/java/net/wurstclient/settings/FileSetting.java @@ -19,6 +19,7 @@ import java.util.stream.Stream; import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; import net.wurstclient.WurstClient; @@ -163,6 +164,21 @@ public JsonElement toJson() return new JsonPrimitive(selectedFile); } + @Override + public JsonObject exportWikiData() + { + JsonObject json = new JsonObject(); + json.addProperty("name", getName()); + json.addProperty("descriptionKey", getDescriptionKey()); + json.addProperty("type", "File"); + + Path mcFolder = WurstClient.INSTANCE.getWurstFolder().getParent(); + if(folder.startsWith(mcFolder)) + json.addProperty("folder", mcFolder.relativize(folder).toString()); + + return json; + } + @Override public Set getPossibleKeybinds(String featureName) { diff --git a/src/main/java/net/wurstclient/settings/ItemListSetting.java b/src/main/java/net/wurstclient/settings/ItemListSetting.java index dc06f4abfb..2ad4c317de 100644 --- a/src/main/java/net/wurstclient/settings/ItemListSetting.java +++ b/src/main/java/net/wurstclient/settings/ItemListSetting.java @@ -17,6 +17,7 @@ import com.google.gson.JsonArray; import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import net.minecraft.item.Item; import net.minecraft.registry.Registries; @@ -113,6 +114,21 @@ public JsonElement toJson() return json; } + @Override + public JsonObject exportWikiData() + { + JsonObject json = new JsonObject(); + json.addProperty("name", getName()); + json.addProperty("descriptionKey", getDescriptionKey()); + json.addProperty("type", "ItemList"); + + JsonArray defaultItems = new JsonArray(); + Arrays.stream(defaultNames).forEachOrdered(s -> defaultItems.add(s)); + json.add("defaultItems", defaultItems); + + return json; + } + @Override public Set getPossibleKeybinds(String featureName) { diff --git a/src/main/java/net/wurstclient/settings/Setting.java b/src/main/java/net/wurstclient/settings/Setting.java index b8d6ef421c..3b8b7f04db 100644 --- a/src/main/java/net/wurstclient/settings/Setting.java +++ b/src/main/java/net/wurstclient/settings/Setting.java @@ -11,6 +11,7 @@ import java.util.Set; import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import net.wurstclient.WurstClient; import net.wurstclient.clickgui.Component; @@ -43,12 +44,28 @@ public final String getWrappedDescription(int width) return ChatUtils.wrapText(getDescription(), width); } + public final String getDescriptionKey() + { + return description; + } + public abstract Component getComponent(); public abstract void fromJson(JsonElement json); public abstract JsonElement toJson(); + /** + * Exports this setting's data to a {@link JsonObject} for use in the + * Wurst Wiki. Must always specify the following properties: + *
    + *
  • name + *
  • descriptionKey + *
  • type + *
+ */ + public abstract JsonObject exportWikiData(); + public void update() { diff --git a/src/main/java/net/wurstclient/settings/SliderSetting.java b/src/main/java/net/wurstclient/settings/SliderSetting.java index 233d5a619b..bb72a0825b 100644 --- a/src/main/java/net/wurstclient/settings/SliderSetting.java +++ b/src/main/java/net/wurstclient/settings/SliderSetting.java @@ -11,6 +11,7 @@ import java.util.LinkedHashSet; import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; import net.minecraft.util.math.MathHelper; @@ -257,6 +258,22 @@ public final JsonElement toJson() return new JsonPrimitive(Math.round(value * 1e6) / 1e6); } + @Override + public JsonObject exportWikiData() + { + JsonObject json = new JsonObject(); + json.addProperty("name", getName()); + json.addProperty("descriptionKey", getDescriptionKey()); + json.addProperty("type", "Slider"); + + json.addProperty("defaultValue", defaultValue); + json.addProperty("minimum", minimum); + json.addProperty("maximum", maximum); + json.addProperty("increment", increment); + + return json; + } + @Override public final LinkedHashSet getPossibleKeybinds( String featureName) diff --git a/src/main/java/net/wurstclient/settings/TextFieldSetting.java b/src/main/java/net/wurstclient/settings/TextFieldSetting.java index 0e1f12879a..d59201efce 100644 --- a/src/main/java/net/wurstclient/settings/TextFieldSetting.java +++ b/src/main/java/net/wurstclient/settings/TextFieldSetting.java @@ -13,6 +13,7 @@ import java.util.function.Predicate; import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; import net.wurstclient.WurstClient; @@ -128,6 +129,17 @@ public JsonElement toJson() return new JsonPrimitive(value); } + @Override + public JsonObject exportWikiData() + { + JsonObject json = new JsonObject(); + json.addProperty("name", getName()); + json.addProperty("descriptionKey", getDescriptionKey()); + json.addProperty("type", "TextField"); + json.addProperty("defaultValue", defaultValue); + return json; + } + @Override public Set getPossibleKeybinds(String featureName) { From 0ae67bb4c8874f0e8e27aafbb8e1ea4a7eb04aa3 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 2 Aug 2023 19:38:52 +0200 Subject: [PATCH 152/282] Add feature type & class to export data --- .../java/net/wurstclient/other_features/WikiDataExportOtf.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/net/wurstclient/other_features/WikiDataExportOtf.java b/src/main/java/net/wurstclient/other_features/WikiDataExportOtf.java index 2da74da2ea..c511709424 100644 --- a/src/main/java/net/wurstclient/other_features/WikiDataExportOtf.java +++ b/src/main/java/net/wurstclient/other_features/WikiDataExportOtf.java @@ -63,11 +63,13 @@ private JsonObject hackToJson(Hack hack) JsonObject json = new JsonObject(); json.addProperty("name", hack.getName()); json.addProperty("descriptionKey", hack.getDescriptionKey()); + json.addProperty("type", "Hack"); Category category = hack.getCategory(); if(category != null) json.addProperty("category", category.getName()); json.addProperty("keybind", getDefaultKeybind(hack)); json.addProperty("stateSaved", hack.isStateSaved()); + json.addProperty("class", hack.getClass().getName()); JsonArray settings = new JsonArray(); for(Setting setting : hack.getSettings().values()) From fd1bd85a36d4a0d26fced0db3a69f46cdc54308d Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Fri, 4 Aug 2023 21:26:45 +0200 Subject: [PATCH 153/282] Make friends blue in Radar --- .../net/wurstclient/clickgui/components/RadarComponent.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/wurstclient/clickgui/components/RadarComponent.java b/src/main/java/net/wurstclient/clickgui/components/RadarComponent.java index 9e2bf0bee0..c51eb841ea 100644 --- a/src/main/java/net/wurstclient/clickgui/components/RadarComponent.java +++ b/src/main/java/net/wurstclient/clickgui/components/RadarComponent.java @@ -159,7 +159,9 @@ public void render(DrawContext context, int mouseX, int mouseY, continue; int color; - if(e instanceof PlayerEntity) + if(WurstClient.INSTANCE.getFriends().isFriend(e)) + color = 0x0000FF; + else if(e instanceof PlayerEntity) color = 0xFF0000; else if(e instanceof Monster) color = 0xFF8000; From 9706126541b3cf9c7f96600a65d18b635308003b Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 6 Aug 2023 17:47:27 +0200 Subject: [PATCH 154/282] Use InventoryUtils in AnchorAuraHack --- .../net/wurstclient/hacks/AnchorAuraHack.java | 47 ++++--------------- 1 file changed, 10 insertions(+), 37 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java b/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java index 4828baf5ac..d4e8bb9e8f 100644 --- a/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java +++ b/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java @@ -36,7 +36,6 @@ import net.wurstclient.SearchTags; import net.wurstclient.events.UpdateListener; import net.wurstclient.hack.Hack; -import net.wurstclient.mixinterface.IClientPlayerInteractionManager; import net.wurstclient.settings.CheckboxSetting; import net.wurstclient.settings.EnumSetting; import net.wurstclient.settings.SliderSetting; @@ -46,6 +45,7 @@ import net.wurstclient.util.BlockUtils; import net.wurstclient.util.ChatUtils; import net.wurstclient.util.FakePlayerEntity; +import net.wurstclient.util.InventoryUtils; import net.wurstclient.util.RotationUtils; import net.wurstclient.util.RotationUtils.Rotation; @@ -186,7 +186,9 @@ private void detonate(ArrayList chargedAnchors) if(isSneaking()) return; - if(!selectItem(item -> item != Items.GLOWSTONE)) + InventoryUtils.selectItem(Items.GLOWSTONE, + takeItemsFrom.getSelected().maxInvSlot); + if(!MC.player.isHolding(Items.GLOWSTONE)) return; boolean shouldSwing = false; @@ -204,7 +206,9 @@ private void charge(ArrayList unchargedAnchors) if(isSneaking()) return; - if(!selectItem(item -> item == Items.GLOWSTONE)) + InventoryUtils.selectItem(Items.GLOWSTONE, + takeItemsFrom.getSelected().maxInvSlot); + if(!MC.player.isHolding(Items.GLOWSTONE)) return; boolean shouldSwing = false; @@ -217,39 +221,6 @@ private void charge(ArrayList unchargedAnchors) MC.player.swingHand(Hand.MAIN_HAND); } - private boolean selectItem(Predicate item) - { - PlayerInventory inventory = MC.player.getInventory(); - IClientPlayerInteractionManager im = IMC.getInteractionManager(); - int maxInvSlot = takeItemsFrom.getSelected().maxInvSlot; - - for(int slot = 0; slot < maxInvSlot; slot++) - { - ItemStack stack = inventory.getStack(slot); - if(!item.test(stack.getItem())) - continue; - - if(slot < 9) - inventory.selectedSlot = slot; - else if(inventory.getEmptySlot() < 9) - im.windowClick_QUICK_MOVE(slot); - else if(inventory.getEmptySlot() != -1) - { - im.windowClick_QUICK_MOVE(inventory.selectedSlot + 36); - im.windowClick_QUICK_MOVE(slot); - }else - { - im.windowClick_PICKUP(inventory.selectedSlot + 36); - im.windowClick_PICKUP(slot); - im.windowClick_PICKUP(inventory.selectedSlot + 36); - } - - return true; - } - - return false; - } - private boolean hasItem(Predicate item) { PlayerInventory inventory = MC.player.getInventory(); @@ -337,7 +308,9 @@ private boolean placeAnchor(BlockPos pos) .getType() != HitResult.Type.MISS) continue; - if(!selectItem(item -> item == Items.RESPAWN_ANCHOR)) + InventoryUtils.selectItem(Items.RESPAWN_ANCHOR, + takeItemsFrom.getSelected().maxInvSlot); + if(!MC.player.isHolding(Items.RESPAWN_ANCHOR)) return false; faceBlocks.getSelected().face(hitVec); From 5b46c8c9948b251e22a3a7efd09c2bea854b56bc Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 6 Aug 2023 18:16:52 +0200 Subject: [PATCH 155/282] Simplify AnchorAuraHack.isChargedAnchor() by using getOrEmpty() --- .../java/net/wurstclient/hacks/AnchorAuraHack.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java b/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java index d4e8bb9e8f..21dd847a9b 100644 --- a/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java +++ b/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java @@ -420,14 +420,8 @@ private boolean isClickableNeighbor(BlockPos pos) private boolean isChargedAnchor(BlockPos pos) { - try - { - return BlockUtils.getState(pos).get(RespawnAnchorBlock.CHARGES) > 0; - - }catch(IllegalArgumentException e) - { - return false; - } + return BlockUtils.getState(pos).getOrEmpty(RespawnAnchorBlock.CHARGES) + .orElse(0) > 0; } private boolean isSneaking() From 87661e322f57b3fbd8dfeafe4dfe3059de2c03e1 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 6 Aug 2023 19:23:26 +0200 Subject: [PATCH 156/282] Clean up AnchorAura range calculations --- .../net/wurstclient/hacks/AnchorAuraHack.java | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java b/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java index 21dd847a9b..bed500a206 100644 --- a/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java +++ b/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java @@ -30,6 +30,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; import net.minecraft.util.math.Direction; +import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import net.minecraft.world.RaycastContext; import net.wurstclient.Category; @@ -278,7 +279,7 @@ private boolean rightClickBlock(BlockPos pos) private boolean placeAnchor(BlockPos pos) { Vec3d eyesPos = RotationUtils.getEyesPos(); - double rangeSq = Math.pow(range.getValue(), 2); + double rangeSq = range.getValueSq(); Vec3d posVec = Vec3d.ofCenter(pos); double distanceSqPosVec = eyesPos.squaredDistanceTo(posVec); @@ -328,19 +329,15 @@ private boolean placeAnchor(BlockPos pos) private ArrayList getNearbyAnchors() { Vec3d eyesVec = RotationUtils.getEyesPos().subtract(0.5, 0.5, 0.5); - double rangeD = range.getValue(); - int rangeI = (int)Math.ceil(rangeD); - double rangeSq = Math.pow(rangeD + 0.5, 2); - BlockPos center = BlockPos.ofFloored(RotationUtils.getEyesPos()); - BlockPos min = center.add(-rangeI, -rangeI, -rangeI); - BlockPos max = center.add(rangeI, rangeI, rangeI); + int rangeI = range.getValueCeil(); + double rangeSq = MathHelper.square(range.getValue() + 0.5); Comparator furthestFromPlayer = Comparator. comparingDouble( pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos))).reversed(); - return BlockUtils.getAllInBoxStream(min, max) + return BlockUtils.getAllInBoxStream(center, rangeI) .filter(pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos)) <= rangeSq) .filter(pos -> BlockUtils.getBlock(pos) == Blocks.RESPAWN_ANCHOR) .sorted(furthestFromPlayer) @@ -349,7 +346,7 @@ Comparator. comparingDouble( private ArrayList getNearbyTargets() { - double rangeSq = Math.pow(range.getValue(), 2); + double rangeSq = range.getValueSq(); Comparator furthestFromPlayer = Comparator . comparingDouble(e -> MC.player.squaredDistanceTo(e)) @@ -374,15 +371,12 @@ private ArrayList getNearbyTargets() private ArrayList getFreeBlocksNear(Entity target) { Vec3d eyesVec = RotationUtils.getEyesPos().subtract(0.5, 0.5, 0.5); - double rangeD = range.getValue(); - double rangeSq = Math.pow(rangeD + 0.5, 2); - int rangeI = 2; + double rangeSq = MathHelper.square(range.getValue() + 0.5); BlockPos center = target.getBlockPos(); - BlockPos min = center.add(-rangeI, -rangeI, -rangeI); - BlockPos max = center.add(rangeI, rangeI, rangeI); - Box targetBB = target.getBoundingBox(); + int rangeI = 2; + Box targetBB = target.getBoundingBox(); Vec3d targetEyesVec = target.getPos().add(0, target.getEyeHeight(target.getPose()), 0); @@ -390,7 +384,7 @@ private ArrayList getFreeBlocksNear(Entity target) Comparator. comparingDouble( pos -> targetEyesVec.squaredDistanceTo(Vec3d.ofCenter(pos))); - return BlockUtils.getAllInBoxStream(min, max) + return BlockUtils.getAllInBoxStream(center, rangeI) .filter(pos -> eyesVec.squaredDistanceTo(Vec3d.of(pos)) <= rangeSq) .filter(this::isReplaceable).filter(this::hasClickableNeighbor) .filter(pos -> !targetBB.intersects(new Box(pos))) From 7255b960154557aa0db0c4867df7b6c76bf4ef39 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 7 Aug 2023 17:32:37 +0200 Subject: [PATCH 157/282] [Wurst-Bot] Update to 23w31a --- gradle.properties | 10 +++++----- src/main/java/net/wurstclient/WurstClient.java | 2 +- .../java/net/wurstclient/hacks/CaveFinderHack.java | 2 +- .../java/net/wurstclient/hacks/MobSpawnEspHack.java | 2 +- src/main/java/net/wurstclient/hacks/SearchHack.java | 2 +- .../mixin/CustomPayloadC2SPacketAccessor.java | 2 +- .../wurstclient/other_features/VanillaSpoofOtf.java | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/gradle.properties b/gradle.properties index 1acb75bb53..32f2bb5a4d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,15 +5,15 @@ org.gradle.parallel=true # Fabric Properties # check these at https://fabricmc.net/develop/ and # https://www.curseforge.com/minecraft/mc-mods/fabric-api -minecraft_version=1.20.1 -yarn_mappings=1.20.1+build.9 -loader_version=0.14.21 +minecraft_version=23w31a +yarn_mappings=23w31a+build.12 +loader_version=0.14.22 #Fabric api -fabric_version=0.85.0+1.20.1 +fabric_version=0.86.1+1.20.2 # Mod Properties -mod_version = v7.36-MC1.20.1 +mod_version = v7.36-MC23w31a maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index 4aa6b458c7..43f9955ecf 100644 --- a/src/main/java/net/wurstclient/WurstClient.java +++ b/src/main/java/net/wurstclient/WurstClient.java @@ -57,7 +57,7 @@ public enum WurstClient public static IMinecraftClient IMC; public static final String VERSION = "7.36"; - public static final String MC_VERSION = "1.20.1"; + public static final String MC_VERSION = "23w31a"; private WurstAnalytics analytics; private EventManager eventManager; diff --git a/src/main/java/net/wurstclient/hacks/CaveFinderHack.java b/src/main/java/net/wurstclient/hacks/CaveFinderHack.java index 43de5ca57d..d99d7e4919 100644 --- a/src/main/java/net/wurstclient/hacks/CaveFinderHack.java +++ b/src/main/java/net/wurstclient/hacks/CaveFinderHack.java @@ -171,7 +171,7 @@ public void onReceivedPacket(PacketInputEvent event) chunk = world.getChunk(changedBlocks.get(0)); }else if(packet instanceof ChunkDataS2CPacket chunkData) - chunk = world.getChunk(chunkData.getX(), chunkData.getZ()); + chunk = world.getChunk(chunkData.getChunkX(), chunkData.getChunkZ()); else return; diff --git a/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java b/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java index 0678ce5f25..cbce05a1d1 100644 --- a/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java +++ b/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java @@ -200,7 +200,7 @@ public void onReceivedPacket(PacketInputEvent event) chunk = world.getChunk(changedBlocks.get(0)); }else if(packet instanceof ChunkDataS2CPacket chunkData) - chunk = world.getChunk(chunkData.getX(), chunkData.getZ()); + chunk = world.getChunk(chunkData.getChunkX(), chunkData.getChunkZ()); else return; diff --git a/src/main/java/net/wurstclient/hacks/SearchHack.java b/src/main/java/net/wurstclient/hacks/SearchHack.java index 37ae3ea300..c8661fa017 100644 --- a/src/main/java/net/wurstclient/hacks/SearchHack.java +++ b/src/main/java/net/wurstclient/hacks/SearchHack.java @@ -170,7 +170,7 @@ public void onReceivedPacket(PacketInputEvent event) chunk = world.getChunk(changedBlocks.get(0)); }else if(packet instanceof ChunkDataS2CPacket chunkData) - chunk = world.getChunk(chunkData.getX(), chunkData.getZ()); + chunk = world.getChunk(chunkData.getChunkX(), chunkData.getChunkZ()); else return; diff --git a/src/main/java/net/wurstclient/mixin/CustomPayloadC2SPacketAccessor.java b/src/main/java/net/wurstclient/mixin/CustomPayloadC2SPacketAccessor.java index e9b6253a9d..2963eca5f6 100644 --- a/src/main/java/net/wurstclient/mixin/CustomPayloadC2SPacketAccessor.java +++ b/src/main/java/net/wurstclient/mixin/CustomPayloadC2SPacketAccessor.java @@ -11,7 +11,7 @@ import org.spongepowered.asm.mixin.gen.Accessor; import net.minecraft.network.PacketByteBuf; -import net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket; +import net.minecraft.network.packet.c2s.common.CustomPayloadC2SPacket; import net.minecraft.util.Identifier; /** diff --git a/src/main/java/net/wurstclient/other_features/VanillaSpoofOtf.java b/src/main/java/net/wurstclient/other_features/VanillaSpoofOtf.java index ba0ee0b5a8..4bf1362da1 100644 --- a/src/main/java/net/wurstclient/other_features/VanillaSpoofOtf.java +++ b/src/main/java/net/wurstclient/other_features/VanillaSpoofOtf.java @@ -9,7 +9,7 @@ import io.netty.buffer.Unpooled; import net.minecraft.network.PacketByteBuf; -import net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket; +import net.minecraft.network.packet.c2s.common.CustomPayloadC2SPacket; import net.wurstclient.DontBlock; import net.wurstclient.SearchTags; import net.wurstclient.events.ConnectionPacketOutputListener; From a6470f74e63e1e16d9d48d6e045213693a5a8fe8 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Tue, 8 Aug 2023 22:22:16 +0200 Subject: [PATCH 158/282] Update to 23w31a --- .../wurstclient/altmanager/AltRenderer.java | 16 ++- .../wurstclient/altmanager/LoginManager.java | 71 +---------- .../altmanager/MinecraftProfile.java | 4 +- .../net/wurstclient/altmanager/MojangAlt.java | 8 +- .../altmanager/screens/AltEditorScreen.java | 9 +- .../altmanager/screens/AltManagerScreen.java | 17 ++- .../altmanager/screens/DirectLoginScreen.java | 14 +- .../clickgui/screens/AddBookOfferScreen.java | 16 ++- .../clickgui/screens/ClickGuiScreen.java | 13 +- .../clickgui/screens/EditBlockListScreen.java | 19 ++- .../clickgui/screens/EditBlockScreen.java | 13 +- .../clickgui/screens/EditBookOfferScreen.java | 8 +- .../screens/EditBookOffersScreen.java | 13 +- .../clickgui/screens/EditColorScreen.java | 15 +-- .../clickgui/screens/EditItemListScreen.java | 19 ++- .../clickgui/screens/EditSliderScreen.java | 13 +- .../clickgui/screens/EditTextFieldScreen.java | 13 +- .../clickgui/screens/SelectFileScreen.java | 15 ++- .../wurstclient/hacks/BonemealAuraHack.java | 8 +- .../net/wurstclient/hacks/CaveFinderHack.java | 3 +- .../wurstclient/hacks/MobSpawnEspHack.java | 3 +- .../net/wurstclient/hacks/SearchHack.java | 3 +- .../ClientCommonNetworkHandlerMixin.java | 36 ++++++ .../mixin/ClientPlayNetworkHandlerMixin.java | 29 ++--- .../mixin/CustomPayloadC2SPacketAccessor.java | 33 ----- .../mixin/DisconnectedScreenMixin.java | 8 +- .../mixin/PlayerSkinProviderMixin.java | 120 +++++------------- .../net/wurstclient/mixin/ScreenMixin.java | 22 +--- .../wurstclient/mixin/StatsScreenMixin.java | 5 +- .../wurstclient/mixin/TitleScreenMixin.java | 7 +- .../net/wurstclient/mixinterface/IScreen.java | 17 --- .../navigator/NavigatorFeatureScreen.java | 14 +- .../navigator/NavigatorMainScreen.java | 2 - .../navigator/NavigatorNewKeybindScreen.java | 5 +- .../NavigatorRemoveKeybindScreen.java | 5 +- .../navigator/NavigatorScreen.java | 8 +- .../ForcedChatReportsScreen.java | 9 +- .../nochatreports/NcrModRequiredScreen.java | 9 +- .../options/EnterProfileNameScreen.java | 13 +- .../options/KeybindEditorScreen.java | 13 +- .../options/KeybindManagerScreen.java | 15 ++- .../options/KeybindProfilesScreen.java | 15 ++- .../wurstclient/options/PressAKeyScreen.java | 7 +- .../options/WurstOptionsScreen.java | 10 +- .../options/ZoomManagerScreen.java | 6 +- .../other_features/VanillaSpoofOtf.java | 28 ++-- .../serverfinder/CleanUpScreen.java | 9 +- .../serverfinder/ServerFinderScreen.java | 14 +- .../serverfinder/WurstServerPinger.java | 3 +- .../java/net/wurstclient/util/ListWidget.java | 5 +- .../net/wurstclient/util/RenderUtils.java | 4 +- src/main/resources/wurst.accesswidener | 4 +- src/main/resources/wurst.mixins.json | 2 +- 53 files changed, 318 insertions(+), 472 deletions(-) create mode 100644 src/main/java/net/wurstclient/mixin/ClientCommonNetworkHandlerMixin.java delete mode 100644 src/main/java/net/wurstclient/mixin/CustomPayloadC2SPacketAccessor.java delete mode 100644 src/main/java/net/wurstclient/mixinterface/IScreen.java diff --git a/src/main/java/net/wurstclient/altmanager/AltRenderer.java b/src/main/java/net/wurstclient/altmanager/AltRenderer.java index 5d83d0ad9a..1d2745c439 100644 --- a/src/main/java/net/wurstclient/altmanager/AltRenderer.java +++ b/src/main/java/net/wurstclient/altmanager/AltRenderer.java @@ -25,6 +25,7 @@ import net.minecraft.client.render.VertexFormat; import net.minecraft.client.render.VertexFormats; import net.minecraft.client.util.DefaultSkinHelper; +import net.minecraft.client.util.SkinTextures; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.Identifier; import net.minecraft.util.Uuids; @@ -41,13 +42,12 @@ private static void bindSkinTexture(String name) if(loadedSkins.get(name) == null) { - UUID uuid = - Uuids.getUuidFromProfile(new GameProfile((UUID)null, name)); + UUID uuid = Uuids.getOfflinePlayerUuid(name); PlayerListEntry entry = new PlayerListEntry(new GameProfile(uuid, name), false); - loadedSkins.put(name, entry.getSkinTexture()); + loadedSkins.put(name, entry.getSkinTextures().texture()); } RenderSystem.setShaderTexture(0, loadedSkins.get(name)); @@ -123,8 +123,9 @@ public static void drawAltBody(DrawContext context, String name, int x, { bindSkinTexture(name); - boolean slim = DefaultSkinHelper - .getModel(Uuids.getOfflinePlayerUuid(name)).equals("slim"); + boolean slim = + DefaultSkinHelper.getTexture(Uuids.getOfflinePlayerUuid(name)) + .model() == SkinTextures.Model.SLIM; GL11.glEnable(GL11.GL_BLEND); RenderSystem.setShaderColor(1, 1, 1, 1); @@ -254,8 +255,9 @@ public static void drawAltBack(DrawContext context, String name, int x, { bindSkinTexture(name); - boolean slim = DefaultSkinHelper - .getModel(Uuids.getOfflinePlayerUuid(name)).equals("slim"); + boolean slim = + DefaultSkinHelper.getTexture(Uuids.getOfflinePlayerUuid(name)) + .model() == SkinTextures.Model.SLIM; GL11.glEnable(GL11.GL_BLEND); RenderSystem.setShaderColor(1, 1, 1, 1); diff --git a/src/main/java/net/wurstclient/altmanager/LoginManager.java b/src/main/java/net/wurstclient/altmanager/LoginManager.java index 34d9c2e6ee..59a649b914 100644 --- a/src/main/java/net/wurstclient/altmanager/LoginManager.java +++ b/src/main/java/net/wurstclient/altmanager/LoginManager.java @@ -7,84 +7,21 @@ */ package net.wurstclient.altmanager; -import java.net.Proxy; import java.util.Optional; -import com.mojang.authlib.Agent; -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.exceptions.AuthenticationException; -import com.mojang.authlib.exceptions.AuthenticationUnavailableException; -import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; -import com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication; - import net.minecraft.client.util.Session; +import net.minecraft.util.Uuids; import net.wurstclient.WurstClient; public enum LoginManager { ; - public static void login(String email, String password) - throws LoginException - { - YggdrasilUserAuthentication auth = - (YggdrasilUserAuthentication)new YggdrasilAuthenticationService( - Proxy.NO_PROXY, "").createUserAuthentication(Agent.MINECRAFT); - - auth.setUsername(email); - auth.setPassword(password); - - try - { - auth.logIn(); - - GameProfile profile = auth.getSelectedProfile(); - String username = profile.getName(); - String uuid = profile.getId().toString(); - String accessToken = auth.getAuthenticatedToken(); - - Session session = new Session(username, uuid, accessToken, - Optional.empty(), Optional.empty(), Session.AccountType.MOJANG); - - WurstClient.IMC.setSession(session); - - }catch(AuthenticationUnavailableException e) - { - throw new LoginException("Cannot contact authentication server!", - e); - - }catch(AuthenticationException e) - { - e.printStackTrace(); - String msg = e.getMessage().toLowerCase(); - - if(msg.contains("invalid username or password.")) - throw new LoginException("Wrong password! (or shadowbanned)", - e); - - if(msg.contains("account migrated")) - throw new LoginException("Account migrated to Mojang account.", - e); - - if(msg.contains("migrated")) - throw new LoginException( - "Account migrated to Microsoft account.", e); - - throw new LoginException("Cannot contact authentication server!", - e); - - }catch(NullPointerException e) - { - e.printStackTrace(); - - throw new LoginException("Wrong password! (or shadowbanned)", e); - } - } - public static void changeCrackedName(String newName) { - Session session = new Session(newName, "", "", Optional.empty(), - Optional.empty(), Session.AccountType.MOJANG); + Session session = + new Session(newName, Uuids.getOfflinePlayerUuid(newName), "", + Optional.empty(), Optional.empty(), Session.AccountType.MOJANG); WurstClient.IMC.setSession(session); } diff --git a/src/main/java/net/wurstclient/altmanager/MinecraftProfile.java b/src/main/java/net/wurstclient/altmanager/MinecraftProfile.java index ed36efbd67..9fb47249d6 100644 --- a/src/main/java/net/wurstclient/altmanager/MinecraftProfile.java +++ b/src/main/java/net/wurstclient/altmanager/MinecraftProfile.java @@ -22,9 +22,9 @@ public MinecraftProfile(UUID uuid, String name, String mcAccessToken) this.mcAccessToken = mcAccessToken; } - public String getUUID() + public UUID getUUID() { - return "" + uuid; + return uuid; } public String getName() diff --git a/src/main/java/net/wurstclient/altmanager/MojangAlt.java b/src/main/java/net/wurstclient/altmanager/MojangAlt.java index 7960297309..863834972b 100644 --- a/src/main/java/net/wurstclient/altmanager/MojangAlt.java +++ b/src/main/java/net/wurstclient/altmanager/MojangAlt.java @@ -61,13 +61,7 @@ public MojangAlt(String email, String password, String name, @Override public void login() throws LoginException { - try - { - MicrosoftLoginManager.login(email, password); - }catch(Exception e) - { - LoginManager.login(email, password); - } + MicrosoftLoginManager.login(email, password); name = getNameFromSession(); } diff --git a/src/main/java/net/wurstclient/altmanager/screens/AltEditorScreen.java b/src/main/java/net/wurstclient/altmanager/screens/AltEditorScreen.java index 1a0d3bb759..17d833bf80 100644 --- a/src/main/java/net/wurstclient/altmanager/screens/AltEditorScreen.java +++ b/src/main/java/net/wurstclient/altmanager/screens/AltEditorScreen.java @@ -29,6 +29,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -143,9 +144,6 @@ private void createSkinFolder() @Override public final void tick() { - nameOrEmailBox.tick(); - passwordBox.tick(); - String nameOrEmail = nameOrEmailBox.getText().trim(); boolean alex = nameOrEmail.equalsIgnoreCase("Alexander01998"); @@ -346,7 +344,7 @@ public boolean mouseClicked(double x, double y, int button) public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); MatrixStack matrixStack = context.getMatrices(); Matrix4f matrix = matrixStack.peek().getPositionMatrix(); @@ -399,7 +397,8 @@ public void render(DrawContext context, int mouseX, int mouseY, errorTimer--; } - super.render(context, mouseX, mouseY, partialTicks); + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/altmanager/screens/AltManagerScreen.java b/src/main/java/net/wurstclient/altmanager/screens/AltManagerScreen.java index 12656b70ee..8e36d373ed 100644 --- a/src/main/java/net/wurstclient/altmanager/screens/AltManagerScreen.java +++ b/src/main/java/net/wurstclient/altmanager/screens/AltManagerScreen.java @@ -49,7 +49,6 @@ import net.minecraft.util.math.MathHelper; import net.wurstclient.WurstClient; import net.wurstclient.altmanager.*; -import net.wurstclient.mixinterface.IScreen; import net.wurstclient.util.ListWidget; import net.wurstclient.util.MultiProcessingUtils; import net.wurstclient.util.json.JsonException; @@ -181,10 +180,12 @@ public boolean mouseReleased(double mouseX, double mouseY, int button) } @Override - public boolean mouseScrolled(double d, double e, double amount) + public boolean mouseScrolled(double mouseX, double mouseY, + double horizontalAmount, double verticalAmount) { - listGui.mouseScrolled(d, e, amount); - return super.mouseScrolled(d, e, amount); + listGui.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount); + return super.mouseScrolled(mouseX, mouseY, horizontalAmount, + verticalAmount); } @Override @@ -412,7 +413,7 @@ private void confirmRemove(boolean confirmed) public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); listGui.render(context, mouseX, mouseY, partialTicks); MatrixStack matrixStack = context.getMatrices(); @@ -468,7 +469,9 @@ public void render(DrawContext context, int mouseX, int mouseY, errorTimer--; } - super.render(context, mouseX, mouseY, partialTicks); + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); + renderButtonTooltip(context, mouseX, mouseY); renderAltTooltip(context, mouseX, mouseY); } @@ -521,7 +524,7 @@ private void renderAltTooltip(DrawContext context, int mouseX, int mouseY) private void renderButtonTooltip(DrawContext context, int mouseX, int mouseY) { - for(Drawable d : ((IScreen)(Object)this).getButtons()) + for(Drawable d : drawables) { if(!(d instanceof ClickableWidget)) continue; diff --git a/src/main/java/net/wurstclient/altmanager/screens/DirectLoginScreen.java b/src/main/java/net/wurstclient/altmanager/screens/DirectLoginScreen.java index 24c3f7839c..6408b3c4de 100644 --- a/src/main/java/net/wurstclient/altmanager/screens/DirectLoginScreen.java +++ b/src/main/java/net/wurstclient/altmanager/screens/DirectLoginScreen.java @@ -42,18 +42,8 @@ protected void pressDoneButton() }catch(LoginException e) { - try - { - LoginManager.login(nameOrEmail, password); - - }catch(LoginException e2) - { - message = "\u00a7c\u00a7lMicrosoft:\u00a7c " - + e.getMessage() + "\n\u00a7c\u00a7lMojang:\u00a7c " - + e2.getMessage(); - - doErrorEffect(); - } + message = "\u00a7c\u00a7lMicrosoft:\u00a7c " + e.getMessage(); + doErrorEffect(); return; } diff --git a/src/main/java/net/wurstclient/clickgui/screens/AddBookOfferScreen.java b/src/main/java/net/wurstclient/clickgui/screens/AddBookOfferScreen.java index b822164d2b..f8ebb65c52 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/AddBookOfferScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/AddBookOfferScreen.java @@ -15,6 +15,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -237,10 +238,12 @@ public boolean mouseReleased(double mouseX, double mouseY, int button) } @Override - public boolean mouseScrolled(double mouseX, double mouseY, double amount) + public boolean mouseScrolled(double mouseX, double mouseY, + double horizontalAmount, double verticalAmount) { - listGui.mouseScrolled(mouseX, mouseY, amount); - return super.mouseScrolled(mouseX, mouseY, amount); + listGui.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount); + return super.mouseScrolled(mouseX, mouseY, horizontalAmount, + verticalAmount); } @Override @@ -281,9 +284,6 @@ public void tick() pricePlusButton.active = offerToAdd != null && offerToAdd.price() < 64; priceMinusButton.active = offerToAdd != null && offerToAdd.price() > 1; - - levelField.tick(); - priceField.tick(); } @Override @@ -303,7 +303,9 @@ public void render(DrawContext context, int mouseX, int mouseY, levelField.render(context, mouseX, mouseY, partialTicks); priceField.render(context, mouseX, mouseY, partialTicks); - super.render(context, mouseX, mouseY, partialTicks); + + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); matrixStack.translate(width / 2 - 100, 0, 0); diff --git a/src/main/java/net/wurstclient/clickgui/screens/ClickGuiScreen.java b/src/main/java/net/wurstclient/clickgui/screens/ClickGuiScreen.java index 67dffd847e..925a504926 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/ClickGuiScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/ClickGuiScreen.java @@ -8,6 +8,7 @@ package net.wurstclient.clickgui.screens; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.text.Text; import net.wurstclient.clickgui.ClickGui; @@ -43,17 +44,21 @@ public boolean mouseReleased(double mouseX, double mouseY, int mouseButton) } @Override - public boolean mouseScrolled(double mouseX, double mouseY, double delta) + public boolean mouseScrolled(double mouseX, double mouseY, + double horizontalAmount, double verticalAmount) { - gui.handleMouseScroll(mouseX, mouseY, delta); - return super.mouseScrolled(mouseX, mouseY, delta); + gui.handleMouseScroll(mouseX, mouseY, verticalAmount); + return super.mouseScrolled(mouseX, mouseY, horizontalAmount, + verticalAmount); } @Override public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - super.render(context, mouseX, mouseY, partialTicks); + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); + gui.render(context, mouseX, mouseY, partialTicks); } } diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditBlockListScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditBlockListScreen.java index 03767f4b89..27fafa87f6 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditBlockListScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditBlockListScreen.java @@ -15,6 +15,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.ConfirmScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; @@ -114,11 +115,12 @@ public boolean mouseReleased(double double_1, double double_2, int int_1) } @Override - public boolean mouseScrolled(double double_1, double double_2, - double double_3) + public boolean mouseScrolled(double mouseX, double mouseY, + double horizontalAmount, double verticalAmount) { - listGui.mouseScrolled(double_1, double_2, double_3); - return super.mouseScrolled(double_1, double_2, double_3); + listGui.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount); + return super.mouseScrolled(mouseX, mouseY, horizontalAmount, + verticalAmount); } @Override @@ -150,8 +152,6 @@ public boolean keyPressed(int keyCode, int scanCode, int int_3) @Override public void tick() { - blockNameField.tick(); - String nameOrId = blockNameField.getText(); blockToAdd = BlockUtils.getBlockFromNameOrID(nameOrId); addButton.active = blockToAdd != null; @@ -175,8 +175,11 @@ public void render(DrawContext context, int mouseX, int mouseY, matrixStack.translate(0, 0, 300); blockNameField.render(context, mouseX, mouseY, partialTicks); - super.render(context, mouseX, mouseY, partialTicks); + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); + + matrixStack.push(); matrixStack.translate(-64 + width / 2 - 152, 0, 0); if(blockNameField.getText().isEmpty() && !blockNameField.isFocused()) @@ -201,6 +204,8 @@ public void render(DrawContext context, int mouseX, int mouseY, RenderUtils.drawItem(context, blockToAdd == null ? ItemStack.EMPTY : new ItemStack(blockToAdd), width / 2 - 164, height - 52, false); + + matrixStack.pop(); } @Override diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditBlockScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditBlockScreen.java index 15ba477551..194892316a 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditBlockScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditBlockScreen.java @@ -13,6 +13,7 @@ import net.minecraft.block.Blocks; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -90,12 +91,6 @@ public boolean keyPressed(int keyCode, int scanCode, int int_3) return super.keyPressed(keyCode, scanCode, int_3); } - @Override - public void tick() - { - blockField.tick(); - } - @Override public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) @@ -103,12 +98,14 @@ public void render(DrawContext context, int mouseX, int mouseY, MatrixStack matrixStack = context.getMatrices(); TextRenderer tr = client.textRenderer; - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); context.drawCenteredTextWithShadow(tr, setting.getName(), width / 2, 20, 0xFFFFFF); blockField.render(context, mouseX, mouseY, partialTicks); - super.render(context, mouseX, mouseY, partialTicks); + + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); matrixStack.push(); matrixStack.translate(-64 + width / 2 - 100, 115, 0); diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditBookOfferScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditBookOfferScreen.java index e3f66b5ce5..90301b5e7d 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditBookOfferScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditBookOfferScreen.java @@ -11,6 +11,7 @@ import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -246,9 +247,6 @@ public void tick() offerToSave != null && offerToSave.price() < 64; priceMinusButton.active = offerToSave != null && offerToSave.price() > 1; - - levelField.tick(); - priceField.tick(); } @Override @@ -296,7 +294,9 @@ public void render(DrawContext context, int mouseX, int mouseY, levelField.render(context, mouseX, mouseY, partialTicks); priceField.render(context, mouseX, mouseY, partialTicks); - super.render(context, mouseX, mouseY, partialTicks); + + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); matrixStack.translate(width / 2 - 100, 112, 0); diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditBookOffersScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditBookOffersScreen.java index f65894dbe5..31fb5a1725 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditBookOffersScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditBookOffersScreen.java @@ -14,6 +14,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.ConfirmScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; @@ -125,11 +126,12 @@ public boolean mouseReleased(double double_1, double double_2, int int_1) } @Override - public boolean mouseScrolled(double double_1, double double_2, - double double_3) + public boolean mouseScrolled(double mouseX, double mouseY, + double horizontalAmount, double verticalAmount) { - listGui.mouseScrolled(double_1, double_2, double_3); - return super.mouseScrolled(double_1, double_2, double_3); + listGui.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount); + return super.mouseScrolled(mouseX, mouseY, horizontalAmount, + verticalAmount); } @Override @@ -190,7 +192,8 @@ public void render(DrawContext context, int mouseX, int mouseY, bookOffers.getName() + " (" + listGui.getItemCount() + ")", width / 2, 12, 0xffffff); - super.render(context, mouseX, mouseY, partialTicks); + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); matrixStack.pop(); } diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditColorScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditColorScreen.java index 787cc1bf91..5533fde495 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditColorScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditColorScreen.java @@ -19,6 +19,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -155,22 +156,13 @@ private void done() client.setScreen(prevScreen); } - @Override - public void tick() - { - hexValueField.tick(); - redValueField.tick(); - greenValueField.tick(); - blueValueField.tick(); - } - @Override public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { TextRenderer tr = client.textRenderer; - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); context.drawCenteredTextWithShadow(client.textRenderer, colorSetting.getName(), width / 2, 16, 0xF0F0F0); @@ -217,7 +209,8 @@ public void render(DrawContext context, int mouseX, int mouseY, context.fill(boxX, boxY, boxX + boxWidth, boxY + boxHeight, color.getRGB()); - super.render(context, mouseX, mouseY, partialTicks); + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditItemListScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditItemListScreen.java index be3fafc58a..2c5955b4a4 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditItemListScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditItemListScreen.java @@ -14,6 +14,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.ConfirmScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; @@ -116,11 +117,12 @@ public boolean mouseReleased(double double_1, double double_2, int int_1) } @Override - public boolean mouseScrolled(double double_1, double double_2, - double double_3) + public boolean mouseScrolled(double mouseX, double mouseY, + double horizontalAmount, double verticalAmount) { - listGui.mouseScrolled(double_1, double_2, double_3); - return super.mouseScrolled(double_1, double_2, double_3); + listGui.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount); + return super.mouseScrolled(mouseX, mouseY, horizontalAmount, + verticalAmount); } @Override @@ -152,8 +154,6 @@ public boolean keyPressed(int keyCode, int scanCode, int int_3) @Override public void tick() { - itemNameField.tick(); - itemToAdd = ItemUtils .getItemFromNameOrID(itemNameField.getText().toLowerCase()); addButton.active = itemToAdd != null; @@ -177,8 +177,11 @@ public void render(DrawContext context, int mouseX, int mouseY, matrixStack.translate(0, 0, 300); itemNameField.render(context, mouseX, mouseY, partialTicks); - super.render(context, mouseX, mouseY, partialTicks); + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); + + matrixStack.push(); matrixStack.translate(-64 + width / 2 - 152, 0, 0); if(itemNameField.getText().isEmpty() && !itemNameField.isFocused()) @@ -208,6 +211,8 @@ public void render(DrawContext context, int mouseX, int mouseY, RenderUtils.drawItem(context, itemToAdd == null ? ItemStack.EMPTY : new ItemStack(itemToAdd), width / 2 - 164, height - 52, false); + + matrixStack.pop(); } @Override diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditSliderScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditSliderScreen.java index 29e70034fa..baeaae36c4 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditSliderScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditSliderScreen.java @@ -11,6 +11,7 @@ import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -85,22 +86,18 @@ public boolean keyPressed(int keyCode, int scanCode, int int_3) return super.keyPressed(keyCode, scanCode, int_3); } - @Override - public void tick() - { - valueField.tick(); - } - @Override public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); context.drawCenteredTextWithShadow(client.textRenderer, slider.getName(), width / 2, 20, 0xFFFFFF); valueField.render(context, mouseX, mouseY, partialTicks); - super.render(context, mouseX, mouseY, partialTicks); + + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditTextFieldScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditTextFieldScreen.java index 3dfa0fd981..22259042b7 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditTextFieldScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditTextFieldScreen.java @@ -11,6 +11,7 @@ import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -80,22 +81,18 @@ public boolean keyPressed(int keyCode, int scanCode, int int_3) return super.keyPressed(keyCode, scanCode, int_3); } - @Override - public void tick() - { - valueField.tick(); - } - @Override public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); context.drawCenteredTextWithShadow(client.textRenderer, setting.getName(), width / 2, 20, 0xFFFFFF); valueField.render(context, mouseX, mouseY, partialTicks); - super.render(context, mouseX, mouseY, partialTicks); + + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/clickgui/screens/SelectFileScreen.java b/src/main/java/net/wurstclient/clickgui/screens/SelectFileScreen.java index 231dfd5c6d..c361809591 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/SelectFileScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/SelectFileScreen.java @@ -17,6 +17,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.ConfirmScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; @@ -136,11 +137,12 @@ public boolean mouseReleased(double double_1, double double_2, int int_1) } @Override - public boolean mouseScrolled(double double_1, double double_2, - double double_3) + public boolean mouseScrolled(double mouseX, double mouseY, + double horizontalAmount, double verticalAmount) { - listGui.mouseScrolled(double_1, double_2, double_3); - return super.mouseScrolled(double_1, double_2, double_3); + listGui.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount); + return super.mouseScrolled(mouseX, mouseY, horizontalAmount, + verticalAmount); } @Override @@ -165,13 +167,14 @@ public void tick() public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); listGui.render(context, mouseX, mouseY, partialTicks); context.drawCenteredTextWithShadow(client.textRenderer, setting.getName(), width / 2, 12, 0xffffff); - super.render(context, mouseX, mouseY, partialTicks); + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); if(doneButton.isSelected() && !doneButton.active) context.drawTooltip(textRenderer, diff --git a/src/main/java/net/wurstclient/hacks/BonemealAuraHack.java b/src/main/java/net/wurstclient/hacks/BonemealAuraHack.java index 7c6c66571b..14ef79090d 100644 --- a/src/main/java/net/wurstclient/hacks/BonemealAuraHack.java +++ b/src/main/java/net/wurstclient/hacks/BonemealAuraHack.java @@ -210,16 +210,16 @@ private boolean isCorrectBlock(BlockPos pos) return false; if(block instanceof SaplingBlock - && ((SaplingBlock)block).isFertilizable(world, pos, state, true)) + && ((SaplingBlock)block).isFertilizable(world, pos, state)) return saplings.isChecked(); if(block instanceof CropBlock - && ((CropBlock)block).isFertilizable(world, pos, state, true)) + && ((CropBlock)block).isFertilizable(world, pos, state)) return crops.isChecked(); if(block instanceof StemBlock - && ((StemBlock)block).isFertilizable(world, pos, state, true)) + && ((StemBlock)block).isFertilizable(world, pos, state)) return stems.isChecked(); if(block instanceof CocoaBlock - && ((CocoaBlock)block).isFertilizable(world, pos, state, true)) + && ((CocoaBlock)block).isFertilizable(world, pos, state)) return cocoa.isChecked(); return other.isChecked(); } diff --git a/src/main/java/net/wurstclient/hacks/CaveFinderHack.java b/src/main/java/net/wurstclient/hacks/CaveFinderHack.java index d99d7e4919..e0aa46553e 100644 --- a/src/main/java/net/wurstclient/hacks/CaveFinderHack.java +++ b/src/main/java/net/wurstclient/hacks/CaveFinderHack.java @@ -171,7 +171,8 @@ public void onReceivedPacket(PacketInputEvent event) chunk = world.getChunk(changedBlocks.get(0)); }else if(packet instanceof ChunkDataS2CPacket chunkData) - chunk = world.getChunk(chunkData.getChunkX(), chunkData.getChunkZ()); + chunk = + world.getChunk(chunkData.getChunkX(), chunkData.getChunkZ()); else return; diff --git a/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java b/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java index cbce05a1d1..b17fa2a419 100644 --- a/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java +++ b/src/main/java/net/wurstclient/hacks/MobSpawnEspHack.java @@ -200,7 +200,8 @@ public void onReceivedPacket(PacketInputEvent event) chunk = world.getChunk(changedBlocks.get(0)); }else if(packet instanceof ChunkDataS2CPacket chunkData) - chunk = world.getChunk(chunkData.getChunkX(), chunkData.getChunkZ()); + chunk = + world.getChunk(chunkData.getChunkX(), chunkData.getChunkZ()); else return; diff --git a/src/main/java/net/wurstclient/hacks/SearchHack.java b/src/main/java/net/wurstclient/hacks/SearchHack.java index c8661fa017..4d6b3369e2 100644 --- a/src/main/java/net/wurstclient/hacks/SearchHack.java +++ b/src/main/java/net/wurstclient/hacks/SearchHack.java @@ -170,7 +170,8 @@ public void onReceivedPacket(PacketInputEvent event) chunk = world.getChunk(changedBlocks.get(0)); }else if(packet instanceof ChunkDataS2CPacket chunkData) - chunk = world.getChunk(chunkData.getChunkX(), chunkData.getChunkZ()); + chunk = + world.getChunk(chunkData.getChunkX(), chunkData.getChunkZ()); else return; diff --git a/src/main/java/net/wurstclient/mixin/ClientCommonNetworkHandlerMixin.java b/src/main/java/net/wurstclient/mixin/ClientCommonNetworkHandlerMixin.java new file mode 100644 index 0000000000..9c9fe9cf00 --- /dev/null +++ b/src/main/java/net/wurstclient/mixin/ClientCommonNetworkHandlerMixin.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2014-2023 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import net.minecraft.client.network.ClientCommonNetworkHandler; +import net.minecraft.network.listener.ClientCommonPacketListener; +import net.minecraft.network.packet.Packet; +import net.wurstclient.event.EventManager; +import net.wurstclient.events.PacketOutputListener.PacketOutputEvent; + +@Mixin(ClientCommonNetworkHandler.class) +public abstract class ClientCommonNetworkHandlerMixin + implements ClientCommonPacketListener +{ + @Inject(at = @At("HEAD"), + method = "sendPacket(Lnet/minecraft/network/packet/Packet;)V", + cancellable = true) + private void onSendPacket(Packet packet, CallbackInfo ci) + { + PacketOutputEvent event = new PacketOutputEvent(packet); + EventManager.fire(event); + + if(event.isCancelled()) + ci.cancel(); + } +} diff --git a/src/main/java/net/wurstclient/mixin/ClientPlayNetworkHandlerMixin.java b/src/main/java/net/wurstclient/mixin/ClientPlayNetworkHandlerMixin.java index 9d246a74be..b195f1018b 100644 --- a/src/main/java/net/wurstclient/mixin/ClientPlayNetworkHandlerMixin.java +++ b/src/main/java/net/wurstclient/mixin/ClientPlayNetworkHandlerMixin.java @@ -7,18 +7,19 @@ */ package net.wurstclient.mixin; -import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.network.ClientCommonNetworkHandler; +import net.minecraft.client.network.ClientConnectionState; import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.client.toast.SystemToast; +import net.minecraft.network.ClientConnection; import net.minecraft.network.listener.ClientPlayPacketListener; -import net.minecraft.network.packet.Packet; +import net.minecraft.network.listener.TickablePacketListener; import net.minecraft.network.packet.s2c.play.BlockUpdateS2CPacket; import net.minecraft.network.packet.s2c.play.ChunkData; import net.minecraft.network.packet.s2c.play.ChunkDeltaUpdateS2CPacket; @@ -26,28 +27,18 @@ import net.minecraft.text.MutableText; import net.minecraft.text.Text; import net.wurstclient.WurstClient; -import net.wurstclient.event.EventManager; -import net.wurstclient.events.PacketOutputListener.PacketOutputEvent; import net.wurstclient.util.ChatUtils; @Mixin(ClientPlayNetworkHandler.class) public abstract class ClientPlayNetworkHandlerMixin - implements ClientPlayPacketListener + extends ClientCommonNetworkHandler + implements TickablePacketListener, ClientPlayPacketListener { - @Shadow - @Final - private MinecraftClient client; - - @Inject(at = @At("HEAD"), - method = "sendPacket(Lnet/minecraft/network/packet/Packet;)V", - cancellable = true) - private void onSendPacket(Packet packet, CallbackInfo ci) + private ClientPlayNetworkHandlerMixin(WurstClient wurst, + MinecraftClient client, ClientConnection connection, + ClientConnectionState connectionState) { - PacketOutputEvent event = new PacketOutputEvent(packet); - EventManager.fire(event); - - if(event.isCancelled()) - ci.cancel(); + super(client, connection, connectionState); } @Inject(at = @At("TAIL"), diff --git a/src/main/java/net/wurstclient/mixin/CustomPayloadC2SPacketAccessor.java b/src/main/java/net/wurstclient/mixin/CustomPayloadC2SPacketAccessor.java deleted file mode 100644 index 2963eca5f6..0000000000 --- a/src/main/java/net/wurstclient/mixin/CustomPayloadC2SPacketAccessor.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2014-2023 Wurst-Imperium and contributors. - * - * This source code is subject to the terms of the GNU General Public - * License, version 3. If a copy of the GPL was not distributed with this - * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt - */ -package net.wurstclient.mixin; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -import net.minecraft.network.PacketByteBuf; -import net.minecraft.network.packet.c2s.common.CustomPayloadC2SPacket; -import net.minecraft.util.Identifier; - -/** - * Same as - * {@link net.fabricmc.fabric.mixin.networking.accessor.CustomPayloadC2SPacketAccessor} - * and - * {@link net.fabricmc.fabric.mixin.networking.CustomPayloadC2SPacketAccessor}, - * except that this class doesn't change its package based on what Fabric API - * version you have. - */ -@Mixin(CustomPayloadC2SPacket.class) -public interface CustomPayloadC2SPacketAccessor -{ - @Accessor - Identifier getChannel(); - - @Accessor - PacketByteBuf getData(); -} diff --git a/src/main/java/net/wurstclient/mixin/DisconnectedScreenMixin.java b/src/main/java/net/wurstclient/mixin/DisconnectedScreenMixin.java index 6783df717a..88c3311e45 100644 --- a/src/main/java/net/wurstclient/mixin/DisconnectedScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/DisconnectedScreenMixin.java @@ -19,7 +19,7 @@ import net.minecraft.client.gui.screen.DisconnectedScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.client.gui.widget.GridWidget; +import net.minecraft.client.gui.widget.DirectionalLayoutWidget; import net.minecraft.text.Text; import net.wurstclient.WurstClient; import net.wurstclient.hacks.AutoReconnectHack; @@ -41,7 +41,7 @@ public class DisconnectedScreenMixin extends Screen private Screen parent; @Shadow @Final - private final GridWidget grid = new GridWidget(); + private DirectionalLayoutWidget grid; private DisconnectedScreenMixin(WurstClient wurst, Text title) { @@ -76,12 +76,12 @@ private void addReconnectButtons() ButtonWidget reconnectButton = grid.add( ButtonWidget.builder(Text.literal("Reconnect"), b -> LastServerRememberer.reconnect(parent)).build(), - 3, 0, 1, 1, grid.copyPositioner().margin(2).marginTop(-6)); + grid.copyPositioner().margin(2).marginTop(-6)); autoReconnectButton = grid.add( ButtonWidget.builder(Text.literal("AutoReconnect"), b -> pressAutoReconnect()).build(), - 4, 0, 1, 1, grid.copyPositioner().margin(2)); + grid.copyPositioner().margin(2)); grid.refreshPositions(); Stream.of(reconnectButton, autoReconnectButton) diff --git a/src/main/java/net/wurstclient/mixin/PlayerSkinProviderMixin.java b/src/main/java/net/wurstclient/mixin/PlayerSkinProviderMixin.java index ebd56e0318..ddfd91d7ae 100644 --- a/src/main/java/net/wurstclient/mixin/PlayerSkinProviderMixin.java +++ b/src/main/java/net/wurstclient/mixin/PlayerSkinProviderMixin.java @@ -9,104 +9,33 @@ import java.io.InputStreamReader; import java.net.URL; -import java.util.HashMap; +import java.util.concurrent.CompletableFuture; -import javax.annotation.Nullable; - -import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.ModifyVariable; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Maps; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.mojang.authlib.GameProfile; -import com.mojang.authlib.minecraft.InsecurePublicKeyException; import com.mojang.authlib.minecraft.MinecraftProfileTexture; -import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type; -import com.mojang.authlib.minecraft.MinecraftSessionService; -import com.mojang.blaze3d.systems.RenderSystem; -import net.minecraft.client.MinecraftClient; import net.minecraft.client.texture.PlayerSkinProvider; -import net.minecraft.util.Identifier; -import net.minecraft.util.Util; +import net.minecraft.client.texture.PlayerSkinProvider.Textures; +import net.minecraft.client.util.SkinTextures; @Mixin(PlayerSkinProvider.class) public class PlayerSkinProviderMixin { - @Shadow - @Final - private MinecraftSessionService sessionService; - private static JsonObject capes; + private MinecraftProfileTexture currentCape; @Inject(at = @At("HEAD"), - method = "loadSkin(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/texture/PlayerSkinProvider$SkinTextureAvailableCallback;Z)V", - cancellable = true) - private void onLoadSkin(GameProfile profile, - PlayerSkinProvider.SkinTextureAvailableCallback callback, - boolean requireSecure, CallbackInfo ci) - { - // Can't @Inject nicely because everything is wrapped in a lambda. - // Had to replace the whole method. - - Runnable runnable = () -> { - HashMap map = - Maps.newHashMap(); - try - { - map.putAll(sessionService.getTextures(profile, requireSecure)); - }catch(InsecurePublicKeyException e) - { - // empty catch block - } - if(map.isEmpty()) - { - profile.getProperties().clear(); - if(profile.getId().equals(MinecraftClient.getInstance() - .getSession().getProfile().getId())) - { - profile.getProperties().putAll( - MinecraftClient.getInstance().getSessionProperties()); - map.putAll(sessionService.getTextures(profile, false)); - }else - { - sessionService.fillProfileProperties(profile, - requireSecure); - try - { - map.putAll( - sessionService.getTextures(profile, requireSecure)); - }catch(InsecurePublicKeyException e) - { - - } - } - } - - addWurstCape(profile, map); - - MinecraftClient.getInstance().execute(() -> { - RenderSystem.recordRenderCall(() -> { - ImmutableList.of(Type.SKIN, Type.CAPE).forEach(type -> { - if(map.containsKey(type)) - loadSkin(map.get(type), type, callback); - }); - }); - }); - }; - Util.getMainWorkerExecutor().execute(runnable); - - ci.cancel(); - } - - private void addWurstCape(GameProfile profile, - HashMap map) + method = "fetchSkinTextures(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/texture/PlayerSkinProvider$Textures;)Ljava/util/concurrent/CompletableFuture;") + private void onFetchSkinTextures(GameProfile profile, Textures textures, + CallbackInfoReturnable> cir) { String name = profile.getName(); String uuid = profile.getId().toString(); @@ -119,13 +48,15 @@ private void addWurstCape(GameProfile profile, if(capes.has(name)) { String capeURL = capes.get(name).getAsString(); - map.put(Type.CAPE, new MinecraftProfileTexture(capeURL, null)); + currentCape = new MinecraftProfileTexture(capeURL, null); }else if(capes.has(uuid)) { String capeURL = capes.get(uuid).getAsString(); - map.put(Type.CAPE, new MinecraftProfileTexture(capeURL, null)); - } + currentCape = new MinecraftProfileTexture(capeURL, null); + + }else + currentCape = null; }catch(Exception e) { @@ -136,6 +67,21 @@ private void addWurstCape(GameProfile profile, } } + @ModifyVariable(at = @At("STORE"), + method = "fetchSkinTextures(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/texture/PlayerSkinProvider$Textures;)Ljava/util/concurrent/CompletableFuture;", + ordinal = 1, + name = "minecraftProfileTexture2") + private MinecraftProfileTexture modifyCapeTexture( + MinecraftProfileTexture old) + { + if(currentCape == null) + return old; + + MinecraftProfileTexture result = currentCape; + currentCape = null; + return result; + } + private void setupWurstCapes() { try @@ -155,12 +101,4 @@ private void setupWurstCapes() e.printStackTrace(); } } - - @Shadow - public Identifier loadSkin(MinecraftProfileTexture profileTexture, - Type type, - @Nullable PlayerSkinProvider.SkinTextureAvailableCallback callback) - { - return null; - } } diff --git a/src/main/java/net/wurstclient/mixin/ScreenMixin.java b/src/main/java/net/wurstclient/mixin/ScreenMixin.java index 31c44b1e5e..0fbfe244fe 100644 --- a/src/main/java/net/wurstclient/mixin/ScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/ScreenMixin.java @@ -7,11 +7,7 @@ */ package net.wurstclient.mixin; -import java.util.List; - -import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -21,29 +17,19 @@ import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.wurstclient.WurstClient; -import net.wurstclient.mixinterface.IScreen; @Mixin(Screen.class) public abstract class ScreenMixin extends AbstractParentElement - implements Drawable, IScreen + implements Drawable { - @Shadow - @Final - private List drawables; - @Inject(at = @At("HEAD"), - method = "renderBackground(Lnet/minecraft/client/gui/DrawContext;)V", + method = "renderBackground(Lnet/minecraft/client/gui/DrawContext;IIF)V", cancellable = true) - public void onRenderBackground(DrawContext context, CallbackInfo ci) + public void onRenderBackground(DrawContext context, int mouseX, int mouseY, + float partialTicks, CallbackInfo ci) { if(WurstClient.INSTANCE.getHax().noBackgroundHack .shouldCancelBackground((Screen)(Object)this)) ci.cancel(); } - - @Override - public List getButtons() - { - return drawables; - } } diff --git a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java index 31ba96df23..5bb70c72a6 100644 --- a/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/StatsScreenMixin.java @@ -21,7 +21,6 @@ import net.minecraft.client.resource.language.I18n; import net.minecraft.text.Text; import net.wurstclient.WurstClient; -import net.wurstclient.mixinterface.IScreen; @Mixin(StatsScreen.class) public abstract class StatsScreenMixin extends Screen implements StatsListener @@ -31,7 +30,7 @@ private StatsScreenMixin(WurstClient wurst, Text text_1) super(text_1); } - @Inject(at = {@At("TAIL")}, method = {"createButtons()V"}) + @Inject(at = @At("TAIL"), method = "createButtons()V") private void onCreateButtons(CallbackInfo ci) { if(WurstClient.INSTANCE.getOtfs().disableOtf.shouldHideEnableButton()) @@ -44,7 +43,7 @@ private void onCreateButtons(CallbackInfo ci) updateWurstButtonText(toggleWurstButton); addDrawableChild(toggleWurstButton); - for(Drawable d : ((IScreen)this).getButtons()) + for(Drawable d : drawables) { if(!(d instanceof ClickableWidget)) continue; diff --git a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java index bbe585269c..f5c59f8e7c 100644 --- a/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java +++ b/src/main/java/net/wurstclient/mixin/TitleScreenMixin.java @@ -22,7 +22,6 @@ import net.minecraft.text.Text; import net.wurstclient.WurstClient; import net.wurstclient.altmanager.screens.AltManagerScreen; -import net.wurstclient.mixinterface.IScreen; @Mixin(TitleScreen.class) public abstract class TitleScreenMixin extends Screen @@ -35,13 +34,13 @@ private TitleScreenMixin(WurstClient wurst, Text text_1) super(text_1); } - @Inject(at = {@At("RETURN")}, method = {"init()V"}) + @Inject(at = @At("RETURN"), method = "init()V") private void onInitWidgetsNormal(CallbackInfo ci) { if(!WurstClient.INSTANCE.isEnabled()) return; - for(Drawable d : ((IScreen)this).getButtons()) + for(Drawable d : drawables) { if(!(d instanceof ClickableWidget)) continue; @@ -69,7 +68,7 @@ private void onInitWidgetsNormal(CallbackInfo ci) .dimensions(width / 2 + 2, realmsButton.getY(), 98, 20).build()); } - @Inject(at = {@At("RETURN")}, method = {"tick()V"}) + @Inject(at = @At("RETURN"), method = "tick()V") private void onTick(CallbackInfo ci) { if(realmsButton == null || altsButton == null) diff --git a/src/main/java/net/wurstclient/mixinterface/IScreen.java b/src/main/java/net/wurstclient/mixinterface/IScreen.java deleted file mode 100644 index c952f2ea85..0000000000 --- a/src/main/java/net/wurstclient/mixinterface/IScreen.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2014-2023 Wurst-Imperium and contributors. - * - * This source code is subject to the terms of the GNU General Public - * License, version 3. If a copy of the GPL was not distributed with this - * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt - */ -package net.wurstclient.mixinterface; - -import java.util.List; - -import net.minecraft.client.gui.Drawable; - -public interface IScreen -{ - public List getButtons(); -} diff --git a/src/main/java/net/wurstclient/navigator/NavigatorFeatureScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorFeatureScreen.java index 725a8397f5..8f18150bc2 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorFeatureScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorFeatureScreen.java @@ -44,7 +44,6 @@ import net.wurstclient.hacks.TooManyHaxHack; import net.wurstclient.keybinds.Keybind; import net.wurstclient.keybinds.PossibleKeybind; -import net.wurstclient.mixinterface.IScreen; import net.wurstclient.settings.Setting; import net.wurstclient.util.ChatUtils; import net.wurstclient.util.RenderUtils; @@ -340,20 +339,17 @@ protected void onRender(DrawContext context, int mouseX, int mouseY, setColorToBackground(); drawQuads(matrixStack, bgx1, bgy1, bgx2, - Math.max(bgy1, - Math.min(bgy2 - - (((IScreen)(Object)this).getButtons().isEmpty() ? 0 : 24), - bgy1 + scroll + windowComponentY))); + Math.max(bgy1, Math.min(bgy2 - (drawables.isEmpty() ? 0 : 24), + bgy1 + scroll + windowComponentY))); drawQuads(matrixStack, bgx1, - Math.max(bgy1, Math.min(bgy2 - - (((IScreen)(Object)this).getButtons().isEmpty() ? 0 : 24), + Math.max(bgy1, Math.min(bgy2 - (drawables.isEmpty() ? 0 : 24), bgy1 + scroll + windowComponentY + window.getInnerHeight())), bgx2, bgy2); drawBoxShadow(matrixStack, bgx1, bgy1, bgx2, bgy2); // scissor box RenderUtils.scissorBox(bgx1, bgy1, bgx2, - bgy2 - (((IScreen)(Object)this).getButtons().isEmpty() ? 0 : 24)); + bgy2 - (drawables.isEmpty() ? 0 : 24)); GL11.glEnable(GL11.GL_SCISSOR_TEST); // settings @@ -487,7 +483,7 @@ else if(mouseX >= x1 && mouseX <= x2 && mouseY >= y1 GL11.glDisable(GL11.GL_SCISSOR_TEST); // buttons below scissor box - for(Drawable d : ((IScreen)(Object)this).getButtons()) + for(Drawable d : drawables) { if(!(d instanceof ClickableWidget)) continue; diff --git a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java index 70cd9d694c..055b4bf593 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorMainScreen.java @@ -189,8 +189,6 @@ private void leftClick(int i) @Override protected void onUpdate() { - searchBar.tick(); - String newText = searchBar.getText(); if(clickTimer == -1 && !newText.equals(lastSearchText)) { diff --git a/src/main/java/net/wurstclient/navigator/NavigatorNewKeybindScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorNewKeybindScreen.java index 2392e5c3e9..561525e5a1 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorNewKeybindScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorNewKeybindScreen.java @@ -25,7 +25,6 @@ import net.wurstclient.WurstClient; import net.wurstclient.clickgui.ClickGui; import net.wurstclient.keybinds.PossibleKeybind; -import net.wurstclient.mixinterface.IScreen; import net.wurstclient.util.RenderUtils; public class NavigatorNewKeybindScreen extends NavigatorScreen @@ -177,7 +176,7 @@ protected void onRender(DrawContext context, int mouseX, int mouseY, // scissor box RenderUtils.scissorBox(bgx1, bgy1, bgx2, - bgy2 - (((IScreen)this).getButtons().isEmpty() ? 0 : 24)); + bgy2 - (drawables.isEmpty() ? 0 : 24)); GL11.glEnable(GL11.GL_SCISSOR_TEST); // possible keybinds @@ -237,7 +236,7 @@ protected void onRender(DrawContext context, int mouseX, int mouseY, GL11.glDisable(GL11.GL_SCISSOR_TEST); // buttons below scissor box - for(Drawable d : ((IScreen)this).getButtons()) + for(Drawable d : drawables) { if(!(d instanceof ClickableWidget)) continue; diff --git a/src/main/java/net/wurstclient/navigator/NavigatorRemoveKeybindScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorRemoveKeybindScreen.java index 645bec4c49..9be7d647a7 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorRemoveKeybindScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorRemoveKeybindScreen.java @@ -26,7 +26,6 @@ import net.wurstclient.WurstClient; import net.wurstclient.clickgui.ClickGui; import net.wurstclient.keybinds.PossibleKeybind; -import net.wurstclient.mixinterface.IScreen; import net.wurstclient.util.RenderUtils; public class NavigatorRemoveKeybindScreen extends NavigatorScreen @@ -149,7 +148,7 @@ protected void onRender(DrawContext context, int mouseX, int mouseY, // scissor box RenderUtils.scissorBox(bgx1, bgy1, bgx2, - bgy2 - (((IScreen)this).getButtons().isEmpty() ? 0 : 24)); + bgy2 - (drawables.isEmpty() ? 0 : 24)); GL11.glEnable(GL11.GL_SCISSOR_TEST); // possible keybinds @@ -208,7 +207,7 @@ protected void onRender(DrawContext context, int mouseX, int mouseY, GL11.glDisable(GL11.GL_SCISSOR_TEST); // buttons below scissor box - for(Drawable d : ((IScreen)this).getButtons()) + for(Drawable d : drawables) { if(!(d instanceof ClickableWidget)) continue; diff --git a/src/main/java/net/wurstclient/navigator/NavigatorScreen.java b/src/main/java/net/wurstclient/navigator/NavigatorScreen.java index 556bf174d0..d57478e3a0 100644 --- a/src/main/java/net/wurstclient/navigator/NavigatorScreen.java +++ b/src/main/java/net/wurstclient/navigator/NavigatorScreen.java @@ -113,12 +113,13 @@ public final boolean mouseReleased(double x, double y, int button) } @Override - public boolean mouseScrolled(double mouseX, double mouseY, double delta) + public boolean mouseScrolled(double mouseX, double mouseY, + double horizontalAmount, double verticalAmount) { // scrollbar if(!scrollbarLocked) { - scroll += delta * 4; + scroll += verticalAmount * 4; if(scroll > 0) scroll = 0; @@ -133,7 +134,8 @@ else if(scroll < maxScroll) scrollKnobPosition += 2; } - return super.mouseScrolled(mouseX, mouseY, delta); + return super.mouseScrolled(mouseX, mouseY, horizontalAmount, + verticalAmount); } @Override diff --git a/src/main/java/net/wurstclient/nochatreports/ForcedChatReportsScreen.java b/src/main/java/net/wurstclient/nochatreports/ForcedChatReportsScreen.java index 88864e7cc1..98cc86ddce 100644 --- a/src/main/java/net/wurstclient/nochatreports/ForcedChatReportsScreen.java +++ b/src/main/java/net/wurstclient/nochatreports/ForcedChatReportsScreen.java @@ -13,6 +13,7 @@ import net.minecraft.client.font.MultilineText; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.text.LiteralTextContent; @@ -101,9 +102,10 @@ private void toggleSignatures() } @Override - public void render(DrawContext context, int mouseX, int mouseY, float delta) + public void render(DrawContext context, int mouseX, int mouseY, + float partialTicks) { - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); int centerX = width / 2; int reasonY = (height - 68) / 2 - reasonHeight / 2; @@ -113,7 +115,8 @@ public void render(DrawContext context, int mouseX, int mouseY, float delta) 0xAAAAAA); reasonFormatted.drawCenterWithShadow(context, centerX, reasonY); - super.render(context, mouseX, mouseY, delta); + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/nochatreports/NcrModRequiredScreen.java b/src/main/java/net/wurstclient/nochatreports/NcrModRequiredScreen.java index fe212eb8e8..a619032921 100644 --- a/src/main/java/net/wurstclient/nochatreports/NcrModRequiredScreen.java +++ b/src/main/java/net/wurstclient/nochatreports/NcrModRequiredScreen.java @@ -13,6 +13,7 @@ import net.minecraft.client.font.MultilineText; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.text.Text; @@ -117,9 +118,10 @@ private void toggleVanillaSpoof() } @Override - public void render(DrawContext context, int mouseX, int mouseY, float delta) + public void render(DrawContext context, int mouseX, int mouseY, + float partialTicks) { - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); int centerX = width / 2; int reasonY = (height - 68) / 2 - reasonHeight / 2; @@ -129,7 +131,8 @@ public void render(DrawContext context, int mouseX, int mouseY, float delta) 0xAAAAAA); reasonFormatted.drawCenterWithShadow(context, centerX, reasonY); - super.render(context, mouseX, mouseY, delta); + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/options/EnterProfileNameScreen.java b/src/main/java/net/wurstclient/options/EnterProfileNameScreen.java index b8f8962cf5..a5ff001ab1 100644 --- a/src/main/java/net/wurstclient/options/EnterProfileNameScreen.java +++ b/src/main/java/net/wurstclient/options/EnterProfileNameScreen.java @@ -13,6 +13,7 @@ import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -81,22 +82,18 @@ public boolean keyPressed(int keyCode, int scanCode, int int_3) return super.keyPressed(keyCode, scanCode, int_3); } - @Override - public void tick() - { - valueField.tick(); - } - @Override public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); context.drawCenteredTextWithShadow(client.textRenderer, "Name your new profile", width / 2, 20, 0xFFFFFF); valueField.render(context, mouseX, mouseY, partialTicks); - super.render(context, mouseX, mouseY, partialTicks); + + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/options/KeybindEditorScreen.java b/src/main/java/net/wurstclient/options/KeybindEditorScreen.java index fe34616032..8eef91512f 100644 --- a/src/main/java/net/wurstclient/options/KeybindEditorScreen.java +++ b/src/main/java/net/wurstclient/options/KeybindEditorScreen.java @@ -8,6 +8,7 @@ package net.wurstclient.options; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; @@ -87,17 +88,11 @@ public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) return super.mouseClicked(mouseX, mouseY, mouseButton); } - @Override - public void tick() - { - commandField.tick(); - } - @Override public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); context.drawCenteredTextWithShadow(textRenderer, (oldKey != null ? "Edit" : "Add") + " Keybind", width / 2, 20, @@ -110,7 +105,9 @@ public void render(DrawContext context, int mouseX, int mouseY, width / 2 - 100, 87, 0xa0a0a0); commandField.render(context, mouseX, mouseY, partialTicks); - super.render(context, mouseX, mouseY, partialTicks); + + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/options/KeybindManagerScreen.java b/src/main/java/net/wurstclient/options/KeybindManagerScreen.java index 43d5d7c4ea..3e3bf581ba 100644 --- a/src/main/java/net/wurstclient/options/KeybindManagerScreen.java +++ b/src/main/java/net/wurstclient/options/KeybindManagerScreen.java @@ -11,6 +11,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.ConfirmScreen; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; @@ -121,11 +122,12 @@ public boolean mouseReleased(double double_1, double double_2, int int_1) } @Override - public boolean mouseScrolled(double double_1, double double_2, - double double_3) + public boolean mouseScrolled(double mouseX, double mouseY, + double horizontalAmount, double verticalAmount) { - listGui.mouseScrolled(double_1, double_2, double_3); - return super.mouseScrolled(double_1, double_2, double_3); + listGui.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount); + return super.mouseScrolled(mouseX, mouseY, horizontalAmount, + verticalAmount); } @Override @@ -166,7 +168,7 @@ public void tick() public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); listGui.render(context, mouseX, mouseY, partialTicks); context.drawCenteredTextWithShadow(textRenderer, "Keybind Manager", @@ -174,7 +176,8 @@ public void render(DrawContext context, int mouseX, int mouseY, context.drawCenteredTextWithShadow(textRenderer, "Keybinds: " + listGui.getItemCount(), width / 2, 20, 0xffffff); - super.render(context, mouseX, mouseY, partialTicks); + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/options/KeybindProfilesScreen.java b/src/main/java/net/wurstclient/options/KeybindProfilesScreen.java index 0946e70a38..ad7b2607ec 100644 --- a/src/main/java/net/wurstclient/options/KeybindProfilesScreen.java +++ b/src/main/java/net/wurstclient/options/KeybindProfilesScreen.java @@ -18,6 +18,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.text.Text; @@ -144,11 +145,12 @@ public boolean mouseReleased(double double_1, double double_2, int int_1) } @Override - public boolean mouseScrolled(double double_1, double double_2, - double double_3) + public boolean mouseScrolled(double mouseX, double mouseY, + double horizontalAmount, double verticalAmount) { - listGui.mouseScrolled(double_1, double_2, double_3); - return super.mouseScrolled(double_1, double_2, double_3); + listGui.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount); + return super.mouseScrolled(mouseX, mouseY, horizontalAmount, + verticalAmount); } @Override @@ -173,13 +175,14 @@ public void tick() public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); listGui.render(context, mouseX, mouseY, partialTicks); context.drawCenteredTextWithShadow(client.textRenderer, "Keybind Profiles", width / 2, 12, 0xffffff); - super.render(context, mouseX, mouseY, partialTicks); + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); if(loadButton.isSelected() && !loadButton.active) context.drawTooltip(textRenderer, diff --git a/src/main/java/net/wurstclient/options/PressAKeyScreen.java b/src/main/java/net/wurstclient/options/PressAKeyScreen.java index da20905423..b4f58e8b2c 100644 --- a/src/main/java/net/wurstclient/options/PressAKeyScreen.java +++ b/src/main/java/net/wurstclient/options/PressAKeyScreen.java @@ -10,6 +10,7 @@ import org.lwjgl.glfw.GLFW; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.util.InputUtil; import net.minecraft.text.Text; @@ -53,9 +54,11 @@ public boolean shouldCloseOnEsc() public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); context.drawCenteredTextWithShadow(textRenderer, "Press a key", width / 2, height / 4 + 48, 16777215); - super.render(context, mouseX, mouseY, partialTicks); + + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); } } diff --git a/src/main/java/net/wurstclient/options/WurstOptionsScreen.java b/src/main/java/net/wurstclient/options/WurstOptionsScreen.java index 8cce4e9d9d..e5251db062 100644 --- a/src/main/java/net/wurstclient/options/WurstOptionsScreen.java +++ b/src/main/java/net/wurstclient/options/WurstOptionsScreen.java @@ -24,7 +24,6 @@ import net.wurstclient.analytics.WurstAnalytics; import net.wurstclient.commands.FriendsCmd; import net.wurstclient.hacks.XRayHack; -import net.wurstclient.mixinterface.IScreen; import net.wurstclient.other_features.VanillaSpoofOtf; import net.wurstclient.settings.CheckboxSetting; @@ -150,9 +149,12 @@ public void close() public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); renderTitles(context); - super.render(context, mouseX, mouseY, partialTicks); + + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); + renderButtonTooltip(context, mouseX, mouseY); } @@ -177,7 +179,7 @@ private void renderTitles(DrawContext context) private void renderButtonTooltip(DrawContext context, int mouseX, int mouseY) { - for(Drawable d : ((IScreen)this).getButtons()) + for(Drawable d : drawables) { if(!(d instanceof ClickableWidget)) continue; diff --git a/src/main/java/net/wurstclient/options/ZoomManagerScreen.java b/src/main/java/net/wurstclient/options/ZoomManagerScreen.java index 8f16145f06..481e2fb4a3 100644 --- a/src/main/java/net/wurstclient/options/ZoomManagerScreen.java +++ b/src/main/java/net/wurstclient/options/ZoomManagerScreen.java @@ -8,6 +8,7 @@ package net.wurstclient.options; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.option.KeyBinding; @@ -100,14 +101,15 @@ public void render(DrawContext context, int mouseX, int mouseY, ZoomOtf zoom = WurstClient.INSTANCE.getOtfs().zoomOtf; SliderSetting level = zoom.getLevelSetting(); - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); context.drawCenteredTextWithShadow(textRenderer, "Zoom Manager", width / 2, 40, 0xffffff); context.drawTextWithShadow(textRenderer, "Zoom Level: " + level.getValueString(), width / 2 - 75, height / 4 + 44, 0xcccccc); - super.render(context, mouseX, mouseY, partialTicks); + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/other_features/VanillaSpoofOtf.java b/src/main/java/net/wurstclient/other_features/VanillaSpoofOtf.java index 4bf1362da1..0ad9044403 100644 --- a/src/main/java/net/wurstclient/other_features/VanillaSpoofOtf.java +++ b/src/main/java/net/wurstclient/other_features/VanillaSpoofOtf.java @@ -7,13 +7,11 @@ */ package net.wurstclient.other_features; -import io.netty.buffer.Unpooled; -import net.minecraft.network.PacketByteBuf; import net.minecraft.network.packet.c2s.common.CustomPayloadC2SPacket; +import net.minecraft.util.Identifier; import net.wurstclient.DontBlock; import net.wurstclient.SearchTags; import net.wurstclient.events.ConnectionPacketOutputListener; -import net.wurstclient.mixin.CustomPayloadC2SPacketAccessor; import net.wurstclient.other_feature.OtherFeature; import net.wurstclient.settings.CheckboxSetting; @@ -41,23 +39,25 @@ public void onSentConnectionPacket(ConnectionPacketOutputEvent event) if(!spoof.isChecked()) return; - if(!(event.getPacket() instanceof CustomPayloadC2SPacketAccessor)) + if(!(event.getPacket() instanceof CustomPayloadC2SPacket packet)) return; - CustomPayloadC2SPacketAccessor packet = - (CustomPayloadC2SPacketAccessor)event.getPacket(); + Identifier channel = packet.payload().id(); - if(packet.getChannel().getNamespace().equals("minecraft") - && packet.getChannel().getPath().equals("register")) + if(channel.getNamespace().equals("minecraft") + && channel.getPath().equals("register")) event.cancel(); + + // Apparently the Minecraft client no longer sends its brand to the + // server as of 23w31a - if(packet.getChannel().getNamespace().equals("minecraft") - && packet.getChannel().getPath().equals("brand")) - event.setPacket(new CustomPayloadC2SPacket( - CustomPayloadC2SPacket.BRAND, - new PacketByteBuf(Unpooled.buffer()).writeString("vanilla"))); + // if(packet.getChannel().getNamespace().equals("minecraft") + // && packet.getChannel().getPath().equals("brand")) + // event.setPacket(new CustomPayloadC2SPacket( + // CustomPayloadC2SPacket.BRAND, + // new PacketByteBuf(Unpooled.buffer()).writeString("vanilla"))); - if(packet.getChannel().getNamespace().equals("fabric")) + if(channel.getNamespace().equals("fabric")) event.cancel(); } diff --git a/src/main/java/net/wurstclient/serverfinder/CleanUpScreen.java b/src/main/java/net/wurstclient/serverfinder/CleanUpScreen.java index f706da3df2..29ff1200a4 100644 --- a/src/main/java/net/wurstclient/serverfinder/CleanUpScreen.java +++ b/src/main/java/net/wurstclient/serverfinder/CleanUpScreen.java @@ -24,7 +24,6 @@ import net.minecraft.client.network.ServerInfo; import net.minecraft.text.Text; import net.wurstclient.mixinterface.IMultiplayerScreen; -import net.wurstclient.mixinterface.IScreen; public class CleanUpScreen extends Screen { @@ -204,21 +203,23 @@ public boolean keyPressed(int keyCode, int scanCode, int int_3) public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); context.drawCenteredTextWithShadow(textRenderer, "Clean Up", width / 2, 20, 16777215); context.drawCenteredTextWithShadow(textRenderer, "Please select the servers you want to remove:", width / 2, 36, 10526880); - super.render(context, mouseX, mouseY, partialTicks); + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); + renderButtonTooltip(context, mouseX, mouseY); } private void renderButtonTooltip(DrawContext context, int mouseX, int mouseY) { - for(Drawable d : ((IScreen)this).getButtons()) + for(Drawable d : drawables) { if(!(d instanceof ClickableWidget)) continue; diff --git a/src/main/java/net/wurstclient/serverfinder/ServerFinderScreen.java b/src/main/java/net/wurstclient/serverfinder/ServerFinderScreen.java index f8429ed6a1..9b884939b6 100644 --- a/src/main/java/net/wurstclient/serverfinder/ServerFinderScreen.java +++ b/src/main/java/net/wurstclient/serverfinder/ServerFinderScreen.java @@ -14,11 +14,13 @@ import org.lwjgl.glfw.GLFW; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.gui.widget.TextFieldWidget; import net.minecraft.client.network.ServerInfo; +import net.minecraft.client.network.ServerInfo.ServerType; import net.minecraft.text.Text; import net.minecraft.util.Util; import net.wurstclient.mixinterface.IMultiplayerScreen; @@ -156,8 +158,6 @@ private void findServers() @Override public void tick() { - ipBox.tick(); - searchButton .setMessage(Text.literal(state.isRunning() ? "Cancel" : "Search")); ipBox.active = !state.isRunning(); @@ -189,9 +189,8 @@ private void updatePingers(ArrayList pingers) if(!isServerInList(pingers.get(i).getServerIP())) { prevScreen.getServerList() - .add( - new ServerInfo("Grief me #" + working, - pingers.get(i).getServerIP(), false), + .add(new ServerInfo("Grief me #" + working, + pingers.get(i).getServerIP(), ServerType.OTHER), false); prevScreen.getServerList().saveFile(); ((IMultiplayerScreen)prevScreen).getServerListSelector() @@ -217,7 +216,7 @@ public boolean keyPressed(int keyCode, int scanCode, int int_3) public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { - renderBackground(context); + renderBackground(context, mouseX, mouseY, partialTicks); context.drawCenteredTextWithShadow(textRenderer, "Server Finder", width / 2, 20, 16777215); @@ -248,7 +247,8 @@ public void render(DrawContext context, int mouseX, int mouseY, context.drawTextWithShadow(textRenderer, "Working: " + working, width / 2 - 100, height / 4 + 94, 10526880); - super.render(context, mouseX, mouseY, partialTicks); + for(Drawable drawable : drawables) + drawable.render(context, mouseX, mouseY, partialTicks); } @Override diff --git a/src/main/java/net/wurstclient/serverfinder/WurstServerPinger.java b/src/main/java/net/wurstclient/serverfinder/WurstServerPinger.java index 387fad2019..64de3bdfcf 100644 --- a/src/main/java/net/wurstclient/serverfinder/WurstServerPinger.java +++ b/src/main/java/net/wurstclient/serverfinder/WurstServerPinger.java @@ -12,6 +12,7 @@ import net.minecraft.client.network.MultiplayerServerListPinger; import net.minecraft.client.network.ServerInfo; +import net.minecraft.client.network.ServerInfo.ServerType; public class WurstServerPinger { @@ -27,7 +28,7 @@ public void ping(String ip) public void ping(String ip, int port) { - server = new ServerInfo("", ip + ":" + port, false); + server = new ServerInfo("", ip + ":" + port, ServerType.OTHER); new Thread(() -> pingInCurrentThread(ip, port), "Wurst Server Pinger #" + threadNumber.incrementAndGet()).start(); diff --git a/src/main/java/net/wurstclient/util/ListWidget.java b/src/main/java/net/wurstclient/util/ListWidget.java index be6b52d57f..95552f0e5b 100644 --- a/src/main/java/net/wurstclient/util/ListWidget.java +++ b/src/main/java/net/wurstclient/util/ListWidget.java @@ -325,11 +325,12 @@ else if(mouseY > bottom) } @Override - public boolean mouseScrolled(double mouseX, double mouseY, double amount) + public boolean mouseScrolled(double mouseX, double mouseY, + double horizontalAmount, double verticalAmount) { if(!isVisible()) return false; - scrollAmount -= amount * itemHeight / 2.0D; + scrollAmount -= verticalAmount * itemHeight / 2.0D; return true; } diff --git a/src/main/java/net/wurstclient/util/RenderUtils.java b/src/main/java/net/wurstclient/util/RenderUtils.java index 23300853df..5cef42541b 100644 --- a/src/main/java/net/wurstclient/util/RenderUtils.java +++ b/src/main/java/net/wurstclient/util/RenderUtils.java @@ -898,13 +898,13 @@ public static void drawItem(DrawContext context, ItemStack stack, int x, if(stack.isEmpty()) { matrixStack.push(); - matrixStack.translate(x, y, 0); + matrixStack.translate(x, y, 200); if(large) matrixStack.scale(2, 2, 2); GL11.glDisable(GL11.GL_DEPTH_TEST); TextRenderer tr = WurstClient.MC.textRenderer; - context.drawText(tr, "?", 3, 2, 0xf0f0f0, false); + context.drawText(tr, "?", 3, 2, 0xf0f0f0, true); GL11.glEnable(GL11.GL_DEPTH_TEST); matrixStack.pop(); diff --git a/src/main/resources/wurst.accesswidener b/src/main/resources/wurst.accesswidener index d1f5738e17..7940ec1956 100644 --- a/src/main/resources/wurst.accesswidener +++ b/src/main/resources/wurst.accesswidener @@ -1,8 +1,10 @@ accessWidener v1 named accessible class net/minecraft/client/render/BackgroundRenderer$StatusEffectFogModifier +accessible class net/minecraft/client/texture/PlayerSkinProvider$Textures accessible field net/minecraft/client/toast/ToastManager toastQueue Ljava/util/Deque; accessible field net/minecraft/client/network/ClientPlayNetworkHandler session Lnet/minecraft/network/encryption/ClientPlayerSession; accessible field net/minecraft/client/network/ClientPlayNetworkHandler messagePacker Lnet/minecraft/network/message/MessageChain$Packer; accessible field net/minecraft/client/gui/screen/ingame/CreativeInventoryScreen selectedTab Lnet/minecraft/item/ItemGroup; accessible field net/minecraft/entity/Entity stepHeight F -accessible field net/minecraft/client/gui/hud/ChatHud visibleMessages Ljava/util/List; \ No newline at end of file +accessible field net/minecraft/client/gui/hud/ChatHud visibleMessages Ljava/util/List; +accessible field net/minecraft/client/gui/screen/Screen drawables Ljava/util/List; diff --git a/src/main/resources/wurst.mixins.json b/src/main/resources/wurst.mixins.json index 383cf6a263..1b2acdf34c 100644 --- a/src/main/resources/wurst.mixins.json +++ b/src/main/resources/wurst.mixins.json @@ -20,12 +20,12 @@ "ChatInputSuggestorMixin", "ChatScreenMixin", "ChunkOcclusionGraphBuilderMixin", + "ClientCommonNetworkHandlerMixin", "ClientConnectionMixin", "ClientPlayerEntityMixin", "ClientPlayerInteractionManagerMixin", "ClientPlayNetworkHandlerMixin", "CreativeInventoryScreenMixin", - "CustomPayloadC2SPacketAccessor", "DeathScreenMixin", "DirectConnectScreenMixin", "DisconnectedRealmsScreenMixin", From 42f91d6f0484b9c8681f0fb12e4d13083176edbc Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 9 Aug 2023 20:15:51 +0200 Subject: [PATCH 159/282] [Wurst-Bot] Update to 23w32a --- gradle.properties | 8 ++++---- src/main/java/net/wurstclient/WurstClient.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index 32f2bb5a4d..67b71f769a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,15 +5,15 @@ org.gradle.parallel=true # Fabric Properties # check these at https://fabricmc.net/develop/ and # https://www.curseforge.com/minecraft/mc-mods/fabric-api -minecraft_version=23w31a -yarn_mappings=23w31a+build.12 +minecraft_version=23w32a +yarn_mappings=23w32a+build.3 loader_version=0.14.22 #Fabric api -fabric_version=0.86.1+1.20.2 +fabric_version=0.86.2+1.20.2 # Mod Properties -mod_version = v7.36-MC23w31a +mod_version = v7.36-MC23w32a maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index 43f9955ecf..34b81d1121 100644 --- a/src/main/java/net/wurstclient/WurstClient.java +++ b/src/main/java/net/wurstclient/WurstClient.java @@ -57,7 +57,7 @@ public enum WurstClient public static IMinecraftClient IMC; public static final String VERSION = "7.36"; - public static final String MC_VERSION = "23w31a"; + public static final String MC_VERSION = "23w32a"; private WurstAnalytics analytics; private EventManager eventManager; From 50fc01d377a56be36fa38f2ad5785babf3f8d972 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Wed, 9 Aug 2023 20:52:53 +0200 Subject: [PATCH 160/282] Update to 23w32a --- .../net/wurstclient/commands/AddAltCmd.java | 2 +- .../net/wurstclient/commands/PotionCmd.java | 7 +-- .../net/wurstclient/hacks/MassTpaHack.java | 2 +- .../mixin/MinecraftClientMixin.java | 45 ++++++++++--------- 4 files changed, 30 insertions(+), 26 deletions(-) diff --git a/src/main/java/net/wurstclient/commands/AddAltCmd.java b/src/main/java/net/wurstclient/commands/AddAltCmd.java index 5dd92ea444..1f90a308e5 100644 --- a/src/main/java/net/wurstclient/commands/AddAltCmd.java +++ b/src/main/java/net/wurstclient/commands/AddAltCmd.java @@ -57,7 +57,7 @@ private void addAll() { int alts = 0; AltManager altManager = WURST.getAltManager(); - String playerName = MC.getSession().getProfile().getName(); + String playerName = MC.getSession().getUsername(); for(PlayerListEntry entry : MC.player.networkHandler.getPlayerList()) { diff --git a/src/main/java/net/wurstclient/commands/PotionCmd.java b/src/main/java/net/wurstclient/commands/PotionCmd.java index edabef6728..83ee2feee5 100644 --- a/src/main/java/net/wurstclient/commands/PotionCmd.java +++ b/src/main/java/net/wurstclient/commands/PotionCmd.java @@ -103,7 +103,7 @@ private NbtList convertEffectsToNbt(ItemStack stack) { NbtCompound tag = new NbtCompound(); - int id = StatusEffect.getRawId(effect.getEffectType()); + int id = Registries.STATUS_EFFECT.getRawId(effect.getEffectType()); tag.putInt("Id", id); tag.putInt("Amplifier", effect.getAmplifier()); tag.putInt("Duration", effect.getDuration()); @@ -127,7 +127,8 @@ private void remove(ItemStack stack, String[] args) throws CmdSyntaxError NbtList newEffects = new NbtList(); for(StatusEffectInstance oldEffect : oldEffects) { - int oldId = StatusEffect.getRawId(oldEffect.getEffectType()); + int oldId = + Registries.STATUS_EFFECT.getRawId(oldEffect.getEffectType()); if(oldId == id) continue; @@ -157,7 +158,7 @@ private int parseEffectId(String input) throws CmdSyntaxError Identifier identifier = new Identifier(input); StatusEffect effect = Registries.STATUS_EFFECT.get(identifier); - id = StatusEffect.getRawId(effect); + id = Registries.STATUS_EFFECT.getRawId(effect); }catch(InvalidIdentifierException e) { diff --git a/src/main/java/net/wurstclient/hacks/MassTpaHack.java b/src/main/java/net/wurstclient/hacks/MassTpaHack.java index 5d2f6a6143..94fc2b87aa 100644 --- a/src/main/java/net/wurstclient/hacks/MassTpaHack.java +++ b/src/main/java/net/wurstclient/hacks/MassTpaHack.java @@ -45,7 +45,7 @@ public void onEnable() timer = -1; players.clear(); - String playerName = MC.getSession().getProfile().getName(); + String playerName = MC.getSession().getUsername(); for(PlayerListEntry info : MC.player.networkHandler.getPlayerList()) { diff --git a/src/main/java/net/wurstclient/mixin/MinecraftClientMixin.java b/src/main/java/net/wurstclient/mixin/MinecraftClientMixin.java index fa87c33078..48a1558925 100644 --- a/src/main/java/net/wurstclient/mixin/MinecraftClientMixin.java +++ b/src/main/java/net/wurstclient/mixin/MinecraftClientMixin.java @@ -10,16 +10,15 @@ import java.io.File; import java.util.UUID; -import org.objectweb.asm.Opcodes; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import com.mojang.authlib.GameProfile; import com.mojang.authlib.exceptions.AuthenticationException; import com.mojang.authlib.minecraft.UserApiService; import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; @@ -82,9 +81,9 @@ private MinecraftClientMixin(WurstClient wurst, String string_1) super(string_1); } - @Inject(at = {@At(value = "FIELD", + @Inject(at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;crosshairTarget:Lnet/minecraft/util/hit/HitResult;", - ordinal = 0)}, method = {"doAttack()Z"}, cancellable = true) + ordinal = 0), method = "doAttack()Z", cancellable = true) private void onDoAttack(CallbackInfoReturnable cir) { LeftClickEvent event = new LeftClickEvent(); @@ -94,9 +93,12 @@ private void onDoAttack(CallbackInfoReturnable cir) cir.setReturnValue(false); } - @Inject(at = {@At(value = "FIELD", - target = "Lnet/minecraft/client/MinecraftClient;itemUseCooldown:I", - ordinal = 0)}, method = {"doItemUse()V"}, cancellable = true) + @Inject( + at = @At(value = "FIELD", + target = "Lnet/minecraft/client/MinecraftClient;itemUseCooldown:I", + ordinal = 0), + method = "doItemUse()V", + cancellable = true) private void onDoItemUse(CallbackInfo ci) { RightClickEvent event = new RightClickEvent(); @@ -106,7 +108,7 @@ private void onDoItemUse(CallbackInfo ci) ci.cancel(); } - @Inject(at = {@At("HEAD")}, method = {"doItemPick()V"}) + @Inject(at = @At("HEAD"), method = "doItemPick()V") private void onDoItemPick(CallbackInfo ci) { if(!WurstClient.INSTANCE.isEnabled()) @@ -121,7 +123,7 @@ private void onDoItemPick(CallbackInfo ci) } @Inject(at = @At("HEAD"), - method = {"getSession()Lnet/minecraft/client/util/Session;"}, + method = "getSession()Lnet/minecraft/client/util/Session;", cancellable = true) private void onGetSession(CallbackInfoReturnable cir) { @@ -131,22 +133,23 @@ private void onGetSession(CallbackInfoReturnable cir) cir.setReturnValue(wurstSession); } - @Redirect(at = @At(value = "FIELD", - target = "Lnet/minecraft/client/MinecraftClient;session:Lnet/minecraft/client/util/Session;", - opcode = Opcodes.GETFIELD, - ordinal = 0), - method = { - "getSessionProperties()Lcom/mojang/authlib/properties/PropertyMap;"}) - private Session getSessionForSessionProperties(MinecraftClient mc) + @Inject(at = @At("RETURN"), + method = "method_53462()Lcom/mojang/authlib/GameProfile;", + cancellable = true) + public void onMethod_53462(CallbackInfoReturnable cir) { - if(wurstSession != null) - return wurstSession; + if(wurstSession == null) + return; - return session; + GameProfile oldProfile = cir.getReturnValue(); + GameProfile newProfile = new GameProfile(wurstSession.getUuidOrNull(), + wurstSession.getUsername()); + newProfile.getProperties().putAll(oldProfile.getProperties()); + cir.setReturnValue(newProfile); } @Inject(at = @At("HEAD"), - method = {"getProfileKeys()Lnet/minecraft/client/util/ProfileKeys;"}, + method = "getProfileKeys()Lnet/minecraft/client/util/ProfileKeys;", cancellable = true) private void onGetProfileKeys(CallbackInfoReturnable cir) { @@ -229,7 +232,7 @@ public void setSession(Session session) UserApiService userApiService = wurst_createUserApiService(session.getAccessToken()); - UUID uuid = wurstSession.getProfile().getId(); + UUID uuid = wurstSession.getUuidOrNull(); wurstProfileKeys = new ProfileKeysImpl(userApiService, uuid, runDirectory.toPath()); } From 8f70fea0f1b69419c41d6c66311165344319e576 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Fri, 11 Aug 2023 18:31:48 +0200 Subject: [PATCH 161/282] Fix block- and item-related settings not rendering correctly --- .../java/net/wurstclient/clickgui/ClickGui.java | 2 +- .../clickgui/screens/EditBlockListScreen.java | 10 +++++----- .../clickgui/screens/EditBlockScreen.java | 15 +++++---------- .../clickgui/screens/EditItemListScreen.java | 10 +++++----- .../java/net/wurstclient/util/RenderUtils.java | 4 +--- 5 files changed, 17 insertions(+), 24 deletions(-) diff --git a/src/main/java/net/wurstclient/clickgui/ClickGui.java b/src/main/java/net/wurstclient/clickgui/ClickGui.java index f8909149dc..76493e9670 100644 --- a/src/main/java/net/wurstclient/clickgui/ClickGui.java +++ b/src/main/java/net/wurstclient/clickgui/ClickGui.java @@ -530,7 +530,6 @@ public void renderPopups(DrawContext context, int mouseX, int mouseY) public void renderTooltip(DrawContext context, int mouseX, int mouseY) { MatrixStack matrixStack = context.getMatrices(); - Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); @@ -558,6 +557,7 @@ public void renderTooltip(DrawContext context, int mouseX, int mouseY) matrixStack.push(); matrixStack.translate(0, 0, 300); + Matrix4f matrix = matrixStack.peek().getPositionMatrix(); RenderSystem.setShader(GameRenderer::getPositionProgram); diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditBlockListScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditBlockListScreen.java index 27fafa87f6..f82c5554a5 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditBlockListScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditBlockListScreen.java @@ -54,7 +54,7 @@ public void init() listGui = new ListGui(client, this, blockList.getBlockNames()); blockNameField = new TextFieldWidget(client.textRenderer, - width / 2 - 152, height - 55, 150, 18, Text.literal("")); + width / 2 - 152, height - 56, 150, 20, Text.literal("")); addSelectableChild(blockNameField); blockNameField.setMaxLength(256); @@ -190,13 +190,13 @@ public void render(DrawContext context, int mouseX, int mouseY, int black = 0xff000000; context.fill(48, height - 56, 64, height - 36, border); - context.fill(49, height - 55, 64, height - 37, black); + context.fill(49, height - 55, 65, height - 37, black); context.fill(214, height - 56, 244, height - 55, border); context.fill(214, height - 37, 244, height - 36, border); context.fill(244, height - 56, 246, height - 36, border); - context.fill(214, height - 55, 243, height - 52, black); - context.fill(214, height - 40, 243, height - 37, black); - context.fill(214, height - 55, 216, height - 37, black); + context.fill(213, height - 55, 243, height - 52, black); + context.fill(213, height - 40, 243, height - 37, black); + context.fill(213, height - 55, 216, height - 37, black); context.fill(242, height - 55, 245, height - 37, black); matrixStack.pop(); diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditBlockScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditBlockScreen.java index 194892316a..ae45bea8ce 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditBlockScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditBlockScreen.java @@ -43,13 +43,13 @@ public EditBlockScreen(Screen prevScreen, BlockSetting setting) public void init() { int x1 = width / 2 - 100; - int y1 = 60; + int y1 = 59; int y2 = height / 3 * 2; TextRenderer tr = client.textRenderer; String valueString = setting.getBlockName(); - blockField = new TextFieldWidget(tr, x1, y1, 178, 18, Text.literal("")); + blockField = new TextFieldWidget(tr, x1, y1, 178, 20, Text.literal("")); blockField.setText(valueString); blockField.setSelectionStart(0); blockField.setMaxLength(256); @@ -123,14 +123,9 @@ public void render(DrawContext context, int mouseX, int mouseY, int black = 0xff000000; context.fill(48, -56, 64, -36, border); - context.fill(49, -55, 64, -37, black); - context.fill(214, -56, 244, -55, border); - context.fill(214, -37, 244, -36, border); - context.fill(244, -56, 246, -36, border); - context.fill(214, -55, 243, -52, black); - context.fill(214, -40, 243, -37, black); - context.fill(215, -55, 216, -37, black); - context.fill(242, -55, 245, -37, black); + context.fill(49, -55, 65, -37, black); + context.fill(242, -56, 246, -36, border); + context.fill(241, -55, 245, -37, black); matrixStack.pop(); diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditItemListScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditItemListScreen.java index 2c5955b4a4..1680ca99d4 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditItemListScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditItemListScreen.java @@ -56,7 +56,7 @@ public void init() listGui = new ListGui(client, this, itemList.getItemNames()); itemNameField = new TextFieldWidget(client.textRenderer, - width / 2 - 152, height - 55, 150, 18, Text.literal("")); + width / 2 - 152, height - 56, 150, 20, Text.literal("")); addSelectableChild(itemNameField); itemNameField.setMaxLength(256); @@ -197,13 +197,13 @@ public void render(DrawContext context, int mouseX, int mouseY, int black = 0xff000000; context.fill(48, height - 56, 64, height - 36, border); - context.fill(49, height - 55, 64, height - 37, black); + context.fill(49, height - 55, 65, height - 37, black); context.fill(214, height - 56, 244, height - 55, border); context.fill(214, height - 37, 244, height - 36, border); context.fill(244, height - 56, 246, height - 36, border); - context.fill(214, height - 55, 243, height - 52, black); - context.fill(214, height - 40, 243, height - 37, black); - context.fill(215, height - 55, 216, height - 37, black); + context.fill(213, height - 55, 243, height - 52, black); + context.fill(213, height - 40, 243, height - 37, black); + context.fill(213, height - 55, 216, height - 37, black); context.fill(242, height - 55, 245, height - 37, black); matrixStack.pop(); diff --git a/src/main/java/net/wurstclient/util/RenderUtils.java b/src/main/java/net/wurstclient/util/RenderUtils.java index 5cef42541b..e58288cb42 100644 --- a/src/main/java/net/wurstclient/util/RenderUtils.java +++ b/src/main/java/net/wurstclient/util/RenderUtils.java @@ -898,14 +898,12 @@ public static void drawItem(DrawContext context, ItemStack stack, int x, if(stack.isEmpty()) { matrixStack.push(); - matrixStack.translate(x, y, 200); + matrixStack.translate(x, y, 250); if(large) matrixStack.scale(2, 2, 2); - GL11.glDisable(GL11.GL_DEPTH_TEST); TextRenderer tr = WurstClient.MC.textRenderer; context.drawText(tr, "?", 3, 2, 0xf0f0f0, true); - GL11.glEnable(GL11.GL_DEPTH_TEST); matrixStack.pop(); } From ad88fc8b7f880474a3764524fa417213ada65a91 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 13 Aug 2023 17:41:22 +0200 Subject: [PATCH 162/282] Improve FacingSetting to account for AnchorAura and CrystalAura --- .../net/wurstclient/hacks/AnchorAuraHack.java | 55 +++---------------- .../wurstclient/hacks/AutoLibrarianHack.java | 4 +- .../wurstclient/hacks/BuildRandomHack.java | 2 +- .../wurstclient/hacks/CrystalAuraHack.java | 55 +++---------------- .../wurstclient/settings/FacingSetting.java | 38 ++++++++++--- 5 files changed, 49 insertions(+), 105 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java b/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java index bed500a206..1e209a654f 100644 --- a/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java +++ b/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java @@ -10,7 +10,6 @@ import java.util.ArrayList; import java.util.Comparator; import java.util.Map; -import java.util.function.Consumer; import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -24,7 +23,6 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; -import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; import net.minecraft.util.Hand; import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.BlockPos; @@ -39,6 +37,8 @@ import net.wurstclient.hack.Hack; import net.wurstclient.settings.CheckboxSetting; import net.wurstclient.settings.EnumSetting; +import net.wurstclient.settings.FacingSetting; +import net.wurstclient.settings.FacingSetting.Facing; import net.wurstclient.settings.SliderSetting; import net.wurstclient.settings.SliderSetting.ValueDisplay; import net.wurstclient.settings.filterlists.AnchorAuraFilterList; @@ -48,7 +48,6 @@ import net.wurstclient.util.FakePlayerEntity; import net.wurstclient.util.InventoryUtils; import net.wurstclient.util.RotationUtils; -import net.wurstclient.util.RotationUtils.Rotation; @SearchTags({"anchor aura", "CrystalAura", "crystal aura"}) public final class AnchorAuraHack extends Hack implements UpdateListener @@ -63,11 +62,12 @@ public final class AnchorAuraHack extends Hack implements UpdateListener + "When disabled, AnchorAura will only charge and detonate manually placed anchors.", true); - private final EnumSetting faceBlocks = new EnumSetting<>( - "Face anchors", - "Whether or not AnchorAura should face the correct direction when placing and right-clicking respawn anchors.\n\n" - + "Slower but can help with anti-cheat plugins.", - FaceBlocks.values(), FaceBlocks.OFF); + private final FacingSetting faceBlocks = + FacingSetting.withPacketSpam("Face anchors", + "Whether or not AnchorAura should face the correct direction when" + + " placing and right-clicking respawn anchors.\n\n" + + "Slower but can help with anti-cheat plugins.", + Facing.OFF); private final CheckboxSetting checkLOS = new CheckboxSetting( "Check line of sight", @@ -423,45 +423,6 @@ private boolean isSneaking() return MC.player.isSneaking() || WURST.getHax().sneakHack.isEnabled(); } - private enum FaceBlocks - { - OFF("Off", v -> {}), - - SERVER("Server-side", - v -> WURST.getRotationFaker().faceVectorPacket(v)), - - CLIENT("Client-side", - v -> WURST.getRotationFaker().faceVectorClient(v)), - - SPAM("Packet spam", v -> { - Rotation rotation = RotationUtils.getNeededRotations(v); - PlayerMoveC2SPacket.LookAndOnGround packet = - new PlayerMoveC2SPacket.LookAndOnGround(rotation.getYaw(), - rotation.getPitch(), MC.player.isOnGround()); - MC.player.networkHandler.sendPacket(packet); - }); - - private String name; - private Consumer face; - - private FaceBlocks(String name, Consumer face) - { - this.name = name; - this.face = face; - } - - public void face(Vec3d v) - { - face.accept(v); - } - - @Override - public String toString() - { - return name; - } - } - private enum TakeItemsFrom { HOTBAR("Hotbar", 9), diff --git a/src/main/java/net/wurstclient/hacks/AutoLibrarianHack.java b/src/main/java/net/wurstclient/hacks/AutoLibrarianHack.java index 1463e7c0d9..27b5039ee0 100644 --- a/src/main/java/net/wurstclient/hacks/AutoLibrarianHack.java +++ b/src/main/java/net/wurstclient/hacks/AutoLibrarianHack.java @@ -89,8 +89,8 @@ public final class AutoLibrarianHack extends Hack private final SliderSetting range = new SliderSetting("Range", 5, 1, 6, 0.05, ValueDisplay.DECIMAL); - private final FacingSetting facing = - new FacingSetting("How to face the villager and job site.\n\n" + private final FacingSetting facing = FacingSetting + .withoutPacketSpam("How to face the villager and job site.\n\n" + "\u00a7lOff\u00a7r - Don't face the villager at all. Will be" + " detected by anti-cheat plugins.\n\n" + "\u00a7lServer-side\u00a7r - Face the villager on the" diff --git a/src/main/java/net/wurstclient/hacks/BuildRandomHack.java b/src/main/java/net/wurstclient/hacks/BuildRandomHack.java index 3192e5330d..9bad72e246 100644 --- a/src/main/java/net/wurstclient/hacks/BuildRandomHack.java +++ b/src/main/java/net/wurstclient/hacks/BuildRandomHack.java @@ -63,7 +63,7 @@ public final class BuildRandomHack extends Hack "Ensure that BuildRandom won't try to place blocks behind walls.", false); - private final FacingSetting facing = new FacingSetting( + private final FacingSetting facing = FacingSetting.withoutPacketSpam( "How BuildRandom should face the randomly placed blocks.\n\n" + "\u00a7lOff\u00a7r - Don't face the blocks at all. Will be" + " detected by anti-cheat plugins.\n\n" diff --git a/src/main/java/net/wurstclient/hacks/CrystalAuraHack.java b/src/main/java/net/wurstclient/hacks/CrystalAuraHack.java index 3fffb32a3e..531df39443 100644 --- a/src/main/java/net/wurstclient/hacks/CrystalAuraHack.java +++ b/src/main/java/net/wurstclient/hacks/CrystalAuraHack.java @@ -9,7 +9,6 @@ import java.util.ArrayList; import java.util.Comparator; -import java.util.function.Consumer; import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -25,7 +24,6 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; -import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; import net.minecraft.util.Hand; import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.BlockPos; @@ -40,6 +38,8 @@ import net.wurstclient.mixinterface.IClientPlayerInteractionManager; import net.wurstclient.settings.CheckboxSetting; import net.wurstclient.settings.EnumSetting; +import net.wurstclient.settings.FacingSetting; +import net.wurstclient.settings.FacingSetting.Facing; import net.wurstclient.settings.SliderSetting; import net.wurstclient.settings.SliderSetting.ValueDisplay; import net.wurstclient.settings.filterlists.CrystalAuraFilterList; @@ -47,7 +47,6 @@ import net.wurstclient.util.BlockUtils; import net.wurstclient.util.FakePlayerEntity; import net.wurstclient.util.RotationUtils; -import net.wurstclient.util.RotationUtils.Rotation; @SearchTags({"crystal aura"}) public final class CrystalAuraHack extends Hack implements UpdateListener @@ -62,11 +61,12 @@ public final class CrystalAuraHack extends Hack implements UpdateListener + "When disabled, CrystalAura will only detonate manually placed crystals.", true); - private final EnumSetting faceBlocks = new EnumSetting<>( - "Face crystals", - "Whether or not CrystalAura should face the correct direction when placing and left-clicking end crystals.\n\n" - + "Slower but can help with anti-cheat plugins.", - FaceBlocks.values(), FaceBlocks.OFF); + private final FacingSetting faceBlocks = + FacingSetting.withPacketSpam("Face crystals", + "Whether or not CrystalAura should face the correct direction when" + + " placing and left-clicking end crystals.\n\n" + + "Slower but can help with anti-cheat plugins.", + Facing.OFF); private final CheckboxSetting checkLOS = new CheckboxSetting( "Check line of sight", @@ -358,45 +358,6 @@ private boolean isClickableNeighbor(BlockPos pos) && !BlockUtils.getState(pos).isReplaceable(); } - private enum FaceBlocks - { - OFF("Off", v -> {}), - - SERVER("Server-side", - v -> WURST.getRotationFaker().faceVectorPacket(v)), - - CLIENT("Client-side", - v -> WURST.getRotationFaker().faceVectorClient(v)), - - SPAM("Packet spam", v -> { - Rotation rotation = RotationUtils.getNeededRotations(v); - PlayerMoveC2SPacket.LookAndOnGround packet = - new PlayerMoveC2SPacket.LookAndOnGround(rotation.getYaw(), - rotation.getPitch(), MC.player.isOnGround()); - MC.player.networkHandler.sendPacket(packet); - }); - - private String name; - private Consumer face; - - private FaceBlocks(String name, Consumer face) - { - this.name = name; - this.face = face; - } - - public void face(Vec3d v) - { - face.accept(v); - } - - @Override - public String toString() - { - return name; - } - } - private enum TakeItemsFrom { HOTBAR("Hotbar", 9), diff --git a/src/main/java/net/wurstclient/settings/FacingSetting.java b/src/main/java/net/wurstclient/settings/FacingSetting.java index b4b1aa3b28..e6435c3329 100644 --- a/src/main/java/net/wurstclient/settings/FacingSetting.java +++ b/src/main/java/net/wurstclient/settings/FacingSetting.java @@ -9,26 +9,40 @@ import java.util.function.Consumer; +import net.minecraft.client.MinecraftClient; +import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; import net.minecraft.util.math.Vec3d; import net.wurstclient.WurstClient; +import net.wurstclient.util.RotationUtils; +import net.wurstclient.util.RotationUtils.Rotation; public final class FacingSetting extends EnumSetting { - protected static final WurstClient WURST = WurstClient.INSTANCE; + private static final WurstClient WURST = WurstClient.INSTANCE; + private static final MinecraftClient MC = WurstClient.MC; - public FacingSetting(String description) + private FacingSetting(String name, String description, Facing[] values, + Facing selected) { - super("Facing", description, Facing.values(), Facing.SERVER); + super(name, description, values, selected); } - public FacingSetting(String description, Facing selected) + public static FacingSetting withoutPacketSpam(String description) { - super("Facing", description, Facing.values(), selected); + return withoutPacketSpam("Facing", description, Facing.SERVER); } - public FacingSetting(String name, String description, Facing selected) + public static FacingSetting withoutPacketSpam(String name, + String description, Facing selected) { - super(name, description, Facing.values(), selected); + Facing[] values = {Facing.OFF, Facing.SERVER, Facing.CLIENT}; + return new FacingSetting(name, description, values, selected); + } + + public static FacingSetting withPacketSpam(String name, String description, + Facing selected) + { + return new FacingSetting(name, description, Facing.values(), selected); } public enum Facing @@ -39,7 +53,15 @@ public enum Facing v -> WURST.getRotationFaker().faceVectorPacket(v)), CLIENT("Client-side", - v -> WURST.getRotationFaker().faceVectorClient(v)); + v -> WURST.getRotationFaker().faceVectorClient(v)), + + SPAM("Packet spam", v -> { + Rotation rotation = RotationUtils.getNeededRotations(v); + PlayerMoveC2SPacket.LookAndOnGround packet = + new PlayerMoveC2SPacket.LookAndOnGround(rotation.getYaw(), + rotation.getPitch(), MC.player.isOnGround()); + MC.player.networkHandler.sendPacket(packet); + }); private String name; private Consumer face; From b1e148b87615a6e378f62fbcdec0b39695be9970 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 13 Aug 2023 17:44:10 +0200 Subject: [PATCH 163/282] Fix AnchorAuraHack.detonate() selecting the wrong item --- src/main/java/net/wurstclient/hacks/AnchorAuraHack.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java b/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java index 1e209a654f..0385ef99fa 100644 --- a/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java +++ b/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java @@ -187,9 +187,9 @@ private void detonate(ArrayList chargedAnchors) if(isSneaking()) return; - InventoryUtils.selectItem(Items.GLOWSTONE, + InventoryUtils.selectItem(stack -> !stack.isOf(Items.GLOWSTONE), takeItemsFrom.getSelected().maxInvSlot); - if(!MC.player.isHolding(Items.GLOWSTONE)) + if(MC.player.isHolding(Items.GLOWSTONE)) return; boolean shouldSwing = false; From 37a534a37f6014a2d0cac38d35df39391f165a90 Mon Sep 17 00:00:00 2001 From: ZANX3Y <74610540+ZANX3Y@users.noreply.github.com> Date: Mon, 14 Aug 2023 13:40:08 +0200 Subject: [PATCH 164/282] Fix X-Ray not working with Sodium Updated mixin target --- .../net/wurstclient/mixin/SodiumBlockOcclusionCacheMixin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/wurstclient/mixin/SodiumBlockOcclusionCacheMixin.java b/src/main/java/net/wurstclient/mixin/SodiumBlockOcclusionCacheMixin.java index 4be3c0116f..562dfa8c1a 100644 --- a/src/main/java/net/wurstclient/mixin/SodiumBlockOcclusionCacheMixin.java +++ b/src/main/java/net/wurstclient/mixin/SodiumBlockOcclusionCacheMixin.java @@ -22,7 +22,7 @@ @Pseudo @Mixin( - targets = "me.jellysquid.mods.sodium.client.render.occlusion.BlockOcclusionCache", + targets = "me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.BlockOcclusionCache", remap = false) public class SodiumBlockOcclusionCacheMixin { From d83b2aca8d6b328a3d449e040f98ada0ace1533c Mon Sep 17 00:00:00 2001 From: PeriodicSeizures <47781580+PeriodicSeizures@users.noreply.github.com> Date: Wed, 9 Aug 2023 15:27:05 -0400 Subject: [PATCH 165/282] anti-xray setting for X-Ray --- .../events/ShouldDrawSideListener.java | 11 +++++-- .../events/TesselateBlockListener.java | 11 +++++-- .../java/net/wurstclient/hacks/XRayHack.java | 30 +++++++++++++++---- .../net/wurstclient/mixin/BlockMixin.java | 2 +- .../mixin/BlockModelRendererMixin.java | 6 ++-- .../wurstclient/mixin/FluidRendererMixin.java | 2 +- .../mixin/SodiumBlockOcclusionCacheMixin.java | 2 +- .../mixin/TerrainRenderContextMixin.java | 2 +- 8 files changed, 49 insertions(+), 17 deletions(-) diff --git a/src/main/java/net/wurstclient/events/ShouldDrawSideListener.java b/src/main/java/net/wurstclient/events/ShouldDrawSideListener.java index 7586d8a240..2863a0b749 100644 --- a/src/main/java/net/wurstclient/events/ShouldDrawSideListener.java +++ b/src/main/java/net/wurstclient/events/ShouldDrawSideListener.java @@ -10,6 +10,7 @@ import java.util.ArrayList; import net.minecraft.block.BlockState; +import net.minecraft.util.math.BlockPos; import net.wurstclient.event.Event; import net.wurstclient.event.Listener; @@ -21,18 +22,24 @@ public static class ShouldDrawSideEvent extends Event { private final BlockState state; + private final BlockPos pos; private Boolean rendered; - public ShouldDrawSideEvent(BlockState state) + public ShouldDrawSideEvent(BlockState state, BlockPos pos) { this.state = state; + this.pos = pos; } public BlockState getState() { return state; } - + + public BlockPos getPos() { + return pos; + } + public Boolean isRendered() { return rendered; diff --git a/src/main/java/net/wurstclient/events/TesselateBlockListener.java b/src/main/java/net/wurstclient/events/TesselateBlockListener.java index f2d62e460f..4097b7efbf 100644 --- a/src/main/java/net/wurstclient/events/TesselateBlockListener.java +++ b/src/main/java/net/wurstclient/events/TesselateBlockListener.java @@ -10,6 +10,7 @@ import java.util.ArrayList; import net.minecraft.block.BlockState; +import net.minecraft.util.math.BlockPos; import net.wurstclient.event.CancellableEvent; import net.wurstclient.event.Listener; @@ -21,17 +22,23 @@ public static class TesselateBlockEvent extends CancellableEvent { private final BlockState state; + private final BlockPos pos; - public TesselateBlockEvent(BlockState state) + public TesselateBlockEvent(BlockState state, BlockPos pos) { this.state = state; + this.pos = pos; } public BlockState getState() { return state; } - + + public BlockPos getPos() { + return pos; + } + @Override public void fire(ArrayList listeners) { diff --git a/src/main/java/net/wurstclient/hacks/XRayHack.java b/src/main/java/net/wurstclient/hacks/XRayHack.java index 117ab241e1..e5a515dc73 100644 --- a/src/main/java/net/wurstclient/hacks/XRayHack.java +++ b/src/main/java/net/wurstclient/hacks/XRayHack.java @@ -17,7 +17,9 @@ import net.fabricmc.loader.api.ModContainer; import net.fabricmc.loader.api.metadata.ModMetadata; import net.minecraft.block.Block; +import net.minecraft.block.entity.BlockEntity; import net.minecraft.client.gui.screen.Screen; +import net.minecraft.util.math.BlockPos; import net.wurstclient.Category; import net.wurstclient.SearchTags; import net.wurstclient.clickgui.screens.EditBlockListScreen; @@ -30,6 +32,7 @@ import net.wurstclient.hack.Hack; import net.wurstclient.mixinterface.ISimpleOption; import net.wurstclient.settings.BlockListSetting; +import net.wurstclient.settings.CheckboxSetting; import net.wurstclient.util.BlockUtils; import net.wurstclient.util.ChatUtils; @@ -65,7 +68,9 @@ public final class XRayHack extends Hack implements UpdateListener, "minecraft:spawner", "minecraft:suspicious_gravel", "minecraft:suspicious_sand", "minecraft:tnt", "minecraft:torch", "minecraft:trapped_chest", "minecraft:water"); - + + private final CheckboxSetting antiXrayBypass = new CheckboxSetting("Anti-XRay Bypass", "Show only blocks exposed to air", false); + private ArrayList oreNames; private final String warning; @@ -77,6 +82,7 @@ public XRayHack() super("X-Ray"); setCategory(Category.RENDER); addSetting(ores); + addSetting(antiXrayBypass); List mods = FabricLoader.getInstance().getAllMods().stream() .map(ModContainer::getMetadata).map(ModMetadata::getId) @@ -160,20 +166,21 @@ public void onGetAmbientOcclusionLightLevel( @Override public void onShouldDrawSide(ShouldDrawSideEvent event) { - event.setRendered(isVisible(event.getState().getBlock())); + event.setRendered(isVisible(event.getState().getBlock(), event.getPos())); } @Override public void onTesselateBlock(TesselateBlockEvent event) { - if(!isVisible(event.getState().getBlock())) + if(!isVisible(event.getState().getBlock(), event.getPos())) event.cancel(); } @Override public void onRenderBlockEntity(RenderBlockEntityEvent event) { - if(!isVisible(BlockUtils.getBlock(event.getBlockEntity().getPos()))) + BlockPos pos = event.getBlockEntity().getPos(); + if(!isVisible(BlockUtils.getBlock(pos), pos)) event.cancel(); } @@ -182,10 +189,21 @@ public void openBlockListEditor(Screen prevScreen) MC.setScreen(new EditBlockListScreen(prevScreen, ores)); } - private boolean isVisible(Block block) + private boolean isVisible(Block block, BlockPos pos) { String name = BlockUtils.getName(block); int index = Collections.binarySearch(oreNames, name); - return index >= 0; + boolean visible = index >= 0; + + if (visible && antiXrayBypass.isChecked()) { + return BlockUtils.getBlock(pos.up()).getDefaultState().isAir() + || BlockUtils.getBlock(pos.down()).getDefaultState().isAir() + || BlockUtils.getBlock(pos.east()).getDefaultState().isAir() + || BlockUtils.getBlock(pos.west()).getDefaultState().isAir() + || BlockUtils.getBlock(pos.north()).getDefaultState().isAir() + || BlockUtils.getBlock(pos.south()).getDefaultState().isAir(); + } + + return visible; } } diff --git a/src/main/java/net/wurstclient/mixin/BlockMixin.java b/src/main/java/net/wurstclient/mixin/BlockMixin.java index 52cca886c6..9d9b8f46b0 100644 --- a/src/main/java/net/wurstclient/mixin/BlockMixin.java +++ b/src/main/java/net/wurstclient/mixin/BlockMixin.java @@ -34,7 +34,7 @@ private static void onShouldDrawSide(BlockState state, BlockView world, BlockPos pos, Direction direction, BlockPos blockPos, CallbackInfoReturnable cir) { - ShouldDrawSideEvent event = new ShouldDrawSideEvent(state); + ShouldDrawSideEvent event = new ShouldDrawSideEvent(state, pos); EventManager.fire(event); if(event.isRendered() != null) diff --git a/src/main/java/net/wurstclient/mixin/BlockModelRendererMixin.java b/src/main/java/net/wurstclient/mixin/BlockModelRendererMixin.java index 10d9a38634..87e8ff93c3 100644 --- a/src/main/java/net/wurstclient/mixin/BlockModelRendererMixin.java +++ b/src/main/java/net/wurstclient/mixin/BlockModelRendererMixin.java @@ -38,9 +38,9 @@ private void onRenderSmoothOrFlat(BlockRenderView world, BakedModel model, VertexConsumer vertexConsumer, boolean cull, Random random, long seed, int overlay, CallbackInfo ci) { - TesselateBlockEvent event = new TesselateBlockEvent(state); + TesselateBlockEvent event = new TesselateBlockEvent(state, pos); EventManager.fire(event); - + if(event.isCancelled()) { ci.cancel(); @@ -50,7 +50,7 @@ private void onRenderSmoothOrFlat(BlockRenderView world, BakedModel model, if(!cull) return; - ShouldDrawSideEvent event2 = new ShouldDrawSideEvent(state); + ShouldDrawSideEvent event2 = new ShouldDrawSideEvent(state, pos); EventManager.fire(event2); if(!Boolean.TRUE.equals(event2.isRendered())) return; diff --git a/src/main/java/net/wurstclient/mixin/FluidRendererMixin.java b/src/main/java/net/wurstclient/mixin/FluidRendererMixin.java index 1989a9fb55..0b9f6a5f5d 100644 --- a/src/main/java/net/wurstclient/mixin/FluidRendererMixin.java +++ b/src/main/java/net/wurstclient/mixin/FluidRendererMixin.java @@ -32,7 +32,7 @@ private static void onIsSideCovered(BlockView blockView, BlockPos blockPos, CallbackInfoReturnable cir) { BlockState state = blockView.getBlockState(blockPos); - ShouldDrawSideEvent event = new ShouldDrawSideEvent(state); + ShouldDrawSideEvent event = new ShouldDrawSideEvent(state, blockPos); EventManager.fire(event); if(event.isRendered() != null) diff --git a/src/main/java/net/wurstclient/mixin/SodiumBlockOcclusionCacheMixin.java b/src/main/java/net/wurstclient/mixin/SodiumBlockOcclusionCacheMixin.java index 4be3c0116f..3f71181982 100644 --- a/src/main/java/net/wurstclient/mixin/SodiumBlockOcclusionCacheMixin.java +++ b/src/main/java/net/wurstclient/mixin/SodiumBlockOcclusionCacheMixin.java @@ -34,7 +34,7 @@ public void shouldDrawSide(BlockState state, BlockView view, BlockPos pos, Direction facing, CallbackInfoReturnable cir) { ShouldDrawSideListener.ShouldDrawSideEvent event = - new ShouldDrawSideListener.ShouldDrawSideEvent(state); + new ShouldDrawSideListener.ShouldDrawSideEvent(state, pos); EventManager.fire(event); if(event.isRendered() != null) diff --git a/src/main/java/net/wurstclient/mixin/TerrainRenderContextMixin.java b/src/main/java/net/wurstclient/mixin/TerrainRenderContextMixin.java index 4a135afca4..2d1a283fb4 100644 --- a/src/main/java/net/wurstclient/mixin/TerrainRenderContextMixin.java +++ b/src/main/java/net/wurstclient/mixin/TerrainRenderContextMixin.java @@ -39,7 +39,7 @@ public class TerrainRenderContextMixin private void onTessellateBlock(BlockState blockState, BlockPos blockPos, final BakedModel model, MatrixStack matrixStack, CallbackInfo ci) { - TesselateBlockEvent event = new TesselateBlockEvent(blockState); + TesselateBlockEvent event = new TesselateBlockEvent(blockState, blockPos); EventManager.fire(event); if(event.isCancelled()) From 19270b6cb1e7ab64d88b200bf5d7c98f6a017061 Mon Sep 17 00:00:00 2001 From: PeriodicSeizures <47781580+PeriodicSeizures@users.noreply.github.com> Date: Mon, 14 Aug 2023 10:48:25 -0400 Subject: [PATCH 166/282] exposed via BlockList --- .../java/net/wurstclient/hacks/XRayHack.java | 77 +++++++++++++++---- .../settings/BlockListSetting.java | 2 + 2 files changed, 63 insertions(+), 16 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/XRayHack.java b/src/main/java/net/wurstclient/hacks/XRayHack.java index e5a515dc73..072b999b63 100644 --- a/src/main/java/net/wurstclient/hacks/XRayHack.java +++ b/src/main/java/net/wurstclient/hacks/XRayHack.java @@ -7,9 +7,7 @@ */ package net.wurstclient.hacks; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; +import java.util.*; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -17,7 +15,7 @@ import net.fabricmc.loader.api.ModContainer; import net.fabricmc.loader.api.metadata.ModMetadata; import net.minecraft.block.Block; -import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.Blocks; import net.minecraft.client.gui.screen.Screen; import net.minecraft.util.math.BlockPos; import net.wurstclient.Category; @@ -41,6 +39,22 @@ public final class XRayHack extends Hack implements UpdateListener, SetOpaqueCubeListener, GetAmbientOcclusionLightLevelListener, ShouldDrawSideListener, TesselateBlockListener, RenderBlockEntityListener { + //private static final Set EXPOSED_NEIGHBOUR_BLOCKS = new HashSet<>(Arrays.asList( + // Blocks.AIR, + // Blocks.CAVE_AIR, + // Blocks.WATER, + // Blocks.LAVA, + // Blocks.VINE, // deep dark? + // Blocks.CAVE_VINES, + // Blocks.POINTED_DRIPSTONE, + // Blocks.BIG_DRIPLEAF_STEM, + // Blocks.BIG_DRIPLEAF, + // Blocks.SMALL_DRIPLEAF, + // Blocks.IRON_BARS, // stronghold? + // Blocks.IRON_DOOR, + // Blocks.OAK_FENCE // mineshaft? + //)); + private final BlockListSetting ores = new BlockListSetting("Ores", "", "minecraft:ancient_debris", "minecraft:anvil", "minecraft:beacon", "minecraft:bone_block", "minecraft:bookshelf", @@ -69,9 +83,30 @@ public final class XRayHack extends Hack implements UpdateListener, "minecraft:suspicious_sand", "minecraft:tnt", "minecraft:torch", "minecraft:trapped_chest", "minecraft:water"); - private final CheckboxSetting antiXrayBypass = new CheckboxSetting("Anti-XRay Bypass", "Show only blocks exposed to air", false); - private ArrayList oreNames; + + private final BlockListSetting exposedBlocks = new BlockListSetting("Exposed", "Blocks to filter as exposed", + "minecraft:air", + "minecraft:big_dripleaf", + "minecraft:big_dripleaf_stem", + "minecraft:big_pointed_dripstone", + "minecraft:cave_air", + "minecraft:cave_vines", + "minecraft:iron_bars", + "minecraft:iron_door", + "minecraft:lava", + "minecraft:oak_fence", + "minecraft:pointed_dripstone", + "minecraft:small_dripleaf", + "minecraft:vine", + "minecraft:water"); + + private ArrayList exposedNames; + + private final CheckboxSetting showExposed = new CheckboxSetting("Show exposed", "Only show ores touching visible blocks.\nUseful for dealing with anti-xray plugins.\nReenable this hack if nothing appears changed.", false); + + // TODO does anyone use optifine anymore? + // closed source + alternatives like sodium = why private final String warning; private final String renderName = @@ -82,7 +117,8 @@ public XRayHack() super("X-Ray"); setCategory(Category.RENDER); addSetting(ores); - addSetting(antiXrayBypass); + addSetting(exposedBlocks); + addSetting(showExposed); List mods = FabricLoader.getInstance().getAllMods().stream() .map(ModContainer::getMetadata).map(ModMetadata::getId) @@ -105,7 +141,9 @@ public String getRenderName() @Override public void onEnable() { + // TODO BlockList already contains an ArrayList, why not just use that? oreNames = new ArrayList<>(ores.getBlockNames()); + exposedNames = new ArrayList<>(exposedBlocks.getBlockNames()); EVENTS.add(UpdateListener.class, this); EVENTS.add(SetOpaqueCubeListener.class, this); @@ -129,7 +167,7 @@ public void onDisable() EVENTS.remove(TesselateBlockListener.class, this); EVENTS.remove(RenderBlockEntityListener.class, this); MC.worldRenderer.reload(); - + @SuppressWarnings("unchecked") ISimpleOption gammaOption = (ISimpleOption)(Object)MC.options.getGamma(); @@ -188,20 +226,27 @@ public void openBlockListEditor(Screen prevScreen) { MC.setScreen(new EditBlockListScreen(prevScreen, ores)); } - + private boolean isVisible(Block block, BlockPos pos) { String name = BlockUtils.getName(block); int index = Collections.binarySearch(oreNames, name); boolean visible = index >= 0; - if (visible && antiXrayBypass.isChecked()) { - return BlockUtils.getBlock(pos.up()).getDefaultState().isAir() - || BlockUtils.getBlock(pos.down()).getDefaultState().isAir() - || BlockUtils.getBlock(pos.east()).getDefaultState().isAir() - || BlockUtils.getBlock(pos.west()).getDefaultState().isAir() - || BlockUtils.getBlock(pos.north()).getDefaultState().isAir() - || BlockUtils.getBlock(pos.south()).getDefaultState().isAir(); + if (visible && showExposed.isChecked()) { + return Collections.binarySearch(exposedNames, BlockUtils.getName(pos.up())) >= 0 + || Collections.binarySearch(exposedNames, BlockUtils.getName(pos.down())) >= 0 + || Collections.binarySearch(exposedNames, BlockUtils.getName(pos.east())) >= 0 + || Collections.binarySearch(exposedNames, BlockUtils.getName(pos.west())) >= 0 + || Collections.binarySearch(exposedNames, BlockUtils.getName(pos.north())) >= 0 + || Collections.binarySearch(exposedNames, BlockUtils.getName(pos.south())) >= 0; + + //return EXPOSED_NEIGHBOUR_BLOCKS.contains(BlockUtils.getBlock(pos.up())) + // || EXPOSED_NEIGHBOUR_BLOCKS.contains(BlockUtils.getBlock(pos.down())) + // || EXPOSED_NEIGHBOUR_BLOCKS.contains(BlockUtils.getBlock(pos.east())) + // || EXPOSED_NEIGHBOUR_BLOCKS.contains(BlockUtils.getBlock(pos.west())) + // || EXPOSED_NEIGHBOUR_BLOCKS.contains(BlockUtils.getBlock(pos.north())) + // || EXPOSED_NEIGHBOUR_BLOCKS.contains(BlockUtils.getBlock(pos.south())); } return visible; diff --git a/src/main/java/net/wurstclient/settings/BlockListSetting.java b/src/main/java/net/wurstclient/settings/BlockListSetting.java index afc3d329d3..e921a0f4e3 100644 --- a/src/main/java/net/wurstclient/settings/BlockListSetting.java +++ b/src/main/java/net/wurstclient/settings/BlockListSetting.java @@ -33,6 +33,8 @@ public final class BlockListSetting extends Setting { + // TODO blocks which cannot be visually represented as items default to 'unknown', + // ie water, air, lava, nether_portal, end_portal, ... private final ArrayList blockNames = new ArrayList<>(); private final String[] defaultNames; From 4a7cfac6d659b281b0ec478bf2a0cdb7af3c4e39 Mon Sep 17 00:00:00 2001 From: PeriodicSeizures <47781580+PeriodicSeizures@users.noreply.github.com> Date: Mon, 14 Aug 2023 11:18:22 -0400 Subject: [PATCH 167/282] exposed via BlockUtils.canBeClicked --- .../java/net/wurstclient/hacks/XRayHack.java | 60 +++++++++++-------- 1 file changed, 35 insertions(+), 25 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/XRayHack.java b/src/main/java/net/wurstclient/hacks/XRayHack.java index 072b999b63..b9bbda94c6 100644 --- a/src/main/java/net/wurstclient/hacks/XRayHack.java +++ b/src/main/java/net/wurstclient/hacks/XRayHack.java @@ -85,25 +85,25 @@ public final class XRayHack extends Hack implements UpdateListener, private ArrayList oreNames; - private final BlockListSetting exposedBlocks = new BlockListSetting("Exposed", "Blocks to filter as exposed", - "minecraft:air", - "minecraft:big_dripleaf", - "minecraft:big_dripleaf_stem", - "minecraft:big_pointed_dripstone", - "minecraft:cave_air", - "minecraft:cave_vines", - "minecraft:iron_bars", - "minecraft:iron_door", - "minecraft:lava", - "minecraft:oak_fence", - "minecraft:pointed_dripstone", - "minecraft:small_dripleaf", - "minecraft:vine", - "minecraft:water"); + //private final BlockListSetting exposedBlocks = new BlockListSetting("Exposed", "Blocks to filter as exposed", + // "minecraft:air", + // "minecraft:big_dripleaf", + // "minecraft:big_dripleaf_stem", + // "minecraft:big_pointed_dripstone", + // "minecraft:cave_air", + // "minecraft:cave_vines", + // "minecraft:iron_bars", + // "minecraft:iron_door", + // "minecraft:lava", + // "minecraft:oak_fence", + // "minecraft:pointed_dripstone", + // "minecraft:small_dripleaf", + // "minecraft:vine", + // "minecraft:water"); - private ArrayList exposedNames; + //private ArrayList exposedNames; - private final CheckboxSetting showExposed = new CheckboxSetting("Show exposed", "Only show ores touching visible blocks.\nUseful for dealing with anti-xray plugins.\nReenable this hack if nothing appears changed.", false); + private final CheckboxSetting showExposed = new CheckboxSetting("Show exposed", "Only show exposed ores touching air/water/lava.\nUseful for servers utilizing anti-X-Ray.\nReenable this hack if nothing appears changed.", false); // TODO does anyone use optifine anymore? // closed source + alternatives like sodium = why @@ -117,7 +117,7 @@ public XRayHack() super("X-Ray"); setCategory(Category.RENDER); addSetting(ores); - addSetting(exposedBlocks); + //addSetting(exposedBlocks); addSetting(showExposed); List mods = FabricLoader.getInstance().getAllMods().stream() @@ -143,7 +143,7 @@ public void onEnable() { // TODO BlockList already contains an ArrayList, why not just use that? oreNames = new ArrayList<>(ores.getBlockNames()); - exposedNames = new ArrayList<>(exposedBlocks.getBlockNames()); + //exposedNames = new ArrayList<>(exposedBlocks.getBlockNames()); EVENTS.add(UpdateListener.class, this); EVENTS.add(SetOpaqueCubeListener.class, this); @@ -234,12 +234,22 @@ private boolean isVisible(Block block, BlockPos pos) boolean visible = index >= 0; if (visible && showExposed.isChecked()) { - return Collections.binarySearch(exposedNames, BlockUtils.getName(pos.up())) >= 0 - || Collections.binarySearch(exposedNames, BlockUtils.getName(pos.down())) >= 0 - || Collections.binarySearch(exposedNames, BlockUtils.getName(pos.east())) >= 0 - || Collections.binarySearch(exposedNames, BlockUtils.getName(pos.west())) >= 0 - || Collections.binarySearch(exposedNames, BlockUtils.getName(pos.north())) >= 0 - || Collections.binarySearch(exposedNames, BlockUtils.getName(pos.south())) >= 0; + // TODO this only considers blocks with no hitbox + // shouldnt blocks like fences, vines be considered exposed? + // this works for most cases so its probably redundant... + return !BlockUtils.canBeClicked(pos.up()) + || !BlockUtils.canBeClicked(pos.down()) + || !BlockUtils.canBeClicked(pos.east()) + || !BlockUtils.canBeClicked(pos.west()) + || !BlockUtils.canBeClicked(pos.north()) + || !BlockUtils.canBeClicked(pos.south()); + + //return Collections.binarySearch(exposedNames, BlockUtils.getName(pos.up())) >= 0 + // || Collections.binarySearch(exposedNames, BlockUtils.getName(pos.down())) >= 0 + // || Collections.binarySearch(exposedNames, BlockUtils.getName(pos.east())) >= 0 + // || Collections.binarySearch(exposedNames, BlockUtils.getName(pos.west())) >= 0 + // || Collections.binarySearch(exposedNames, BlockUtils.getName(pos.north())) >= 0 + // || Collections.binarySearch(exposedNames, BlockUtils.getName(pos.south())) >= 0; //return EXPOSED_NEIGHBOUR_BLOCKS.contains(BlockUtils.getBlock(pos.up())) // || EXPOSED_NEIGHBOUR_BLOCKS.contains(BlockUtils.getBlock(pos.down())) From 07d0876cb7f2f1bfd99946f1654f924589ea6ed0 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 14 Aug 2023 18:25:17 +0200 Subject: [PATCH 168/282] Use InventoryUtils in CrystalAuraHack --- .../wurstclient/hacks/CrystalAuraHack.java | 67 +++---------------- 1 file changed, 9 insertions(+), 58 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/CrystalAuraHack.java b/src/main/java/net/wurstclient/hacks/CrystalAuraHack.java index 531df39443..5c96eefab7 100644 --- a/src/main/java/net/wurstclient/hacks/CrystalAuraHack.java +++ b/src/main/java/net/wurstclient/hacks/CrystalAuraHack.java @@ -9,7 +9,6 @@ import java.util.ArrayList; import java.util.Comparator; -import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.stream.Stream; import java.util.stream.StreamSupport; @@ -20,9 +19,6 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.decoration.EndCrystalEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.util.Hand; import net.minecraft.util.hit.HitResult; @@ -35,7 +31,6 @@ import net.wurstclient.SearchTags; import net.wurstclient.events.UpdateListener; import net.wurstclient.hack.Hack; -import net.wurstclient.mixinterface.IClientPlayerInteractionManager; import net.wurstclient.settings.CheckboxSetting; import net.wurstclient.settings.EnumSetting; import net.wurstclient.settings.FacingSetting; @@ -46,6 +41,7 @@ import net.wurstclient.settings.filterlists.EntityFilterList; import net.wurstclient.util.BlockUtils; import net.wurstclient.util.FakePlayerEntity; +import net.wurstclient.util.InventoryUtils; import net.wurstclient.util.RotationUtils; @SearchTags({"crystal aura"}) @@ -129,8 +125,11 @@ public void onUpdate() return; } - if(!autoPlace.isChecked() - || !hasItem(item -> item == Items.END_CRYSTAL)) + if(!autoPlace.isChecked()) + return; + + if(InventoryUtils.indexOf(Items.END_CRYSTAL, + takeItemsFrom.getSelected().maxInvSlot) == -1) return; ArrayList targets = getNearbyTargets(); @@ -175,56 +174,6 @@ private void detonate(ArrayList crystals) MC.player.swingHand(Hand.MAIN_HAND); } - private boolean selectItem(Predicate item) - { - PlayerInventory inventory = MC.player.getInventory(); - IClientPlayerInteractionManager im = IMC.getInteractionManager(); - int maxInvSlot = takeItemsFrom.getSelected().maxInvSlot; - - for(int slot = 0; slot < maxInvSlot; slot++) - { - ItemStack stack = inventory.getStack(slot); - if(!item.test(stack.getItem())) - continue; - - if(slot < 9) - inventory.selectedSlot = slot; - else if(inventory.getEmptySlot() < 9) - im.windowClick_QUICK_MOVE(slot); - else if(inventory.getEmptySlot() != -1) - { - im.windowClick_QUICK_MOVE(inventory.selectedSlot + 36); - im.windowClick_QUICK_MOVE(slot); - }else - { - im.windowClick_PICKUP(inventory.selectedSlot + 36); - im.windowClick_PICKUP(slot); - im.windowClick_PICKUP(inventory.selectedSlot + 36); - } - - return true; - } - - return false; - } - - private boolean hasItem(Predicate item) - { - PlayerInventory inventory = MC.player.getInventory(); - int maxInvSlot = takeItemsFrom.getSelected().maxInvSlot; - - for(int slot = 0; slot < maxInvSlot; slot++) - { - ItemStack stack = inventory.getStack(slot); - if(!item.test(stack.getItem())) - continue; - - return true; - } - - return false; - } - private boolean placeCrystal(BlockPos pos) { Vec3d eyesPos = RotationUtils.getEyesPos(); @@ -258,7 +207,9 @@ private boolean placeCrystal(BlockPos pos) .getType() != HitResult.Type.MISS) continue; - if(!selectItem(item -> item == Items.END_CRYSTAL)) + InventoryUtils.selectItem(Items.END_CRYSTAL, + takeItemsFrom.getSelected().maxInvSlot); + if(!MC.player.isHolding(Items.END_CRYSTAL)) return false; faceBlocks.getSelected().face(hitVec); From e07518ea5cbd7612205aed8430463daceabd2cd8 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 14 Aug 2023 19:18:27 +0200 Subject: [PATCH 169/282] Replace AnchorAuraHack.hasItem() with InventoryUtils --- .../net/wurstclient/hacks/AnchorAuraHack.java | 30 ++++--------------- 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java b/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java index 0385ef99fa..5eca0dc6c6 100644 --- a/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java +++ b/src/main/java/net/wurstclient/hacks/AnchorAuraHack.java @@ -10,7 +10,6 @@ import java.util.ArrayList; import java.util.Comparator; import java.util.Map; -import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.stream.Stream; import java.util.stream.StreamSupport; @@ -19,9 +18,6 @@ import net.minecraft.block.RespawnAnchorBlock; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.util.Hand; import net.minecraft.util.hit.HitResult; @@ -132,8 +128,10 @@ public void onUpdate() return; } + int maxInvSlot = takeItemsFrom.getSelected().maxInvSlot; + if(!unchargedAnchors.isEmpty() - && hasItem(item -> item == Items.GLOWSTONE)) + && InventoryUtils.indexOf(Items.GLOWSTONE, maxInvSlot) >= 0) { charge(unchargedAnchors); // TODO: option to wait until next tick? @@ -142,13 +140,14 @@ && hasItem(item -> item == Items.GLOWSTONE)) } if(!autoPlace.isChecked() - || !hasItem(item -> item == Items.RESPAWN_ANCHOR)) + || InventoryUtils.indexOf(Items.RESPAWN_ANCHOR, maxInvSlot) == -1) return; ArrayList targets = getNearbyTargets(); ArrayList newAnchors = placeAnchorsNear(targets); - if(!newAnchors.isEmpty() && hasItem(item -> item == Items.GLOWSTONE)) + if(!newAnchors.isEmpty() + && InventoryUtils.indexOf(Items.GLOWSTONE, maxInvSlot) >= 0) { // TODO: option to wait until next tick? charge(newAnchors); @@ -222,23 +221,6 @@ private void charge(ArrayList unchargedAnchors) MC.player.swingHand(Hand.MAIN_HAND); } - private boolean hasItem(Predicate item) - { - PlayerInventory inventory = MC.player.getInventory(); - int maxInvSlot = takeItemsFrom.getSelected().maxInvSlot; - - for(int slot = 0; slot < maxInvSlot; slot++) - { - ItemStack stack = inventory.getStack(slot); - if(!item.test(stack.getItem())) - continue; - - return true; - } - - return false; - } - private boolean rightClickBlock(BlockPos pos) { Vec3d eyesPos = RotationUtils.getEyesPos(); From b990fe4199ce401ff81fec785ebdbf94b9626172 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Thu, 17 Aug 2023 19:40:30 +0200 Subject: [PATCH 170/282] Further improve X-Ray --- .../events/ShouldDrawSideListener.java | 7 +- .../events/TesselateBlockListener.java | 7 +- .../net/wurstclient/hacks/FullbrightHack.java | 17 +- .../java/net/wurstclient/hacks/XRayHack.java | 182 +++++++----------- .../net/wurstclient/mixin/BlockMixin.java | 9 +- .../mixin/BlockModelRendererMixin.java | 4 +- .../wurstclient/mixin/FluidRendererMixin.java | 5 +- .../mixin/SodiumBlockOcclusionCacheMixin.java | 4 +- .../mixin/TerrainRenderContextMixin.java | 3 +- .../mixinterface/ISimpleOption.java | 16 ++ .../settings/BlockListSetting.java | 2 - .../java/net/wurstclient/util/BlockUtils.java | 5 + 12 files changed, 123 insertions(+), 138 deletions(-) diff --git a/src/main/java/net/wurstclient/events/ShouldDrawSideListener.java b/src/main/java/net/wurstclient/events/ShouldDrawSideListener.java index 2863a0b749..c99b2d448f 100644 --- a/src/main/java/net/wurstclient/events/ShouldDrawSideListener.java +++ b/src/main/java/net/wurstclient/events/ShouldDrawSideListener.java @@ -35,11 +35,12 @@ public BlockState getState() { return state; } - - public BlockPos getPos() { + + public BlockPos getPos() + { return pos; } - + public Boolean isRendered() { return rendered; diff --git a/src/main/java/net/wurstclient/events/TesselateBlockListener.java b/src/main/java/net/wurstclient/events/TesselateBlockListener.java index 4097b7efbf..1873402f3a 100644 --- a/src/main/java/net/wurstclient/events/TesselateBlockListener.java +++ b/src/main/java/net/wurstclient/events/TesselateBlockListener.java @@ -34,11 +34,12 @@ public BlockState getState() { return state; } - - public BlockPos getPos() { + + public BlockPos getPos() + { return pos; } - + @Override public void fire(ArrayList listeners) { diff --git a/src/main/java/net/wurstclient/hacks/FullbrightHack.java b/src/main/java/net/wurstclient/hacks/FullbrightHack.java index 5f9b3f84ed..59ea1d70cc 100644 --- a/src/main/java/net/wurstclient/hacks/FullbrightHack.java +++ b/src/main/java/net/wurstclient/hacks/FullbrightHack.java @@ -99,9 +99,7 @@ private void setGamma(double target) wasGammaChanged = true; SimpleOption gammaOption = MC.options.getGamma(); - @SuppressWarnings("unchecked") - ISimpleOption gammaOption2 = - (ISimpleOption)(Object)gammaOption; + ISimpleOption gammaOption2 = ISimpleOption.get(gammaOption); double oldGammaValue = gammaOption.getValue(); if(!fade.isChecked() || Math.abs(oldGammaValue - target) <= 0.5) @@ -119,9 +117,7 @@ private void setGamma(double target) private void resetGamma(double target) { SimpleOption gammaOption = MC.options.getGamma(); - @SuppressWarnings("unchecked") - ISimpleOption gammaOption2 = - (ISimpleOption)(Object)gammaOption; + ISimpleOption gammaOption2 = ISimpleOption.get(gammaOption); double oldGammaValue = gammaOption.getValue(); if(!fade.isChecked() || Math.abs(oldGammaValue - target) <= 0.5) @@ -167,6 +163,15 @@ public float getNightVisionStrength() return nightVisionStrength; } + /** + * Returns the value of Fullbright's "Default brightness" slider. Used by + * {@link XRayHack} to restore the gamma value when X-Ray is turned off. + */ + public double getDefaultGamma() + { + return defaultGamma.getValue(); + } + private static enum Method { GAMMA("Gamma"), diff --git a/src/main/java/net/wurstclient/hacks/XRayHack.java b/src/main/java/net/wurstclient/hacks/XRayHack.java index b9bbda94c6..d989824dad 100644 --- a/src/main/java/net/wurstclient/hacks/XRayHack.java +++ b/src/main/java/net/wurstclient/hacks/XRayHack.java @@ -7,15 +7,15 @@ */ package net.wurstclient.hacks; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; import java.util.regex.Pattern; -import java.util.stream.Collectors; +import java.util.stream.Stream; import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.ModContainer; import net.fabricmc.loader.api.metadata.ModMetadata; import net.minecraft.block.Block; -import net.minecraft.block.Blocks; import net.minecraft.client.gui.screen.Screen; import net.minecraft.util.math.BlockPos; import net.wurstclient.Category; @@ -39,23 +39,10 @@ public final class XRayHack extends Hack implements UpdateListener, SetOpaqueCubeListener, GetAmbientOcclusionLightLevelListener, ShouldDrawSideListener, TesselateBlockListener, RenderBlockEntityListener { - //private static final Set EXPOSED_NEIGHBOUR_BLOCKS = new HashSet<>(Arrays.asList( - // Blocks.AIR, - // Blocks.CAVE_AIR, - // Blocks.WATER, - // Blocks.LAVA, - // Blocks.VINE, // deep dark? - // Blocks.CAVE_VINES, - // Blocks.POINTED_DRIPSTONE, - // Blocks.BIG_DRIPLEAF_STEM, - // Blocks.BIG_DRIPLEAF, - // Blocks.SMALL_DRIPLEAF, - // Blocks.IRON_BARS, // stronghold? - // Blocks.IRON_DOOR, - // Blocks.OAK_FENCE // mineshaft? - //)); - - private final BlockListSetting ores = new BlockListSetting("Ores", "", + private final BlockListSetting ores = new BlockListSetting("Ores", + "A list of blocks that X-Ray will show. They don't have to be just ores" + + " - you can add any block you want.\n\n" + + "Remember to restart X-Ray when changing this setting.", "minecraft:ancient_debris", "minecraft:anvil", "minecraft:beacon", "minecraft:bone_block", "minecraft:bookshelf", "minecraft:brewing_stand", "minecraft:chain_command_block", @@ -82,54 +69,27 @@ public final class XRayHack extends Hack implements UpdateListener, "minecraft:spawner", "minecraft:suspicious_gravel", "minecraft:suspicious_sand", "minecraft:tnt", "minecraft:torch", "minecraft:trapped_chest", "minecraft:water"); - - private ArrayList oreNames; - - //private final BlockListSetting exposedBlocks = new BlockListSetting("Exposed", "Blocks to filter as exposed", - // "minecraft:air", - // "minecraft:big_dripleaf", - // "minecraft:big_dripleaf_stem", - // "minecraft:big_pointed_dripstone", - // "minecraft:cave_air", - // "minecraft:cave_vines", - // "minecraft:iron_bars", - // "minecraft:iron_door", - // "minecraft:lava", - // "minecraft:oak_fence", - // "minecraft:pointed_dripstone", - // "minecraft:small_dripleaf", - // "minecraft:vine", - // "minecraft:water"); - - //private ArrayList exposedNames; - - private final CheckboxSetting showExposed = new CheckboxSetting("Show exposed", "Only show exposed ores touching air/water/lava.\nUseful for servers utilizing anti-X-Ray.\nReenable this hack if nothing appears changed.", false); - - // TODO does anyone use optifine anymore? - // closed source + alternatives like sodium = why - private final String warning; + private final CheckboxSetting onlyExposed = new CheckboxSetting( + "Only show exposed", + "Only shows ores that would be visible in caves. This can help against" + + " anti-X-Ray plugins.\n\n" + + "Remember to restart X-Ray when changing this setting.", + false); + + private final String optiFineWarning; private final String renderName = Math.random() < 0.01 ? "X-Wurst" : getName(); + private ArrayList oreNamesCache; + public XRayHack() { super("X-Ray"); setCategory(Category.RENDER); addSetting(ores); - //addSetting(exposedBlocks); - addSetting(showExposed); - - List mods = FabricLoader.getInstance().getAllMods().stream() - .map(ModContainer::getMetadata).map(ModMetadata::getId) - .collect(Collectors.toList()); - - Pattern optifine = Pattern.compile("opti(?:fine|fabric).*"); - - if(mods.stream().anyMatch(optifine.asPredicate())) - warning = "OptiFine is installed. X-Ray will not work properly!"; - else - warning = null; + addSetting(onlyExposed); + optiFineWarning = checkOptiFine(); } @Override @@ -141,51 +101,51 @@ public String getRenderName() @Override public void onEnable() { - // TODO BlockList already contains an ArrayList, why not just use that? - oreNames = new ArrayList<>(ores.getBlockNames()); - //exposedNames = new ArrayList<>(exposedBlocks.getBlockNames()); + // cache block names in case the setting changes while X-Ray is enabled + oreNamesCache = new ArrayList<>(ores.getBlockNames()); + // add event listeners EVENTS.add(UpdateListener.class, this); EVENTS.add(SetOpaqueCubeListener.class, this); EVENTS.add(GetAmbientOcclusionLightLevelListener.class, this); EVENTS.add(ShouldDrawSideListener.class, this); EVENTS.add(TesselateBlockListener.class, this); EVENTS.add(RenderBlockEntityListener.class, this); + + // reload chunks MC.worldRenderer.reload(); - if(warning != null) - ChatUtils.warning(warning); + // display warning if OptiFine is detected + if(optiFineWarning != null) + ChatUtils.warning(optiFineWarning); } @Override public void onDisable() { + // remove event listeners EVENTS.remove(UpdateListener.class, this); EVENTS.remove(SetOpaqueCubeListener.class, this); EVENTS.remove(GetAmbientOcclusionLightLevelListener.class, this); EVENTS.remove(ShouldDrawSideListener.class, this); EVENTS.remove(TesselateBlockListener.class, this); EVENTS.remove(RenderBlockEntityListener.class, this); + + // reload chunks MC.worldRenderer.reload(); - - @SuppressWarnings("unchecked") - ISimpleOption gammaOption = - (ISimpleOption)(Object)MC.options.getGamma(); - // TODO: Why does this use 0.5 instead of - // FullBright's defaultGamma setting? - if(!WURST.getHax().fullbrightHack.isEnabled()) - gammaOption.forceSetValue(0.5); + // reset gamma + FullbrightHack fullbright = WURST.getHax().fullbrightHack; + if(!fullbright.isEnabled()) + ISimpleOption.get(MC.options.getGamma()) + .forceSetValue(fullbright.getDefaultGamma()); } @Override public void onUpdate() { - @SuppressWarnings("unchecked") - ISimpleOption gammaOption = - (ISimpleOption)(Object)MC.options.getGamma(); - - gammaOption.forceSetValue(16.0); + // force gamma to 16 so that ores are bright enough to see + ISimpleOption.get(MC.options.getGamma()).forceSetValue(16.0); } @Override @@ -204,7 +164,8 @@ public void onGetAmbientOcclusionLightLevel( @Override public void onShouldDrawSide(ShouldDrawSideEvent event) { - event.setRendered(isVisible(event.getState().getBlock(), event.getPos())); + event.setRendered( + isVisible(event.getState().getBlock(), event.getPos())); } @Override @@ -222,43 +183,42 @@ public void onRenderBlockEntity(RenderBlockEntityEvent event) event.cancel(); } - public void openBlockListEditor(Screen prevScreen) - { - MC.setScreen(new EditBlockListScreen(prevScreen, ores)); - } - private boolean isVisible(Block block, BlockPos pos) { String name = BlockUtils.getName(block); - int index = Collections.binarySearch(oreNames, name); + int index = Collections.binarySearch(oreNamesCache, name); boolean visible = index >= 0; - - if (visible && showExposed.isChecked()) { - // TODO this only considers blocks with no hitbox - // shouldnt blocks like fences, vines be considered exposed? - // this works for most cases so its probably redundant... - return !BlockUtils.canBeClicked(pos.up()) - || !BlockUtils.canBeClicked(pos.down()) - || !BlockUtils.canBeClicked(pos.east()) - || !BlockUtils.canBeClicked(pos.west()) - || !BlockUtils.canBeClicked(pos.north()) - || !BlockUtils.canBeClicked(pos.south()); - - //return Collections.binarySearch(exposedNames, BlockUtils.getName(pos.up())) >= 0 - // || Collections.binarySearch(exposedNames, BlockUtils.getName(pos.down())) >= 0 - // || Collections.binarySearch(exposedNames, BlockUtils.getName(pos.east())) >= 0 - // || Collections.binarySearch(exposedNames, BlockUtils.getName(pos.west())) >= 0 - // || Collections.binarySearch(exposedNames, BlockUtils.getName(pos.north())) >= 0 - // || Collections.binarySearch(exposedNames, BlockUtils.getName(pos.south())) >= 0; - - //return EXPOSED_NEIGHBOUR_BLOCKS.contains(BlockUtils.getBlock(pos.up())) - // || EXPOSED_NEIGHBOUR_BLOCKS.contains(BlockUtils.getBlock(pos.down())) - // || EXPOSED_NEIGHBOUR_BLOCKS.contains(BlockUtils.getBlock(pos.east())) - // || EXPOSED_NEIGHBOUR_BLOCKS.contains(BlockUtils.getBlock(pos.west())) - // || EXPOSED_NEIGHBOUR_BLOCKS.contains(BlockUtils.getBlock(pos.north())) - // || EXPOSED_NEIGHBOUR_BLOCKS.contains(BlockUtils.getBlock(pos.south())); - } - + + if(visible && onlyExposed.isChecked()) + return !BlockUtils.isOpaqueFullCube(pos.up()) + || !BlockUtils.isOpaqueFullCube(pos.down()) + || !BlockUtils.isOpaqueFullCube(pos.east()) + || !BlockUtils.isOpaqueFullCube(pos.west()) + || !BlockUtils.isOpaqueFullCube(pos.north()) + || !BlockUtils.isOpaqueFullCube(pos.south()); + return visible; } + + /** + * Checks if OptiFine/OptiFabric is installed and returns a warning message + * if it is. + */ + private String checkOptiFine() + { + Stream mods = FabricLoader.getInstance().getAllMods().stream() + .map(ModContainer::getMetadata).map(ModMetadata::getId); + + Pattern optifine = Pattern.compile("opti(?:fine|fabric).*"); + + if(mods.anyMatch(optifine.asPredicate())) + return "OptiFine is installed. X-Ray will not work properly!"; + + return null; + } + + public void openBlockListEditor(Screen prevScreen) + { + MC.setScreen(new EditBlockListScreen(prevScreen, ores)); + } } diff --git a/src/main/java/net/wurstclient/mixin/BlockMixin.java b/src/main/java/net/wurstclient/mixin/BlockMixin.java index 9d9b8f46b0..ca1c5ad976 100644 --- a/src/main/java/net/wurstclient/mixin/BlockMixin.java +++ b/src/main/java/net/wurstclient/mixin/BlockMixin.java @@ -26,9 +26,8 @@ @Mixin(Block.class) public abstract class BlockMixin implements ItemConvertible { - @Inject(at = {@At("HEAD")}, - method = { - "shouldDrawSide(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/Direction;Lnet/minecraft/util/math/BlockPos;)Z"}, + @Inject(at = @At("HEAD"), + method = "shouldDrawSide(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/Direction;Lnet/minecraft/util/math/BlockPos;)Z", cancellable = true) private static void onShouldDrawSide(BlockState state, BlockView world, BlockPos pos, Direction direction, BlockPos blockPos, @@ -41,8 +40,8 @@ private static void onShouldDrawSide(BlockState state, BlockView world, cir.setReturnValue(event.isRendered()); } - @Inject(at = {@At("HEAD")}, - method = {"getVelocityMultiplier()F"}, + @Inject(at = @At("HEAD"), + method = "getVelocityMultiplier()F", cancellable = true) private void onGetVelocityMultiplier(CallbackInfoReturnable cir) { diff --git a/src/main/java/net/wurstclient/mixin/BlockModelRendererMixin.java b/src/main/java/net/wurstclient/mixin/BlockModelRendererMixin.java index 87e8ff93c3..18ef1dafc4 100644 --- a/src/main/java/net/wurstclient/mixin/BlockModelRendererMixin.java +++ b/src/main/java/net/wurstclient/mixin/BlockModelRendererMixin.java @@ -28,7 +28,7 @@ @Mixin(BlockModelRenderer.class) public abstract class BlockModelRendererMixin { - @Inject(at = {@At("HEAD")}, + @Inject(at = @At("HEAD"), method = { "renderSmooth(Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/client/render/model/BakedModel;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;ZLnet/minecraft/util/math/random/Random;JI)V", "renderFlat(Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/client/render/model/BakedModel;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;ZLnet/minecraft/util/math/random/Random;JI)V"}, @@ -40,7 +40,7 @@ private void onRenderSmoothOrFlat(BlockRenderView world, BakedModel model, { TesselateBlockEvent event = new TesselateBlockEvent(state, pos); EventManager.fire(event); - + if(event.isCancelled()) { ci.cancel(); diff --git a/src/main/java/net/wurstclient/mixin/FluidRendererMixin.java b/src/main/java/net/wurstclient/mixin/FluidRendererMixin.java index 0b9f6a5f5d..b14a79e0f9 100644 --- a/src/main/java/net/wurstclient/mixin/FluidRendererMixin.java +++ b/src/main/java/net/wurstclient/mixin/FluidRendererMixin.java @@ -23,9 +23,8 @@ @Mixin(FluidRenderer.class) public class FluidRendererMixin { - @Inject(at = {@At("HEAD")}, - method = { - "isSideCovered(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/Direction;FLnet/minecraft/block/BlockState;)Z"}, + @Inject(at = @At("HEAD"), + method = "isSideCovered(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/Direction;FLnet/minecraft/block/BlockState;)Z", cancellable = true) private static void onIsSideCovered(BlockView blockView, BlockPos blockPos, Direction direction, float maxDeviation, BlockState blockState, diff --git a/src/main/java/net/wurstclient/mixin/SodiumBlockOcclusionCacheMixin.java b/src/main/java/net/wurstclient/mixin/SodiumBlockOcclusionCacheMixin.java index 2e4064769d..53fc13a97e 100644 --- a/src/main/java/net/wurstclient/mixin/SodiumBlockOcclusionCacheMixin.java +++ b/src/main/java/net/wurstclient/mixin/SodiumBlockOcclusionCacheMixin.java @@ -26,8 +26,8 @@ remap = false) public class SodiumBlockOcclusionCacheMixin { - @Inject(method = "shouldDrawSide", - at = @At("HEAD"), + @Inject(at = @At("HEAD"), + method = "shouldDrawSide", cancellable = true, remap = false) public void shouldDrawSide(BlockState state, BlockView view, BlockPos pos, diff --git a/src/main/java/net/wurstclient/mixin/TerrainRenderContextMixin.java b/src/main/java/net/wurstclient/mixin/TerrainRenderContextMixin.java index 2d1a283fb4..651978e6ec 100644 --- a/src/main/java/net/wurstclient/mixin/TerrainRenderContextMixin.java +++ b/src/main/java/net/wurstclient/mixin/TerrainRenderContextMixin.java @@ -39,7 +39,8 @@ public class TerrainRenderContextMixin private void onTessellateBlock(BlockState blockState, BlockPos blockPos, final BakedModel model, MatrixStack matrixStack, CallbackInfo ci) { - TesselateBlockEvent event = new TesselateBlockEvent(blockState, blockPos); + TesselateBlockEvent event = + new TesselateBlockEvent(blockState, blockPos); EventManager.fire(event); if(event.isCancelled()) diff --git a/src/main/java/net/wurstclient/mixinterface/ISimpleOption.java b/src/main/java/net/wurstclient/mixinterface/ISimpleOption.java index 3404dd8403..a117be6716 100644 --- a/src/main/java/net/wurstclient/mixinterface/ISimpleOption.java +++ b/src/main/java/net/wurstclient/mixinterface/ISimpleOption.java @@ -7,7 +7,23 @@ */ package net.wurstclient.mixinterface; +import net.minecraft.client.option.SimpleOption; + public interface ISimpleOption { + /** + * Forces the value of the option to the specified value, even if it's + * outside of the normal range. + */ public void forceSetValue(T newValue); + + /** + * Returns the given SimpleOption object as an ISimpleOption, allowing you + * to access the forceSetValue() method. + */ + @SuppressWarnings("unchecked") + public static ISimpleOption get(SimpleOption option) + { + return (ISimpleOption)(Object)option; + } } diff --git a/src/main/java/net/wurstclient/settings/BlockListSetting.java b/src/main/java/net/wurstclient/settings/BlockListSetting.java index e921a0f4e3..afc3d329d3 100644 --- a/src/main/java/net/wurstclient/settings/BlockListSetting.java +++ b/src/main/java/net/wurstclient/settings/BlockListSetting.java @@ -33,8 +33,6 @@ public final class BlockListSetting extends Setting { - // TODO blocks which cannot be visually represented as items default to 'unknown', - // ie water, air, lava, nether_portal, end_portal, ... private final ArrayList blockNames = new ArrayList<>(); private final String[] defaultNames; diff --git a/src/main/java/net/wurstclient/util/BlockUtils.java b/src/main/java/net/wurstclient/util/BlockUtils.java index 1e830f23d8..139b0a6c66 100644 --- a/src/main/java/net/wurstclient/util/BlockUtils.java +++ b/src/main/java/net/wurstclient/util/BlockUtils.java @@ -120,6 +120,11 @@ public static boolean canBeClicked(BlockPos pos) return getOutlineShape(pos) != VoxelShapes.empty(); } + public static boolean isOpaqueFullCube(BlockPos pos) + { + return getState(pos).isOpaqueFullCube(MC.world, pos); + } + public static ArrayList getAllInBox(BlockPos from, BlockPos to) { ArrayList blocks = new ArrayList<>(); From bb996fdfc956352f572da38d560fc4111b21b9c7 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Fri, 11 Aug 2023 18:31:48 +0200 Subject: [PATCH 171/282] Fix block- and item-related settings not rendering correctly --- src/main/java/net/wurstclient/clickgui/ClickGui.java | 2 +- .../clickgui/screens/EditBlockListScreen.java | 3 +++ .../wurstclient/clickgui/screens/EditBlockScreen.java | 11 +++-------- .../clickgui/screens/EditItemListScreen.java | 11 +++++++---- src/main/java/net/wurstclient/util/RenderUtils.java | 6 ++---- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/main/java/net/wurstclient/clickgui/ClickGui.java b/src/main/java/net/wurstclient/clickgui/ClickGui.java index f8909149dc..76493e9670 100644 --- a/src/main/java/net/wurstclient/clickgui/ClickGui.java +++ b/src/main/java/net/wurstclient/clickgui/ClickGui.java @@ -530,7 +530,6 @@ public void renderPopups(DrawContext context, int mouseX, int mouseY) public void renderTooltip(DrawContext context, int mouseX, int mouseY) { MatrixStack matrixStack = context.getMatrices(); - Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Tessellator tessellator = RenderSystem.renderThreadTesselator(); BufferBuilder bufferBuilder = tessellator.getBuffer(); @@ -558,6 +557,7 @@ public void renderTooltip(DrawContext context, int mouseX, int mouseY) matrixStack.push(); matrixStack.translate(0, 0, 300); + Matrix4f matrix = matrixStack.peek().getPositionMatrix(); RenderSystem.setShader(GameRenderer::getPositionProgram); diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditBlockListScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditBlockListScreen.java index 03767f4b89..b340813267 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditBlockListScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditBlockListScreen.java @@ -177,6 +177,7 @@ public void render(DrawContext context, int mouseX, int mouseY, blockNameField.render(context, mouseX, mouseY, partialTicks); super.render(context, mouseX, mouseY, partialTicks); + matrixStack.push(); matrixStack.translate(-64 + width / 2 - 152, 0, 0); if(blockNameField.getText().isEmpty() && !blockNameField.isFocused()) @@ -201,6 +202,8 @@ public void render(DrawContext context, int mouseX, int mouseY, RenderUtils.drawItem(context, blockToAdd == null ? ItemStack.EMPTY : new ItemStack(blockToAdd), width / 2 - 164, height - 52, false); + + matrixStack.pop(); } @Override diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditBlockScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditBlockScreen.java index 15ba477551..f5e223dfbe 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditBlockScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditBlockScreen.java @@ -126,14 +126,9 @@ public void render(DrawContext context, int mouseX, int mouseY, int black = 0xff000000; context.fill(48, -56, 64, -36, border); - context.fill(49, -55, 64, -37, black); - context.fill(214, -56, 244, -55, border); - context.fill(214, -37, 244, -36, border); - context.fill(244, -56, 246, -36, border); - context.fill(214, -55, 243, -52, black); - context.fill(214, -40, 243, -37, black); - context.fill(215, -55, 216, -37, black); - context.fill(242, -55, 245, -37, black); + context.fill(49, -55, 65, -37, black); + context.fill(242, -56, 246, -36, border); + context.fill(241, -55, 245, -37, black); matrixStack.pop(); diff --git a/src/main/java/net/wurstclient/clickgui/screens/EditItemListScreen.java b/src/main/java/net/wurstclient/clickgui/screens/EditItemListScreen.java index be3fafc58a..f49027dd75 100644 --- a/src/main/java/net/wurstclient/clickgui/screens/EditItemListScreen.java +++ b/src/main/java/net/wurstclient/clickgui/screens/EditItemListScreen.java @@ -179,6 +179,7 @@ public void render(DrawContext context, int mouseX, int mouseY, itemNameField.render(context, mouseX, mouseY, partialTicks); super.render(context, mouseX, mouseY, partialTicks); + matrixStack.push(); matrixStack.translate(-64 + width / 2 - 152, 0, 0); if(itemNameField.getText().isEmpty() && !itemNameField.isFocused()) @@ -194,13 +195,13 @@ public void render(DrawContext context, int mouseX, int mouseY, int black = 0xff000000; context.fill(48, height - 56, 64, height - 36, border); - context.fill(49, height - 55, 64, height - 37, black); + context.fill(49, height - 55, 65, height - 37, black); context.fill(214, height - 56, 244, height - 55, border); context.fill(214, height - 37, 244, height - 36, border); context.fill(244, height - 56, 246, height - 36, border); - context.fill(214, height - 55, 243, height - 52, black); - context.fill(214, height - 40, 243, height - 37, black); - context.fill(215, height - 55, 216, height - 37, black); + context.fill(213, height - 55, 243, height - 52, black); + context.fill(213, height - 40, 243, height - 37, black); + context.fill(213, height - 55, 216, height - 37, black); context.fill(242, height - 55, 245, height - 37, black); matrixStack.pop(); @@ -208,6 +209,8 @@ public void render(DrawContext context, int mouseX, int mouseY, RenderUtils.drawItem(context, itemToAdd == null ? ItemStack.EMPTY : new ItemStack(itemToAdd), width / 2 - 164, height - 52, false); + + matrixStack.pop(); } @Override diff --git a/src/main/java/net/wurstclient/util/RenderUtils.java b/src/main/java/net/wurstclient/util/RenderUtils.java index 23300853df..e58288cb42 100644 --- a/src/main/java/net/wurstclient/util/RenderUtils.java +++ b/src/main/java/net/wurstclient/util/RenderUtils.java @@ -898,14 +898,12 @@ public static void drawItem(DrawContext context, ItemStack stack, int x, if(stack.isEmpty()) { matrixStack.push(); - matrixStack.translate(x, y, 0); + matrixStack.translate(x, y, 250); if(large) matrixStack.scale(2, 2, 2); - GL11.glDisable(GL11.GL_DEPTH_TEST); TextRenderer tr = WurstClient.MC.textRenderer; - context.drawText(tr, "?", 3, 2, 0xf0f0f0, false); - GL11.glEnable(GL11.GL_DEPTH_TEST); + context.drawText(tr, "?", 3, 2, 0xf0f0f0, true); matrixStack.pop(); } From f3ee912903724cde7a5717312cccebd39cacb9dc Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Thu, 17 Aug 2023 22:22:35 +0200 Subject: [PATCH 172/282] Update Fabric stuff --- gradle.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 1acb75bb53..de96450bbb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,11 +6,11 @@ org.gradle.parallel=true # check these at https://fabricmc.net/develop/ and # https://www.curseforge.com/minecraft/mc-mods/fabric-api minecraft_version=1.20.1 -yarn_mappings=1.20.1+build.9 -loader_version=0.14.21 +yarn_mappings=1.20.1+build.10 +loader_version=0.14.22 #Fabric api -fabric_version=0.85.0+1.20.1 +fabric_version=0.87.0+1.20.1 # Mod Properties mod_version = v7.36-MC1.20.1 From 32fef7a4a573a4a52e20d2856a5266354625f9ec Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Thu, 17 Aug 2023 22:34:22 +0200 Subject: [PATCH 173/282] Change version to 7.37 --- gradle.properties | 2 +- src/main/java/net/wurstclient/WurstClient.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index de96450bbb..3e7ea898b3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ loader_version=0.14.22 fabric_version=0.87.0+1.20.1 # Mod Properties -mod_version = v7.36-MC1.20.1 +mod_version = v7.37-MC1.20.1 maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index 4aa6b458c7..4953761b65 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 MinecraftClient MC; public static IMinecraftClient IMC; - public static final String VERSION = "7.36"; + public static final String VERSION = "7.37"; public static final String MC_VERSION = "1.20.1"; private WurstAnalytics analytics; From fe635860334e9912ab5c88fb3cdb632f439d60a6 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Thu, 17 Aug 2023 22:37:33 +0200 Subject: [PATCH 174/282] Re-add the old mixin target so old versions of Sodium don't stop working --- .../wurstclient/mixin/SodiumBlockOcclusionCacheMixin.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/wurstclient/mixin/SodiumBlockOcclusionCacheMixin.java b/src/main/java/net/wurstclient/mixin/SodiumBlockOcclusionCacheMixin.java index 53fc13a97e..44e64d9af0 100644 --- a/src/main/java/net/wurstclient/mixin/SodiumBlockOcclusionCacheMixin.java +++ b/src/main/java/net/wurstclient/mixin/SodiumBlockOcclusionCacheMixin.java @@ -21,8 +21,9 @@ import net.wurstclient.events.ShouldDrawSideListener; @Pseudo -@Mixin( - targets = "me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.BlockOcclusionCache", +@Mixin(targets = { + "me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.BlockOcclusionCache", + "me.jellysquid.mods.sodium.client.render.occlusion.BlockOcclusionCache"}, remap = false) public class SodiumBlockOcclusionCacheMixin { From f1c60e487da3077d8fce649c8632bd6bfb94404e Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Thu, 17 Aug 2023 23:03:08 +0200 Subject: [PATCH 175/282] Update minimum required versions --- src/main/resources/fabric.mod.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 456d1aaa8c..6506dcee0b 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -29,9 +29,9 @@ "accessWidener" : "wurst.accesswidener", "depends": { - "fabricloader": ">=0.14.19", - "fabric-api": ">=0.81.2", - "minecraft": "~1.20-beta.2", + "fabricloader": ">=0.14.22", + "fabric-api": ">=0.86.2", + "minecraft": "~1.20.2-alpha.23.32.a", "java": ">=17" }, "suggests": { From d897463b012aa9b4263eae668e939043344137bc Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Thu, 17 Aug 2023 23:11:47 +0200 Subject: [PATCH 176/282] Update Fabric stuff --- gradle.properties | 4 ++-- src/main/java/net/wurstclient/mixin/MinecraftClientMixin.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 9a19ab7571..3c3309693b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,11 +6,11 @@ org.gradle.parallel=true # check these at https://fabricmc.net/develop/ and # https://www.curseforge.com/minecraft/mc-mods/fabric-api minecraft_version=23w32a -yarn_mappings=23w32a+build.3 +yarn_mappings=23w32a+build.11 loader_version=0.14.22 #Fabric api -fabric_version=0.86.2+1.20.2 +fabric_version=0.87.1+1.20.2 # Mod Properties mod_version = v7.37-MC23w32a diff --git a/src/main/java/net/wurstclient/mixin/MinecraftClientMixin.java b/src/main/java/net/wurstclient/mixin/MinecraftClientMixin.java index 48a1558925..52c05f23a2 100644 --- a/src/main/java/net/wurstclient/mixin/MinecraftClientMixin.java +++ b/src/main/java/net/wurstclient/mixin/MinecraftClientMixin.java @@ -134,9 +134,9 @@ private void onGetSession(CallbackInfoReturnable cir) } @Inject(at = @At("RETURN"), - method = "method_53462()Lcom/mojang/authlib/GameProfile;", + method = "getGameProfile()Lcom/mojang/authlib/GameProfile;", cancellable = true) - public void onMethod_53462(CallbackInfoReturnable cir) + public void onGetGameProfile(CallbackInfoReturnable cir) { if(wurstSession == null) return; From 15c6e944d2f669b684c63d8c42c7e2ee156c90a5 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Thu, 17 Aug 2023 23:21:45 +0200 Subject: [PATCH 177/282] [Wurst-Bot] Update to 23w33a --- gradle.properties | 6 +++--- src/main/java/net/wurstclient/WurstClient.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 3c3309693b..b26c86523f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,15 +5,15 @@ org.gradle.parallel=true # Fabric Properties # check these at https://fabricmc.net/develop/ and # https://www.curseforge.com/minecraft/mc-mods/fabric-api -minecraft_version=23w32a -yarn_mappings=23w32a+build.11 +minecraft_version=23w33a +yarn_mappings=23w33a+build.1 loader_version=0.14.22 #Fabric api fabric_version=0.87.1+1.20.2 # Mod Properties -mod_version = v7.37-MC23w32a +mod_version = v7.37-MC23w33a maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index 07a4ce7cd9..78ac525952 100644 --- a/src/main/java/net/wurstclient/WurstClient.java +++ b/src/main/java/net/wurstclient/WurstClient.java @@ -57,7 +57,7 @@ public enum WurstClient public static IMinecraftClient IMC; public static final String VERSION = "7.37"; - public static final String MC_VERSION = "23w32a"; + public static final String MC_VERSION = "23w33a"; private WurstAnalytics analytics; private EventManager eventManager; From 7e1a654d36b0311cbc168bc506e1c8fb6755b7cd Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Thu, 17 Aug 2023 23:41:06 +0200 Subject: [PATCH 178/282] Update to 23w33a --- src/main/java/net/wurstclient/mixin/IngameHudMixin.java | 9 ++++++++- src/main/resources/fabric.mod.json | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/wurstclient/mixin/IngameHudMixin.java b/src/main/java/net/wurstclient/mixin/IngameHudMixin.java index 76457ac4c6..b944e5c57c 100644 --- a/src/main/java/net/wurstclient/mixin/IngameHudMixin.java +++ b/src/main/java/net/wurstclient/mixin/IngameHudMixin.java @@ -7,12 +7,15 @@ */ package net.wurstclient.mixin; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.hud.DebugHud; import net.minecraft.client.gui.hud.InGameHud; import net.minecraft.util.Identifier; import net.wurstclient.WurstClient; @@ -22,6 +25,10 @@ @Mixin(InGameHud.class) public class IngameHudMixin { + @Shadow + @Final + private DebugHud debugHud; + @Inject( at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;enableBlend()V", @@ -31,7 +38,7 @@ public class IngameHudMixin private void onRender(DrawContext context, float partialTicks, CallbackInfo ci) { - if(WurstClient.MC.options.debugEnabled) + if(debugHud.method_53536()) return; GUIRenderEvent event = new GUIRenderEvent(context, partialTicks); diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 6506dcee0b..a8b9c14388 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -30,8 +30,8 @@ "depends": { "fabricloader": ">=0.14.22", - "fabric-api": ">=0.86.2", - "minecraft": "~1.20.2-alpha.23.32.a", + "fabric-api": ">=0.87.1", + "minecraft": "~1.20.2-alpha.23.33.a", "java": ">=17" }, "suggests": { From 7849a1ded45a340c3fdc2a56b421a14c265fae61 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Fri, 1 Sep 2023 16:59:41 +0200 Subject: [PATCH 179/282] [Wurst-Bot] Update to 23w35a --- gradle.properties | 8 ++++---- src/main/java/net/wurstclient/WurstClient.java | 2 +- src/main/java/net/wurstclient/mixin/IngameHudMixin.java | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gradle.properties b/gradle.properties index b26c86523f..8cee1a9149 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,15 +5,15 @@ org.gradle.parallel=true # Fabric Properties # check these at https://fabricmc.net/develop/ and # https://www.curseforge.com/minecraft/mc-mods/fabric-api -minecraft_version=23w33a -yarn_mappings=23w33a+build.1 +minecraft_version=23w35a +yarn_mappings=23w35a+build.8 loader_version=0.14.22 #Fabric api -fabric_version=0.87.1+1.20.2 +fabric_version=0.87.2+1.20.2 # Mod Properties -mod_version = v7.37-MC23w33a +mod_version = v7.37-MC23w35a maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index 78ac525952..0c7fd2a3a6 100644 --- a/src/main/java/net/wurstclient/WurstClient.java +++ b/src/main/java/net/wurstclient/WurstClient.java @@ -57,7 +57,7 @@ public enum WurstClient public static IMinecraftClient IMC; public static final String VERSION = "7.37"; - public static final String MC_VERSION = "23w33a"; + public static final String MC_VERSION = "23w35a"; private WurstAnalytics analytics; private EventManager eventManager; diff --git a/src/main/java/net/wurstclient/mixin/IngameHudMixin.java b/src/main/java/net/wurstclient/mixin/IngameHudMixin.java index b944e5c57c..af97cfc456 100644 --- a/src/main/java/net/wurstclient/mixin/IngameHudMixin.java +++ b/src/main/java/net/wurstclient/mixin/IngameHudMixin.java @@ -38,7 +38,7 @@ public class IngameHudMixin private void onRender(DrawContext context, float partialTicks, CallbackInfo ci) { - if(debugHud.method_53536()) + if(debugHud.shouldShowDebugHud()) return; GUIRenderEvent event = new GUIRenderEvent(context, partialTicks); From 4270be693bce68206313f010d6828f75e14b368a Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Fri, 1 Sep 2023 17:15:40 +0200 Subject: [PATCH 180/282] Update to 23w35a --- src/main/resources/fabric.mod.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index a8b9c14388..f0d21be067 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -30,8 +30,8 @@ "depends": { "fabricloader": ">=0.14.22", - "fabric-api": ">=0.87.1", - "minecraft": "~1.20.2-alpha.23.33.a", + "fabric-api": ">=0.87.2", + "minecraft": "~1.20.2-alpha.23.35.a", "java": ">=17" }, "suggests": { From eda306bbd0784035b37e44bcdffe2109f65bb0d3 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Fri, 1 Sep 2023 17:47:27 +0200 Subject: [PATCH 181/282] Fix ".toomanyhax list-profiles" not working correctly --- src/main/java/net/wurstclient/commands/TooManyHaxCmd.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/wurstclient/commands/TooManyHaxCmd.java b/src/main/java/net/wurstclient/commands/TooManyHaxCmd.java index 607e8d72d5..860a07c3a9 100644 --- a/src/main/java/net/wurstclient/commands/TooManyHaxCmd.java +++ b/src/main/java/net/wurstclient/commands/TooManyHaxCmd.java @@ -269,7 +269,7 @@ private void listProfiles(String[] args) throws CmdException if(args.length > 2) throw new CmdSyntaxError(); - ArrayList files = WURST.getKeybinds().listProfiles(); + ArrayList files = WURST.getHax().tooManyHaxHack.listProfiles(); int page = parsePage(args); int pages = (int)Math.ceil(files.size() / 8.0); pages = Math.max(pages, 1); From ef78f2e21c740c3dd36572aebd423a17f65ce9c3 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Mon, 4 Sep 2023 14:34:36 +0200 Subject: [PATCH 182/282] Move ESP style settings into a separate class --- .../net/wurstclient/hacks/ChestEspHack.java | 6 +- .../net/wurstclient/hacks/ItemEspHack.java | 34 ++--------- .../net/wurstclient/hacks/MobEspHack.java | 34 ++--------- .../net/wurstclient/hacks/PlayerEspHack.java | 36 +++-------- .../hacks/chestesp/ChestEspStyle.java | 42 ------------- .../wurstclient/settings/EspStyleSetting.java | 60 +++++++++++++++++++ 6 files changed, 79 insertions(+), 133 deletions(-) delete mode 100644 src/main/java/net/wurstclient/hacks/chestesp/ChestEspStyle.java create mode 100644 src/main/java/net/wurstclient/settings/EspStyleSetting.java diff --git a/src/main/java/net/wurstclient/hacks/ChestEspHack.java b/src/main/java/net/wurstclient/hacks/ChestEspHack.java index d05158d635..cc2ec14d08 100644 --- a/src/main/java/net/wurstclient/hacks/ChestEspHack.java +++ b/src/main/java/net/wurstclient/hacks/ChestEspHack.java @@ -33,18 +33,16 @@ import net.wurstclient.hacks.chestesp.ChestEspEntityGroup; import net.wurstclient.hacks.chestesp.ChestEspGroup; import net.wurstclient.hacks.chestesp.ChestEspRenderer; -import net.wurstclient.hacks.chestesp.ChestEspStyle; import net.wurstclient.settings.CheckboxSetting; import net.wurstclient.settings.ColorSetting; -import net.wurstclient.settings.EnumSetting; +import net.wurstclient.settings.EspStyleSetting; import net.wurstclient.util.ChunkUtils; import net.wurstclient.util.RenderUtils; public class ChestEspHack extends Hack implements UpdateListener, CameraTransformViewBobbingListener, RenderListener { - private final EnumSetting style = - new EnumSetting<>("Style", ChestEspStyle.values(), ChestEspStyle.BOXES); + private final EspStyleSetting style = new EspStyleSetting(); private final ChestEspBlockGroup basicChests = new ChestEspBlockGroup( new ColorSetting("Chest color", diff --git a/src/main/java/net/wurstclient/hacks/ItemEspHack.java b/src/main/java/net/wurstclient/hacks/ItemEspHack.java index f464fed182..9b4fd798f2 100644 --- a/src/main/java/net/wurstclient/hacks/ItemEspHack.java +++ b/src/main/java/net/wurstclient/hacks/ItemEspHack.java @@ -34,6 +34,7 @@ import net.wurstclient.hack.Hack; import net.wurstclient.settings.ColorSetting; import net.wurstclient.settings.EnumSetting; +import net.wurstclient.settings.EspStyleSetting; import net.wurstclient.util.RenderUtils; import net.wurstclient.util.RotationUtils; @@ -41,8 +42,7 @@ public final class ItemEspHack extends Hack implements UpdateListener, CameraTransformViewBobbingListener, RenderListener { - private final EnumSetting