Skip to content

Commit 884dd8f

Browse files
committed
Bug fix in waypoints/logoutspots
1 parent 7d40156 commit 884dd8f

File tree

2 files changed

+26
-12
lines changed

2 files changed

+26
-12
lines changed

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

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,15 @@ public final class LogoutSpotsHack extends Hack
3434
{
3535
private static final class Entry
3636
{
37-
final UUID uuid;
3837
final String name;
3938
final Box box;
40-
final float health;
39+
final String dimKey;
4140

42-
Entry(UUID u, String n, Box b, float h)
41+
Entry(UUID u, String n, Box b, float h, String dim)
4342
{
44-
uuid = u;
4543
name = n;
4644
box = b;
47-
health = h;
45+
dimKey = dim;
4846
}
4947
}
5048

@@ -112,8 +110,8 @@ public void onUpdate()
112110
{
113111
Box b = p.getBoundingBox();
114112
float h = p.getHealth();
115-
spots.put(id,
116-
new Entry(id, p.getName().getString(), b, h));
113+
spots.put(id, new Entry(id, p.getName().getString(), b,
114+
h, currentDimKey()));
117115
}
118116
}
119117
snapshot();
@@ -126,6 +124,13 @@ public void onUpdate()
126124
}
127125
}
128126

127+
private String currentDimKey()
128+
{
129+
if(MC.world == null)
130+
return "overworld";
131+
return MC.world.getRegistryKey().getValue().getPath();
132+
}
133+
129134
private void snapshot()
130135
{
131136
if(MC.getNetworkHandler() != null)
@@ -145,11 +150,15 @@ public void onRender(MatrixStack matrices, float partialTicks)
145150
{
146151
if(spots.isEmpty())
147152
return;
153+
String curDim = currentDimKey();
148154
int sides = sideColor.getColorI(0x40);
149155
int lines = lineColor.getColorI(0xFF);
150-
var boxes = new java.util.ArrayList<Box>(spots.size());
156+
var boxes = new java.util.ArrayList<Box>();
151157
for(var e : spots.values())
152-
boxes.add(e.box);
158+
if(e.dimKey.equals(curDim))
159+
boxes.add(e.box);
160+
if(boxes.isEmpty())
161+
return;
153162
RenderUtils.drawSolidBoxes(matrices, boxes, sides, false);
154163
RenderUtils.drawOutlinedBoxes(matrices, boxes, lines, false);
155164
// (Optional) draw tracers to centers
@@ -160,6 +169,8 @@ public void onRender(MatrixStack matrices, float partialTicks)
160169
}
161170
for(var e : spots.values())
162171
{
172+
if(!e.dimKey.equals(curDim))
173+
continue;
163174
var c = e.box.getCenter();
164175
drawWorldLabel(matrices, e.name, c.x, e.box.maxY + 0.5, c.z,
165176
0xFFFFFFFF, scale.getValueF());
@@ -184,6 +195,7 @@ private void drawWorldLabel(MatrixStack matrices, String text, double x,
184195
var matrix = matrices.peek().getPositionMatrix();
185196
tr.draw(text, -w, 0, argb, false, matrix, vcp,
186197
TextRenderer.TextLayerType.SEE_THROUGH, bg, 0xF000F0);
198+
vcp.draw();
187199
matrices.pop();
188200
}
189201
}

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import java.util.HashSet;
1616
import java.util.Map;
1717
import java.util.Set;
18+
import java.util.Locale;
1819

1920
import net.minecraft.client.font.TextRenderer;
2021
import net.minecraft.client.network.ServerInfo;
@@ -31,7 +32,6 @@
3132
import net.wurstclient.events.RenderListener;
3233
import net.wurstclient.hack.Hack;
3334
import net.wurstclient.events.ChatInputListener;
34-
import net.wurstclient.events.ChatInputListener.ChatInputEvent;
3535
import net.wurstclient.settings.CheckboxSetting;
3636
import net.wurstclient.settings.SliderSetting;
3737
import net.wurstclient.settings.ColorSetting;
@@ -145,8 +145,7 @@ public void onUpdate()
145145
if(p == MC.player)
146146
continue;
147147
UUID id = p.getUuid();
148-
boolean deadNow =
149-
p.getHealth() <= 0 || p.isDead() || p.isRemoved();
148+
boolean deadNow = p.getHealth() <= 0 || p.isDead();
150149
boolean wasDead = knownDead.contains(id);
151150
if(deadNow && !wasDead)
152151
{
@@ -207,6 +206,9 @@ public void onReceivedMessage(ChatInputEvent event)
207206
String msg = event.getComponent().getString();
208207
if(msg == null || msg.isEmpty())
209208
return;
209+
String lower = msg.toLowerCase(Locale.ROOT);
210+
if(lower.contains("left the game") || lower.contains("joined the game"))
211+
return; // ignore login/logout messages
210212
long now = System.currentTimeMillis();
211213
// Try to match standard death messages: "<name> ..."
212214
for(var p : MC.world.getPlayers())

0 commit comments

Comments
 (0)