Skip to content

Commit 70d6214

Browse files
committed
NiceWurst Fix
1 parent d6080eb commit 70d6214

File tree

4 files changed

+240
-136
lines changed

4 files changed

+240
-136
lines changed
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
/*
2+
* Copyright (c) 2014-2025 Wurst-Imperium and contributors.
3+
*
4+
* This source code is subject to the terms of the GNU General Public
5+
* License, version 3. If a copy of the GPL was not distributed with this
6+
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt
7+
*/
8+
package net.wurstclient.chestsearch;
9+
10+
import com.mojang.blaze3d.vertex.PoseStack;
11+
import com.mojang.blaze3d.vertex.VertexConsumer;
12+
import java.util.List;
13+
import net.minecraft.client.renderer.MultiBufferSource;
14+
import net.minecraft.client.renderer.RenderType;
15+
import net.minecraft.world.phys.AABB;
16+
import net.minecraft.world.phys.Vec3;
17+
import net.wurstclient.WurstRenderLayers;
18+
import net.wurstclient.util.RenderUtils;
19+
20+
public final class ChestSearchMarkerRenderer
21+
{
22+
private ChestSearchMarkerRenderer()
23+
{}
24+
25+
public static void drawMarker(PoseStack matrices, AABB box, int color,
26+
double thickness, boolean depthTest)
27+
{
28+
if(matrices == null || box == null)
29+
return;
30+
31+
MultiBufferSource.BufferSource vcp = RenderUtils.getVCP();
32+
RenderType layer = WurstRenderLayers.getLines(depthTest, thickness);
33+
VertexConsumer buffer = vcp.getBuffer(layer);
34+
drawMarker(matrices.last(), buffer,
35+
RenderUtils.getCameraPos().reverse(), box, color);
36+
vcp.endBatch(layer);
37+
}
38+
39+
public static void drawMarkers(PoseStack matrices, List<AABB> boxes,
40+
int color, double thickness, boolean depthTest)
41+
{
42+
if(matrices == null || boxes == null || boxes.isEmpty())
43+
return;
44+
45+
MultiBufferSource.BufferSource vcp = RenderUtils.getVCP();
46+
RenderType layer = WurstRenderLayers.getLines(depthTest, thickness);
47+
VertexConsumer buffer = vcp.getBuffer(layer);
48+
PoseStack.Pose entry = matrices.last();
49+
Vec3 offset = RenderUtils.getCameraPos().reverse();
50+
for(AABB box : boxes)
51+
{
52+
if(box == null)
53+
continue;
54+
drawMarker(entry, buffer, offset, box, color);
55+
}
56+
vcp.endBatch(layer);
57+
}
58+
59+
private static void drawMarker(PoseStack.Pose entry, VertexConsumer buffer,
60+
Vec3 offset, AABB box, int color)
61+
{
62+
double minX = box.minX;
63+
double maxX = box.maxX;
64+
double minY = box.minY;
65+
double maxY = box.maxY;
66+
double minZ = box.minZ;
67+
double maxZ = box.maxZ;
68+
double cx = (minX + maxX) / 2.0;
69+
double cy = (minY + maxY) / 2.0;
70+
double cz = (minZ + maxZ) / 2.0;
71+
72+
double halfX = (maxX - minX) / 2.0;
73+
double halfY = (maxY - minY) / 2.0;
74+
double halfZ = (maxZ - minZ) / 2.0;
75+
76+
Vec3 t1 = new Vec3(cx - halfX, maxY, cz).add(offset);
77+
Vec3 t2 = new Vec3(cx + halfX, maxY, cz).add(offset);
78+
Vec3 t3 = new Vec3(cx, maxY, cz - halfZ).add(offset);
79+
Vec3 t4 = new Vec3(cx, maxY, cz + halfZ).add(offset);
80+
RenderUtils.drawLine(entry, buffer, (float)t1.x, (float)t1.y,
81+
(float)t1.z, (float)t2.x, (float)t2.y, (float)t2.z, color);
82+
RenderUtils.drawLine(entry, buffer, (float)t3.x, (float)t3.y,
83+
(float)t3.z, (float)t4.x, (float)t4.y, (float)t4.z, color);
84+
85+
Vec3 b1 = new Vec3(cx - halfX, minY, cz).add(offset);
86+
Vec3 b2 = new Vec3(cx + halfX, minY, cz).add(offset);
87+
Vec3 b3 = new Vec3(cx, minY, cz - halfZ).add(offset);
88+
Vec3 b4 = new Vec3(cx, minY, cz + halfZ).add(offset);
89+
RenderUtils.drawLine(entry, buffer, (float)b1.x, (float)b1.y,
90+
(float)b1.z, (float)b2.x, (float)b2.y, (float)b2.z, color);
91+
RenderUtils.drawLine(entry, buffer, (float)b3.x, (float)b3.y,
92+
(float)b3.z, (float)b4.x, (float)b4.y, (float)b4.z, color);
93+
94+
Vec3 n1 = new Vec3(cx - halfX, cy, minZ).add(offset);
95+
Vec3 n2 = new Vec3(cx + halfX, cy, minZ).add(offset);
96+
Vec3 n3 = new Vec3(cx, cy - halfY, minZ).add(offset);
97+
Vec3 n4 = new Vec3(cx, cy + halfY, minZ).add(offset);
98+
RenderUtils.drawLine(entry, buffer, (float)n1.x, (float)n1.y,
99+
(float)n1.z, (float)n2.x, (float)n2.y, (float)n2.z, color);
100+
RenderUtils.drawLine(entry, buffer, (float)n3.x, (float)n3.y,
101+
(float)n3.z, (float)n4.x, (float)n4.y, (float)n4.z, color);
102+
103+
Vec3 s1 = new Vec3(cx - halfX, cy, maxZ).add(offset);
104+
Vec3 s2 = new Vec3(cx + halfX, cy, maxZ).add(offset);
105+
Vec3 s3 = new Vec3(cx, cy - halfY, maxZ).add(offset);
106+
Vec3 s4 = new Vec3(cx, cy + halfY, maxZ).add(offset);
107+
RenderUtils.drawLine(entry, buffer, (float)s1.x, (float)s1.y,
108+
(float)s1.z, (float)s2.x, (float)s2.y, (float)s2.z, color);
109+
RenderUtils.drawLine(entry, buffer, (float)s3.x, (float)s3.y,
110+
(float)s3.z, (float)s4.x, (float)s4.y, (float)s4.z, color);
111+
112+
Vec3 w1 = new Vec3(minX, cy, cz - halfZ).add(offset);
113+
Vec3 w2 = new Vec3(minX, cy, cz + halfZ).add(offset);
114+
Vec3 w3 = new Vec3(minX, cy - halfY, cz).add(offset);
115+
Vec3 w4 = new Vec3(minX, cy + halfY, cz).add(offset);
116+
RenderUtils.drawLine(entry, buffer, (float)w1.x, (float)w1.y,
117+
(float)w1.z, (float)w2.x, (float)w2.y, (float)w2.z, color);
118+
RenderUtils.drawLine(entry, buffer, (float)w3.x, (float)w3.y,
119+
(float)w3.z, (float)w4.x, (float)w4.y, (float)w4.z, color);
120+
121+
Vec3 e1 = new Vec3(maxX, cy, cz - halfZ).add(offset);
122+
Vec3 e2 = new Vec3(maxX, cy, cz + halfZ).add(offset);
123+
Vec3 e3 = new Vec3(maxX, cy - halfY, cz).add(offset);
124+
Vec3 e4 = new Vec3(maxX, cy + halfY, cz).add(offset);
125+
RenderUtils.drawLine(entry, buffer, (float)e1.x, (float)e1.y,
126+
(float)e1.z, (float)e2.x, (float)e2.y, (float)e2.z, color);
127+
RenderUtils.drawLine(entry, buffer, (float)e3.x, (float)e3.y,
128+
(float)e3.z, (float)e4.x, (float)e4.y, (float)e4.z, color);
129+
}
130+
}

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

Lines changed: 5 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,13 @@
1919
import net.wurstclient.hack.Hack;
2020
import net.wurstclient.hacks.chestesp.ChestEspGroup;
2121
import net.wurstclient.hacks.chestesp.ChestEspGroupManager;
22-
import net.wurstclient.chestsearch.ChestManager;
2322
import net.wurstclient.chestsearch.ChestEntry;
23+
import net.wurstclient.chestsearch.ChestManager;
24+
import net.wurstclient.chestsearch.ChestSearchMarkerRenderer;
2425
import net.wurstclient.settings.CheckboxSetting;
2526
import net.wurstclient.settings.EspStyleSetting;
2627
import net.wurstclient.settings.SliderSetting;
2728
import net.wurstclient.util.RenderUtils;
28-
import net.wurstclient.WurstRenderLayers;
29-
import com.mojang.blaze3d.vertex.VertexConsumer;
30-
import net.minecraft.client.renderer.MultiBufferSource;
31-
import net.minecraft.client.renderer.RenderType;
3229
import net.wurstclient.util.chunk.ChunkUtils;
3330

3431
public class ChestEspHack extends Hack implements UpdateListener,
@@ -221,131 +218,9 @@ private void renderBoxes(PoseStack matrixStack)
221218
}
222219
if(matched)
223220
{
224-
int markColor = csh.getMarkXColorARGB();
225-
double thickness = csh.getMarkXThickness();
226-
227-
// Prepare render buffer with custom line width
228-
MultiBufferSource.BufferSource vcp =
229-
RenderUtils.getVCP();
230-
RenderType layer =
231-
WurstRenderLayers.getLines(false, thickness);
232-
VertexConsumer buffer = vcp.getBuffer(layer);
233-
PoseStack.Pose entry = matrixStack.last();
234-
Vec3 offset = RenderUtils.getCameraPos().reverse();
235-
236-
// Draw plus signs (+) centered on each face of the
237-
// box
238-
double minX = box.minX;
239-
double maxX = box.maxX;
240-
double minY = box.minY;
241-
double maxY = box.maxY;
242-
double minZ = box.minZ;
243-
double maxZ = box.maxZ;
244-
double cx = (minX + maxX) / 2.0;
245-
double cy = (minY + maxY) / 2.0;
246-
double cz = (minZ + maxZ) / 2.0;
247-
248-
double halfX = (maxX - minX) / 2.0;
249-
double halfY = (maxY - minY) / 2.0;
250-
double halfZ = (maxZ - minZ) / 2.0;
251-
252-
// Top face (Y = maxY): lines along X and Z
253-
Vec3 t1 =
254-
new Vec3(cx - halfX, maxY, cz).add(offset);
255-
Vec3 t2 =
256-
new Vec3(cx + halfX, maxY, cz).add(offset);
257-
Vec3 t3 =
258-
new Vec3(cx, maxY, cz - halfZ).add(offset);
259-
Vec3 t4 =
260-
new Vec3(cx, maxY, cz + halfZ).add(offset);
261-
RenderUtils.drawLine(entry, buffer, (float)t1.x,
262-
(float)t1.y, (float)t1.z, (float)t2.x,
263-
(float)t2.y, (float)t2.z, markColor);
264-
RenderUtils.drawLine(entry, buffer, (float)t3.x,
265-
(float)t3.y, (float)t3.z, (float)t4.x,
266-
(float)t4.y, (float)t4.z, markColor);
267-
268-
// Bottom face (Y = minY)
269-
Vec3 b1 =
270-
new Vec3(cx - halfX, minY, cz).add(offset);
271-
Vec3 b2 =
272-
new Vec3(cx + halfX, minY, cz).add(offset);
273-
Vec3 b3 =
274-
new Vec3(cx, minY, cz - halfZ).add(offset);
275-
Vec3 b4 =
276-
new Vec3(cx, minY, cz + halfZ).add(offset);
277-
RenderUtils.drawLine(entry, buffer, (float)b1.x,
278-
(float)b1.y, (float)b1.z, (float)b2.x,
279-
(float)b2.y, (float)b2.z, markColor);
280-
RenderUtils.drawLine(entry, buffer, (float)b3.x,
281-
(float)b3.y, (float)b3.z, (float)b4.x,
282-
(float)b4.y, (float)b4.z, markColor);
283-
284-
// North face (Z = minZ): lines along X and Y
285-
Vec3 n1 =
286-
new Vec3(cx - halfX, cy, minZ).add(offset);
287-
Vec3 n2 =
288-
new Vec3(cx + halfX, cy, minZ).add(offset);
289-
Vec3 n3 =
290-
new Vec3(cx, cy - halfY, minZ).add(offset);
291-
Vec3 n4 =
292-
new Vec3(cx, cy + halfY, minZ).add(offset);
293-
RenderUtils.drawLine(entry, buffer, (float)n1.x,
294-
(float)n1.y, (float)n1.z, (float)n2.x,
295-
(float)n2.y, (float)n2.z, markColor);
296-
RenderUtils.drawLine(entry, buffer, (float)n3.x,
297-
(float)n3.y, (float)n3.z, (float)n4.x,
298-
(float)n4.y, (float)n4.z, markColor);
299-
300-
// South face (Z = maxZ)
301-
Vec3 s1 =
302-
new Vec3(cx - halfX, cy, maxZ).add(offset);
303-
Vec3 s2 =
304-
new Vec3(cx + halfX, cy, maxZ).add(offset);
305-
Vec3 s3 =
306-
new Vec3(cx, cy - halfY, maxZ).add(offset);
307-
Vec3 s4 =
308-
new Vec3(cx, cy + halfY, maxZ).add(offset);
309-
RenderUtils.drawLine(entry, buffer, (float)s1.x,
310-
(float)s1.y, (float)s1.z, (float)s2.x,
311-
(float)s2.y, (float)s2.z, markColor);
312-
RenderUtils.drawLine(entry, buffer, (float)s3.x,
313-
(float)s3.y, (float)s3.z, (float)s4.x,
314-
(float)s4.y, (float)s4.z, markColor);
315-
316-
// West face (X = minX): lines along Z and Y
317-
Vec3 w1 =
318-
new Vec3(minX, cy, cz - halfZ).add(offset);
319-
Vec3 w2 =
320-
new Vec3(minX, cy, cz + halfZ).add(offset);
321-
Vec3 w3 =
322-
new Vec3(minX, cy - halfY, cz).add(offset);
323-
Vec3 w4 =
324-
new Vec3(minX, cy + halfY, cz).add(offset);
325-
RenderUtils.drawLine(entry, buffer, (float)w1.x,
326-
(float)w1.y, (float)w1.z, (float)w2.x,
327-
(float)w2.y, (float)w2.z, markColor);
328-
RenderUtils.drawLine(entry, buffer, (float)w3.x,
329-
(float)w3.y, (float)w3.z, (float)w4.x,
330-
(float)w4.y, (float)w4.z, markColor);
331-
332-
// East face (X = maxX)
333-
Vec3 e1 =
334-
new Vec3(maxX, cy, cz - halfZ).add(offset);
335-
Vec3 e2 =
336-
new Vec3(maxX, cy, cz + halfZ).add(offset);
337-
Vec3 e3 =
338-
new Vec3(maxX, cy - halfY, cz).add(offset);
339-
Vec3 e4 =
340-
new Vec3(maxX, cy + halfY, cz).add(offset);
341-
RenderUtils.drawLine(entry, buffer, (float)e1.x,
342-
(float)e1.y, (float)e1.z, (float)e2.x,
343-
(float)e2.y, (float)e2.z, markColor);
344-
RenderUtils.drawLine(entry, buffer, (float)e3.x,
345-
(float)e3.y, (float)e3.z, (float)e4.x,
346-
(float)e4.y, (float)e4.z, markColor);
347-
348-
vcp.endBatch(layer);
221+
ChestSearchMarkerRenderer.drawMarker(matrixStack,
222+
box, csh.getMarkXColorARGB(),
223+
csh.getMarkXThickness(), false);
349224
}
350225
}
351226
}

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,13 @@ public final class ChestSearchHack extends Hack
4545
private final ColorSetting espLineColor =
4646
new ColorSetting("ESP line", new java.awt.Color(0x22FF88));
4747
private final ColorSetting markXColor =
48-
new ColorSetting("Mark X color", new java.awt.Color(0xFF2222));
49-
private final SliderSetting markXThickness = new SliderSetting(
50-
"Mark X thickness", 2.0, 0.5, 6.0, 0.5, ValueDisplay.DECIMAL);
48+
new ColorSetting("Opened chest color", new java.awt.Color(0xFF2222));
49+
private final SliderSetting markXThickness =
50+
new SliderSetting("Opened chest line thickness", 2.0, 0.5, 6.0, 0.5,
51+
ValueDisplay.DECIMAL);
5152
private final CheckboxSetting markOpenedChest = new CheckboxSetting(
5253
"Mark opened chest",
53-
"Draw an X through chests that appear in your ChestSearch database.",
54+
"Draw ESP/lines through opened chests that appear in your ChestSearch database.",
5455
true);
5556
private final SliderSetting textScale = new SliderSetting("Text scale", 1.0,
5657
0.5, 1.25, 0.05, ValueDisplay.DECIMAL);

0 commit comments

Comments
 (0)