Skip to content

Commit 86ce26b

Browse files
committed
Safe Bounding Box Bug Fix
1 parent dceab3c commit 86ce26b

File tree

6 files changed

+156
-24
lines changed

6 files changed

+156
-24
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ I did not, nor could I copy their code directly as most are Meteor based mods. S
195195
- Adjustable search radius
196196
- Adjustable font size
197197
- Highlight open chests with X or an alternative color
198+
- Option to remove tracers for opened chests
198199

199200
![ChestSearch](https://i.imgur.com/OXuVeF5.png)
200201

@@ -601,6 +602,10 @@ Examples:
601602
- Can input sign text directly into ClickUI/Nagivator
602603
- Can now save and manage a list of presets
603604

605+
### HandNoClip Improved
606+
- Now shows a red X over your crosshair to remind you that you cannot place or interact with blocks (in front of you) while the hack is enabled
607+
- X is removed when using any combat weapon as they still function normally
608+
604609
### Keybind Manager Improved
605610
- Can now clear the entire keybinds instead of just resetting.
606611

@@ -621,6 +626,7 @@ Examples:
621626
- Search tracers now use block centers as fallback.
622627
- SignESP skips zero-size entries safely.
623628
- ChunkSearcher now snapshots each chunk’s block-state palettes on the client thread and lets the async scan read from that immutable copy, preventing the off-thread palette races that causes rare crashes.
629+
- Fixed rare empty outline shape crash (safe bounding box for empty shapes fix)
624630

625631
### Notes
626632
- Scanning only includes server-loaded chunks. Larger radii work best in single-player or on high view distance servers.

src/main/java/net/wurstclient/hacks/ChestEspHack.java

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454
public class ChestEspHack extends Hack implements UpdateListener,
5555
CameraTransformViewBobbingListener, RenderListener
5656
{
57+
private static final double OPENED_MARKER_THICKNESS = 2.0;
58+
5759
private final EspStyleSetting style = new EspStyleSetting();
5860
private final net.wurstclient.settings.CheckboxSetting stickyArea =
5961
new net.wurstclient.settings.CheckboxSetting("Sticky area",
@@ -434,7 +436,7 @@ private void renderBoxes(PoseStack matrixStack)
434436
for(AABB box : openedBoxes)
435437
{
436438
ChestSearchMarkerRenderer.drawMarker(matrixStack, box,
437-
csh.getMarkXColorARGB(), csh.getMarkXThickness(),
439+
csh.getMarkXColorARGB(), OPENED_MARKER_THICKNESS,
438440
false);
439441
}
440442
}
@@ -590,6 +592,33 @@ private void renderTracers(PoseStack matrixStack, float partialTicks)
590592
}catch(Throwable ignored)
591593
{}
592594

595+
ChestSearchHack csh = null;
596+
boolean hideOpenedTracers = false;
597+
if(!openedChests.isEmpty())
598+
{
599+
try
600+
{
601+
csh = net.wurstclient.WurstClient.INSTANCE
602+
.getHax().chestSearchHack;
603+
hideOpenedTracers =
604+
csh != null && csh.shouldHideOpenedChestTracers();
605+
}catch(Throwable ignored)
606+
{
607+
csh = null;
608+
hideOpenedTracers = false;
609+
}
610+
}
611+
612+
String curDimFull = null;
613+
String curDim = null;
614+
if(hideOpenedTracers)
615+
{
616+
curDimFull = MC.level == null ? "overworld"
617+
: MC.level.dimension().identifier().toString();
618+
curDim = MC.level == null ? "overworld"
619+
: MC.level.dimension().identifier().getPath();
620+
}
621+
593622
boolean applyEnvFilters =
594623
MC.level != null && (filterNearSpawners.isChecked()
595624
|| filterTrialChambers.isChecked()
@@ -640,7 +669,26 @@ private void renderTracers(PoseStack matrixStack, float partialTicks)
640669
if(boxes == null || boxes.isEmpty())
641670
continue;
642671

643-
List<Vec3> ends = boxes.stream().map(AABB::getCenter).toList();
672+
List<Vec3> ends;
673+
if(hideOpenedTracers)
674+
{
675+
java.util.ArrayList<Vec3> filtered =
676+
new java.util.ArrayList<>();
677+
for(AABB box : boxes)
678+
{
679+
if(isRecordedChest(box, curDimFull, curDim))
680+
continue;
681+
682+
filtered.add(box.getCenter());
683+
}
684+
if(filtered.isEmpty())
685+
continue;
686+
687+
ends = filtered;
688+
}else
689+
{
690+
ends = boxes.stream().map(AABB::getCenter).toList();
691+
}
644692
int color = group.getColorI(0x80);
645693

646694
RenderUtils.drawTracers(matrixStack, partialTicks, ends, color,

src/main/java/net/wurstclient/hacks/ChestSearchHack.java

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ public final class ChestSearchHack extends Hack
4646
new ColorSetting("ESP line", new java.awt.Color(0x22FF88));
4747
private final ColorSetting markXColor =
4848
new ColorSetting("Opened chest color", new java.awt.Color(0xFF9900));
49-
private final SliderSetting markXThickness =
50-
new SliderSetting("Opened chest line thickness", 2.0, 0.5, 6.0, 0.5,
51-
ValueDisplay.DECIMAL);
49+
private final CheckboxSetting hideOpenedChestTracers =
50+
new CheckboxSetting("Hide opened chest tracers",
51+
"Disable tracer lines for opened chests recorded by ChestSearch.",
52+
false);
5253
private final EnumSetting<OpenedChestMarker> openedChestMarker =
5354
new EnumSetting<>("Opened chest marker",
5455
"Choose how opened chests recorded by ChestSearch should be highlighted.",
@@ -84,8 +85,8 @@ public ChestSearchHack()
8485
addSetting(espLineColor);
8586
addSetting(markOpenedChest);
8687
addSetting(openedChestMarker);
88+
addSetting(hideOpenedChestTracers);
8789
addSetting(markXColor);
88-
addSetting(markXThickness);
8990
addSetting(recordedChestNotifications);
9091
}
9192

@@ -94,20 +95,14 @@ public int getMarkXColorARGB()
9495
return (0xFF << 24) | (markXColor.getColor().getRGB() & 0x00FFFFFF);
9596
}
9697

97-
public double getMarkXThickness()
98+
public boolean isMarkOpenedChest()
9899
{
99-
try
100-
{
101-
return markXThickness.getValue();
102-
}catch(Throwable t)
103-
{
104-
return 2.0;
105-
}
100+
return markOpenedChest.isChecked();
106101
}
107102

108-
public boolean isMarkOpenedChest()
103+
public boolean shouldHideOpenedChestTracers()
109104
{
110-
return markOpenedChest.isChecked();
105+
return hideOpenedChestTracers.isChecked();
111106
}
112107

113108
public OpenedChestMarker getOpenedChestMarker()

src/main/java/net/wurstclient/hacks/HandNoClipHack.java

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,31 @@
77
*/
88
package net.wurstclient.hacks;
99

10+
import net.minecraft.client.gui.GuiGraphics;
11+
import net.minecraft.core.registries.BuiltInRegistries;
12+
import net.minecraft.resources.Identifier;
1013
import net.minecraft.core.BlockPos;
14+
import net.minecraft.tags.ItemTags;
15+
import net.minecraft.world.item.BowItem;
16+
import net.minecraft.world.item.CrossbowItem;
17+
import net.minecraft.world.item.Item;
18+
import net.minecraft.world.item.ItemStack;
19+
import net.minecraft.world.item.MaceItem;
20+
import net.minecraft.world.item.TridentItem;
21+
import java.util.Locale;
1122
import net.wurstclient.Category;
1223
import net.wurstclient.SearchTags;
24+
import net.wurstclient.events.GUIRenderListener;
1325
import net.wurstclient.hack.Hack;
1426
import net.wurstclient.settings.BlockListSetting;
1527
import net.wurstclient.util.BlockUtils;
1628

1729
@SearchTags({"hand noclip", "hand no clip"})
18-
public final class HandNoClipHack extends Hack
30+
public final class HandNoClipHack extends Hack implements GUIRenderListener
1931
{
32+
private static final int WARNING_COLOR = 0xFFFF0000;
33+
private static final int WARNING_SIZE = 5;
34+
2035
private final BlockListSetting blocks = new BlockListSetting("Blocks",
2136
"The blocks you want to reach through walls.", "minecraft:barrel",
2237
"minecraft:black_shulker_box", "minecraft:blue_shulker_box",
@@ -40,10 +55,73 @@ public HandNoClipHack()
4055
addSetting(blocks);
4156
}
4257

58+
@Override
59+
protected void onEnable()
60+
{
61+
EVENTS.add(GUIRenderListener.class, this);
62+
}
63+
64+
@Override
65+
protected void onDisable()
66+
{
67+
EVENTS.remove(GUIRenderListener.class, this);
68+
}
69+
4370
public boolean isBlockInList(BlockPos pos)
4471
{
4572
return blocks.matchesBlock(BlockUtils.getBlock(pos));
4673
}
4774

75+
@Override
76+
public void onRenderGUI(GuiGraphics context, float partialTicks)
77+
{
78+
if(MC.player == null || isHoldingCombatWeapon())
79+
return;
80+
81+
drawWarningCrosshair(context);
82+
}
83+
84+
private boolean isHoldingCombatWeapon()
85+
{
86+
ItemStack stack = MC.player.getInventory().getSelectedItem();
87+
if(stack == null || stack.isEmpty())
88+
return false;
89+
90+
Item item = stack.getItem();
91+
return stack.is(ItemTags.SWORDS) || stack.is(ItemTags.AXES)
92+
|| item instanceof MaceItem || item instanceof TridentItem
93+
|| item instanceof BowItem || item instanceof CrossbowItem
94+
|| isSpearItem(item);
95+
}
96+
97+
private boolean isSpearItem(Item item)
98+
{
99+
if(item == null)
100+
return false;
101+
102+
Identifier id = BuiltInRegistries.ITEM.getKey(item);
103+
if(id == null)
104+
return false;
105+
106+
return id.getPath().toLowerCase(Locale.ROOT).contains("spear");
107+
}
108+
109+
private void drawWarningCrosshair(GuiGraphics context)
110+
{
111+
int centerX = context.guiWidth() / 2;
112+
int centerY = context.guiHeight() / 2;
113+
114+
for(int i = -WARNING_SIZE; i <= WARNING_SIZE; i++)
115+
{
116+
int x1 = centerX + i;
117+
int y1 = centerY + i;
118+
context.fill(x1, y1, x1 + 1, y1 + 1, WARNING_COLOR);
119+
120+
int x2 = centerX + i;
121+
int y2 = centerY - i;
122+
context.fill(x2, y2, x2 + 1, y2 + 1, WARNING_COLOR);
123+
}
124+
}
125+
48126
// See AbstractBlockStateMixin.onGetOutlineShape()
49127
}

src/main/java/net/wurstclient/nicewurst/NiceWurstModule.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,15 @@ public final class NiceWurstModule
9797
"LavaWaterESP", "LogoutSpots", "MobESP", "MobSearch",
9898
"MobSpawnESP", "NewChunks", "NoBackground", "NoFireOverlay",
9999
"NoVignette", "NoWeather", "Freecam", "OpenWaterESP",
100-
"PlayerESP", "PortalESP", "Radar", "Search", "TrialSpawnerESP",
101-
"TridentESP", "Waypoints"));
100+
"PearlESP", "PlayerESP", "PortalESP", "Radar", "Search",
101+
"TrialSpawnerESP", "TridentESP", "Waypoints"));
102102

103103
ALLOWED_HACKS.put(Category.OTHER,
104-
Set.of("AntiAFK", "Antisocial", "AutoFish", "AutoLibrarian",
105-
"AutoReconnect", "AutoTrader", "CheatDetector", "ClickGUI",
106-
"FeedAura", "Navigator", "Panic", "PortalGUI", "SafeTP",
107-
"SeedMapperHelper", "TooManyHax"));
104+
Set.of("AntiAFK", "Antisocial", "AntiCheatDetect", "AutoFish",
105+
"AutoLibrarian", "AutoReconnect", "AutoTrader", "CheatDetector",
106+
"ClickGUI", "FeedAura", "Navigator", "LivestreamDetector",
107+
"Panic", "PortalGUI", "SafeTP", "SeedMapperHelper",
108+
"TooManyHax"));
108109

109110
ALLOWED_HACKS.put(Category.ITEMS,
110111
Set.of("AntiDrop", "AutoDisenchant", "AutoDrop", "AutoEat",

src/main/java/net/wurstclient/util/BlockUtils.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,11 @@ private static VoxelShape getOutlineShape(BlockPos pos)
128128

129129
public static AABB getBoundingBox(BlockPos pos)
130130
{
131-
return getOutlineShape(pos).bounds().move(pos);
131+
VoxelShape shape = getOutlineShape(pos);
132+
if(shape.isEmpty())
133+
return new AABB(pos);
134+
135+
return shape.bounds().move(pos);
132136
}
133137

134138
public static boolean canBeClicked(BlockPos pos)

0 commit comments

Comments
 (0)