From b2ce045bb010e100188fe4f50d4c1093ba53674c Mon Sep 17 00:00:00 2001 From: BotiPro2007 Date: Thu, 24 Nov 2022 23:10:37 +0100 Subject: [PATCH 1/8] BarrierEsp --- .../net/wurstclient/hack/BarrierEspHack.java | 9 ++++++++ .../java/net/wurstclient/hack/HackList.java | 1 + .../wurstclient/mixin/ClientWorldMixin.java | 23 +++++++++++++++++++ src/main/resources/wurst.mixins.json | 1 + 4 files changed, 34 insertions(+) create mode 100644 src/main/java/net/wurstclient/hack/BarrierEspHack.java create mode 100644 src/main/java/net/wurstclient/mixin/ClientWorldMixin.java diff --git a/src/main/java/net/wurstclient/hack/BarrierEspHack.java b/src/main/java/net/wurstclient/hack/BarrierEspHack.java new file mode 100644 index 0000000000..b7241b28ae --- /dev/null +++ b/src/main/java/net/wurstclient/hack/BarrierEspHack.java @@ -0,0 +1,9 @@ +package net.wurstclient.hack; + +public class BarrierEspHack extends Hack { + + public BarrierEspHack() { + super("BarrierESP"); + } + +} diff --git a/src/main/java/net/wurstclient/hack/HackList.java b/src/main/java/net/wurstclient/hack/HackList.java index 74c8d9e723..88b827fea1 100644 --- a/src/main/java/net/wurstclient/hack/HackList.java +++ b/src/main/java/net/wurstclient/hack/HackList.java @@ -60,6 +60,7 @@ public final class HackList implements UpdateListener public final AutoToolHack autoToolHack = new AutoToolHack(); public final AutoTotemHack autoTotemHack = new AutoTotemHack(); public final AutoWalkHack autoWalkHack = new AutoWalkHack(); + public final BarrierEspHack barrierEspHack = new BarrierEspHack(); public final BaseFinderHack baseFinderHack = new BaseFinderHack(); public final BlinkHack blinkHack = new BlinkHack(); public final BoatFlyHack boatFlyHack = new BoatFlyHack(); diff --git a/src/main/java/net/wurstclient/mixin/ClientWorldMixin.java b/src/main/java/net/wurstclient/mixin/ClientWorldMixin.java new file mode 100644 index 0000000000..b24a462d49 --- /dev/null +++ b/src/main/java/net/wurstclient/mixin/ClientWorldMixin.java @@ -0,0 +1,23 @@ +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.CallbackInfoReturnable; + +import net.minecraft.block.Block; +import net.minecraft.block.Blocks; +import net.minecraft.client.world.ClientWorld; +import net.wurstclient.WurstClient; + +@Mixin(ClientWorld.class) +public class ClientWorldMixin{ + + @Inject(method="getBlockParticle()Lnet/minecraft/block/Block;", at=@At("HEAD"), cancellable=true) + private void getBlockParticle(CallbackInfoReturnable info) + { + if (WurstClient.INSTANCE.getHax().barrierEspHack.isEnabled()) { + info.setReturnValue(Blocks.BARRIER); + } + } +} diff --git a/src/main/resources/wurst.mixins.json b/src/main/resources/wurst.mixins.json index 5ac95649a6..d997666d85 100644 --- a/src/main/resources/wurst.mixins.json +++ b/src/main/resources/wurst.mixins.json @@ -22,6 +22,7 @@ "ClientPlayerEntityMixin", "ClientPlayerInteractionManagerMixin", "ClientPlayNetworkHandlerMixin", + "ClientWorldMixin", "ContainerScreen54Mixin", "CustomPayloadC2SPacketAccessor", "DeathScreenMixin", From cff506705c92a5a70d9552f645269fa0dc80bba5 Mon Sep 17 00:00:00 2001 From: japankacsa01 <53174526+C0derK1d@users.noreply.github.com> Date: Mon, 6 Nov 2023 22:05:51 +0100 Subject: [PATCH 2/8] The location of the hack fixed and added description of the hack --- .../java/net/wurstclient/{hack => hacks}/BarrierEspHack.java | 4 +++- src/main/resources/assets/wurst/lang/en_us.json | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) rename src/main/java/net/wurstclient/{hack => hacks}/BarrierEspHack.java (56%) diff --git a/src/main/java/net/wurstclient/hack/BarrierEspHack.java b/src/main/java/net/wurstclient/hacks/BarrierEspHack.java similarity index 56% rename from src/main/java/net/wurstclient/hack/BarrierEspHack.java rename to src/main/java/net/wurstclient/hacks/BarrierEspHack.java index b7241b28ae..854a1bfbe8 100644 --- a/src/main/java/net/wurstclient/hack/BarrierEspHack.java +++ b/src/main/java/net/wurstclient/hacks/BarrierEspHack.java @@ -1,4 +1,6 @@ -package net.wurstclient.hack; +package net.wurstclient.hacks; + +import net.wurstclient.hack.Hack; public class BarrierEspHack extends Hack { diff --git a/src/main/resources/assets/wurst/lang/en_us.json b/src/main/resources/assets/wurst/lang/en_us.json index 69366c0f6f..2581fbc7aa 100644 --- a/src/main/resources/assets/wurst/lang/en_us.json +++ b/src/main/resources/assets/wurst/lang/en_us.json @@ -46,6 +46,7 @@ "description.wurst.hack.autotool": "Automatically equips the fastest applicable tool in your hotbar when you try to break a block.", "description.wurst.hack.autototem": "Automatically moves totems of undying to your off-hand.", "description.wurst.hack.autowalk": "Makes you walk automatically.", + "description.wurst.hack.barrieresp": "Indicates barrier blocks.", "description.wurst.hack.basefinder": "Finds player bases by searching for man-made blocks.\nThe blocks that it finds will be highlighted in the selected color.\nGood for finding faction bases.", "description.wurst.hack.blink": "Suspends all motion updates while enabled.", "description.wurst.hack.boatfly": "Allows you to fly with boats and other vehicles.\nPress the sprint key to go down faster.", From 15713e66883b0168f200b43d1d64af744541a869 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 12 Nov 2023 16:28:34 +0100 Subject: [PATCH 3/8] Clean up --- .../net/wurstclient/hacks/BarrierEspHack.java | 19 +++++++++++--- .../wurstclient/mixin/ClientWorldMixin.java | 25 +++++++++++++------ 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/src/main/java/net/wurstclient/hacks/BarrierEspHack.java b/src/main/java/net/wurstclient/hacks/BarrierEspHack.java index 854a1bfbe8..f810150389 100644 --- a/src/main/java/net/wurstclient/hacks/BarrierEspHack.java +++ b/src/main/java/net/wurstclient/hacks/BarrierEspHack.java @@ -1,11 +1,22 @@ +/* + * 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.SearchTags; import net.wurstclient.hack.Hack; -public class BarrierEspHack extends Hack { - - public BarrierEspHack() { +@SearchTags({"barrier esp"}) +public class BarrierEspHack extends Hack +{ + public BarrierEspHack() + { super("BarrierESP"); } - + + // See ClientWorldMixin } diff --git a/src/main/java/net/wurstclient/mixin/ClientWorldMixin.java b/src/main/java/net/wurstclient/mixin/ClientWorldMixin.java index b24a462d49..a9886ded83 100644 --- a/src/main/java/net/wurstclient/mixin/ClientWorldMixin.java +++ b/src/main/java/net/wurstclient/mixin/ClientWorldMixin.java @@ -1,3 +1,10 @@ +/* + * 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; @@ -11,13 +18,17 @@ import net.wurstclient.WurstClient; @Mixin(ClientWorld.class) -public class ClientWorldMixin{ - - @Inject(method="getBlockParticle()Lnet/minecraft/block/Block;", at=@At("HEAD"), cancellable=true) - private void getBlockParticle(CallbackInfoReturnable info) +public class ClientWorldMixin +{ + /** + * This is the part that makes BarrierESP work. + */ + @Inject(at = @At("HEAD"), + method = "getBlockParticle()Lnet/minecraft/block/Block;", + cancellable = true) + private void getBlockParticle(CallbackInfoReturnable cir) { - if (WurstClient.INSTANCE.getHax().barrierEspHack.isEnabled()) { - info.setReturnValue(Blocks.BARRIER); - } + if(WurstClient.INSTANCE.getHax().barrierEspHack.isEnabled()) + cir.setReturnValue(Blocks.BARRIER); } } From 05da53a808a8a483a6df21e7887812f49527fc81 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 12 Nov 2023 17:15:51 +0100 Subject: [PATCH 4/8] Fix BarrierESP making it impossible to see light blocks --- .../wurstclient/mixin/ClientWorldMixin.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/wurstclient/mixin/ClientWorldMixin.java b/src/main/java/net/wurstclient/mixin/ClientWorldMixin.java index a9886ded83..f3bb0764fb 100644 --- a/src/main/java/net/wurstclient/mixin/ClientWorldMixin.java +++ b/src/main/java/net/wurstclient/mixin/ClientWorldMixin.java @@ -7,19 +7,28 @@ */ 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.CallbackInfoReturnable; import net.minecraft.block.Block; import net.minecraft.block.Blocks; +import net.minecraft.client.MinecraftClient; import net.minecraft.client.world.ClientWorld; +import net.minecraft.item.Items; +import net.minecraft.world.GameMode; import net.wurstclient.WurstClient; @Mixin(ClientWorld.class) public class ClientWorldMixin { + @Shadow + @Final + private MinecraftClient client; + /** * This is the part that makes BarrierESP work. */ @@ -28,7 +37,13 @@ public class ClientWorldMixin cancellable = true) private void getBlockParticle(CallbackInfoReturnable cir) { - if(WurstClient.INSTANCE.getHax().barrierEspHack.isEnabled()) - cir.setReturnValue(Blocks.BARRIER); + if(!WurstClient.INSTANCE.getHax().barrierEspHack.isEnabled()) + return; + + if(client.interactionManager.getCurrentGameMode() == GameMode.CREATIVE + && client.player.getMainHandStack().getItem() == Items.LIGHT) + return; + + cir.setReturnValue(Blocks.BARRIER); } } From 616933a6d752f00b4f067a1a568470bf089f1eca Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 12 Nov 2023 17:28:35 +0100 Subject: [PATCH 5/8] Fix BarrierESP not having a category --- src/main/java/net/wurstclient/hacks/BarrierEspHack.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/net/wurstclient/hacks/BarrierEspHack.java b/src/main/java/net/wurstclient/hacks/BarrierEspHack.java index f810150389..184626e7b7 100644 --- a/src/main/java/net/wurstclient/hacks/BarrierEspHack.java +++ b/src/main/java/net/wurstclient/hacks/BarrierEspHack.java @@ -7,6 +7,7 @@ */ package net.wurstclient.hacks; +import net.wurstclient.Category; import net.wurstclient.SearchTags; import net.wurstclient.hack.Hack; @@ -16,6 +17,7 @@ public class BarrierEspHack extends Hack public BarrierEspHack() { super("BarrierESP"); + setCategory(Category.RENDER); } // See ClientWorldMixin From 81650c8b9233c6373bcd3266e16073f1de2b4e12 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 12 Nov 2023 17:39:39 +0100 Subject: [PATCH 6/8] Expand BarrierESP description --- src/main/resources/assets/wurst/lang/en_us.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/assets/wurst/lang/en_us.json b/src/main/resources/assets/wurst/lang/en_us.json index 2581fbc7aa..4ea7220891 100644 --- a/src/main/resources/assets/wurst/lang/en_us.json +++ b/src/main/resources/assets/wurst/lang/en_us.json @@ -46,7 +46,7 @@ "description.wurst.hack.autotool": "Automatically equips the fastest applicable tool in your hotbar when you try to break a block.", "description.wurst.hack.autototem": "Automatically moves totems of undying to your off-hand.", "description.wurst.hack.autowalk": "Makes you walk automatically.", - "description.wurst.hack.barrieresp": "Indicates barrier blocks.", + "description.wurst.hack.barrieresp": "Allows you to see nearby barrier blocks.\n\nNote: Due to Minecraft bug MC-47607, this hack does not work if your \"Particles\" option is set to \"Minimal\".", "description.wurst.hack.basefinder": "Finds player bases by searching for man-made blocks.\nThe blocks that it finds will be highlighted in the selected color.\nGood for finding faction bases.", "description.wurst.hack.blink": "Suspends all motion updates while enabled.", "description.wurst.hack.boatfly": "Allows you to fly with boats and other vehicles.\nPress the sprint key to go down faster.", From 959a2f498c3faba97f47e2ca30c51bb4ca89a378 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 12 Nov 2023 18:04:28 +0100 Subject: [PATCH 7/8] Add comment explaining the special case for light blocks --- src/main/java/net/wurstclient/mixin/ClientWorldMixin.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/wurstclient/mixin/ClientWorldMixin.java b/src/main/java/net/wurstclient/mixin/ClientWorldMixin.java index f3bb0764fb..372edd1b64 100644 --- a/src/main/java/net/wurstclient/mixin/ClientWorldMixin.java +++ b/src/main/java/net/wurstclient/mixin/ClientWorldMixin.java @@ -39,7 +39,9 @@ private void getBlockParticle(CallbackInfoReturnable cir) { if(!WurstClient.INSTANCE.getHax().barrierEspHack.isEnabled()) return; - + + // Pause BarrierESP when holding a light in Creative Mode, since it + // would otherwise prevent the player from seeing light blocks. if(client.interactionManager.getCurrentGameMode() == GameMode.CREATIVE && client.player.getMainHandStack().getItem() == Items.LIGHT) return; From 344b0db0d36bcb4c40d514cbb55b5dbfe5abcb27 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 12 Nov 2023 18:37:56 +0100 Subject: [PATCH 8/8] Fix name of getBlockParticle() mixin --- src/main/java/net/wurstclient/mixin/ClientWorldMixin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/wurstclient/mixin/ClientWorldMixin.java b/src/main/java/net/wurstclient/mixin/ClientWorldMixin.java index 372edd1b64..5a2c5171d9 100644 --- a/src/main/java/net/wurstclient/mixin/ClientWorldMixin.java +++ b/src/main/java/net/wurstclient/mixin/ClientWorldMixin.java @@ -35,7 +35,7 @@ public class ClientWorldMixin @Inject(at = @At("HEAD"), method = "getBlockParticle()Lnet/minecraft/block/Block;", cancellable = true) - private void getBlockParticle(CallbackInfoReturnable cir) + private void onGetBlockParticle(CallbackInfoReturnable cir) { if(!WurstClient.INSTANCE.getHax().barrierEspHack.isEnabled()) return;