Skip to content

Commit

Permalink
Merge #743 (BarrierESP) into v7.39
Browse files Browse the repository at this point in the history
Closes #715
Closes #790
  • Loading branch information
Alexander01998 committed Nov 12, 2023
2 parents c82316c + 344b0db commit 10172e4
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/java/net/wurstclient/hack/HackList.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,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();
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/net/wurstclient/hacks/BarrierEspHack.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* 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.hack.Hack;

@SearchTags({"barrier esp"})
public class BarrierEspHack extends Hack
{
public BarrierEspHack()
{
super("BarrierESP");
setCategory(Category.RENDER);
}

// See ClientWorldMixin
}
51 changes: 51 additions & 0 deletions src/main/java/net/wurstclient/mixin/ClientWorldMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* 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.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.
*/
@Inject(at = @At("HEAD"),
method = "getBlockParticle()Lnet/minecraft/block/Block;",
cancellable = true)
private void onGetBlockParticle(CallbackInfoReturnable<Block> 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;

cir.setReturnValue(Blocks.BARRIER);
}
}
1 change: 1 addition & 0 deletions src/main/resources/assets/wurst/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "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.",
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/wurst.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"ClientPlayerEntityMixin",
"ClientPlayerInteractionManagerMixin",
"ClientPlayNetworkHandlerMixin",
"ClientWorldMixin",
"CreativeInventoryScreenMixin",
"DeathScreenMixin",
"DirectConnectScreenMixin",
Expand Down

0 comments on commit 10172e4

Please sign in to comment.