Skip to content

Commit 30429f3

Browse files
committed
Update FeatureButton, XRayHack, and WurstLogo for 1.21.9 compatibility
1 parent a6207b8 commit 30429f3

File tree

14 files changed

+111
-57
lines changed

14 files changed

+111
-57
lines changed

README.md

0 Bytes

Wurst Client v7.50.2 (MC1.21.89) - Modified by CevAPI

CevAPI Logo

src/main/java/net/wurstclient/clickgui/components/FeatureButton.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import net.wurstclient.hacks.TooManyHaxHack;
2222
import net.wurstclient.util.ChatUtils;
2323
import net.wurstclient.util.RenderUtils;
24+
import org.lwjgl.glfw.GLFW;
2425

2526
public final class FeatureButton extends Component
2627
{
@@ -30,6 +31,11 @@ public final class FeatureButton extends Component
3031
private final Feature feature;
3132
private final boolean hasSettings;
3233

34+
public Feature getFeature()
35+
{
36+
return feature;
37+
}
38+
3339
private Window settingsWindow;
3440

3541
public FeatureButton(Feature feature)
@@ -44,7 +50,19 @@ public FeatureButton(Feature feature)
4450
public void handleMouseClick(double mouseX, double mouseY, int mouseButton,
4551
Click context)
4652
{
47-
if(mouseButton != 0)
53+
// middle click toggles favorites
54+
if(mouseButton == GLFW.GLFW_MOUSE_BUTTON_MIDDLE)
55+
{
56+
if(feature instanceof net.wurstclient.hack.Hack)
57+
{
58+
net.wurstclient.hack.Hack h =
59+
(net.wurstclient.hack.Hack)feature;
60+
h.setFavorite(!h.isFavorite());
61+
}
62+
return;
63+
}
64+
65+
if(mouseButton != GLFW.GLFW_MOUSE_BUTTON_LEFT)
4866
return;
4967

5068
if(hasSettings && (mouseX > getX() + getWidth() - 12

src/main/java/net/wurstclient/clickgui/screens/EditEntityTypeListScreen.java

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
import net.minecraft.client.MinecraftClient;
1717
import net.minecraft.client.font.TextRenderer;
1818
import net.minecraft.client.gui.DrawContext;
19+
import net.minecraft.client.gui.Click;
20+
import net.minecraft.client.input.KeyInput;
1921
import net.minecraft.client.gui.Drawable;
2022
import net.minecraft.client.gui.screen.ConfirmScreen;
2123
import net.minecraft.client.gui.screen.Screen;
@@ -134,36 +136,37 @@ public void init()
134136
}
135137

136138
@Override
137-
public boolean mouseClicked(double mouseX, double mouseY, int mouseButton)
139+
public boolean mouseClicked(Click context, boolean doubleClick)
138140
{
139-
typeNameField.mouseClicked(mouseX, mouseY, mouseButton);
140-
return super.mouseClicked(mouseX, mouseY, mouseButton);
141+
typeNameField.mouseClicked(context, doubleClick);
142+
return super.mouseClicked(context, doubleClick);
141143
}
142144

143145
@Override
144-
public boolean keyPressed(int keyCode, int scanCode, int int_3)
146+
public boolean keyPressed(KeyInput keyInput)
145147
{
148+
int keyCode = keyInput.key();
146149
switch(keyCode)
147150
{
148151
case GLFW.GLFW_KEY_ENTER:
149152
if(addButton.active)
150-
addButton.onPress();
153+
addButton.onPress(keyInput);
151154
break;
152155

153156
case GLFW.GLFW_KEY_DELETE:
154157
if(!typeNameField.isFocused())
155-
removeButton.onPress();
158+
removeButton.onPress(keyInput);
156159
break;
157160

158161
case GLFW.GLFW_KEY_ESCAPE:
159-
doneButton.onPress();
162+
doneButton.onPress(keyInput);
160163
break;
161164

162165
default:
163166
break;
164167
}
165168

166-
return super.keyPressed(keyCode, scanCode, int_3);
169+
return super.keyPressed(keyInput);
167170
}
168171

169172
@Override
@@ -263,7 +266,6 @@ public void render(DrawContext context, int mouseX, int mouseY,
263266
context.fill(x0 - 16, y0, x0, y1, border);
264267
context.fill(x0 - 15, y0 + 1, x0 - 1, y1 - 1, black);
265268

266-
context.state.goDownLayer();
267269
matrixStack.popMatrix();
268270
}
269271

@@ -297,8 +299,7 @@ public net.minecraft.text.Text getNarration()
297299
}
298300

299301
@Override
300-
public void render(DrawContext context, int index, int y, int x,
301-
int entryWidth, int entryHeight, int mouseX, int mouseY,
302+
public void render(DrawContext context, int mouseX, int mouseY,
302303
boolean hovered, float tickDelta)
303304
{
304305
TextRenderer tr = client.textRenderer;
@@ -311,6 +312,8 @@ public void render(DrawContext context, int index, int y, int x,
311312
.getName().getString();
312313
else
313314
display = "\u00a7okeyword\u00a7r";
315+
int x = getContentX();
316+
int y = getContentY();
314317
context.drawText(tr, display, x + 8, y,
315318
net.wurstclient.util.WurstColors.VERY_LIGHT_GRAY, false);
316319
context.drawText(tr, typeName, x + 8, y + 10, Colors.LIGHT_GRAY,
@@ -324,7 +327,7 @@ private final class ListGui
324327
public ListGui(MinecraftClient minecraft,
325328
EditEntityTypeListScreen screen, List<String> list)
326329
{
327-
super(minecraft, screen.width, screen.height - 96, 36, 30, 0);
330+
super(minecraft, screen.width, screen.height - 96, 36, 30);
328331
list.stream().map(EditEntityTypeListScreen.Entry::new)
329332
.forEach(this::addEntry);
330333
}

src/main/java/net/wurstclient/clickgui/screens/WaypointEditScreen.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,8 @@ private void usePlayerPos()
361361
{
362362
if(client.player == null)
363363
return;
364-
BlockPos p = BlockPos.ofFloored(client.player.getPos());
364+
BlockPos p = BlockPos.ofFloored(client.player.getX(),
365+
client.player.getY(), client.player.getZ());
365366
xField.setText(Integer.toString(p.getX()));
366367
yField.setText(Integer.toString(p.getY()));
367368
zField.setText(Integer.toString(p.getZ()));

src/main/java/net/wurstclient/clickgui/screens/WaypointsScreen.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ protected void init()
127127
System.currentTimeMillis());
128128
w.setName("New Waypoint");
129129
if(client.player != null)
130-
w.setPos(BlockPos.ofFloored(client.player.getPos()));
130+
w.setPos(BlockPos.ofFloored(client.player.getX(),
131+
client.player.getY(), client.player.getZ()));
131132
else
132133
w.setPos(BlockPos.ORIGIN);
133134
w.setDimension(currentDim());

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ public void onUpdate()
8989
// Do not add new points while paused
9090
if(paused.isChecked())
9191
return;
92-
Vec3d here = MC.player.getPos();
92+
Vec3d here =
93+
new Vec3d(MC.player.getX(), MC.player.getY(), MC.player.getZ());
9394
if(points.isEmpty())
9495
{
9596
points.add(here);

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ public void onUpdate()
114114
// find missing
115115
var lastMap = new HashMap<UUID, PlayerListEntry>();
116116
for(var e : lastList)
117-
lastMap.put(e.getProfile().getId(), e);
117+
lastMap.put(e.getProfile().id(), e);
118118
var nowMap = new HashMap<UUID, PlayerListEntry>();
119119
for(var e : nowList)
120-
nowMap.put(e.getProfile().getId(), e);
120+
nowMap.put(e.getProfile().id(), e);
121121
for(var id : lastMap.keySet())
122122
if(!nowMap.containsKey(id))
123123
{
@@ -231,7 +231,17 @@ private void drawWorldLabel(MatrixStack matrices, String text, double x,
231231
net.minecraft.util.math.Vec3d cam =
232232
net.wurstclient.util.RenderUtils.getCameraPos();
233233
matrices.translate(x - cam.x, y - cam.y, z - cam.z);
234-
matrices.multiply(MC.getEntityRenderDispatcher().getRotation());
234+
// Face the camera (billboard)
235+
var camEntity = MC.getCameraEntity();
236+
if(camEntity != null)
237+
{
238+
matrices.multiply(net.minecraft.util.math.RotationAxis.POSITIVE_Y
239+
.rotationDegrees(-camEntity.getYaw()));
240+
matrices.multiply(net.minecraft.util.math.RotationAxis.POSITIVE_X
241+
.rotationDegrees(camEntity.getPitch()));
242+
}
243+
matrices.multiply(net.minecraft.util.math.RotationAxis.POSITIVE_Y
244+
.rotationDegrees(180.0F));
235245
float s = 0.025F * scale;
236246
matrices.scale(s, -s, s);
237247
TextRenderer tr = MC.textRenderer;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public void onRightClick(RightClickEvent event)
102102
Box box = EntityUtils.getLerpedBox(frame, 0.0f);
103103
if(box.contains(hitPos))
104104
{
105-
ehr = new EntityHitResult(frame, frame.getPos());
105+
ehr = new EntityHitResult(frame, hitPos);
106106
break;
107107
}
108108
}

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

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,17 @@ private void drawWorldLabel(MatrixStack matrices, String text, double x,
586586
matrices.push();
587587
Vec3d cam = RenderUtils.getCameraPos();
588588
matrices.translate(x - cam.x, y - cam.y, z - cam.z);
589-
matrices.multiply(MC.getEntityRenderDispatcher().getRotation());
589+
// Face the camera (billboard)
590+
var camEntity = MC.getCameraEntity();
591+
if(camEntity != null)
592+
{
593+
matrices.multiply(net.minecraft.util.math.RotationAxis.POSITIVE_Y
594+
.rotationDegrees(-camEntity.getYaw()));
595+
matrices.multiply(net.minecraft.util.math.RotationAxis.POSITIVE_X
596+
.rotationDegrees(camEntity.getPitch()));
597+
}
598+
matrices.multiply(net.minecraft.util.math.RotationAxis.POSITIVE_Y
599+
.rotationDegrees(180.0F));
590600
float s = 0.025F * scale;
591601
matrices.scale(s, -s, s);
592602
// After scaling, translate by pixel offset to separate lines
@@ -608,6 +618,8 @@ private void drawBeaconBeam(MatrixStack matrices, BlockPos pos, int color,
608618
{
609619
if(MC.world == null)
610620
return;
621+
@SuppressWarnings("all")
622+
// noinspection RedundantQualifierName
611623
Waypoint.BeaconMode safeMode =
612624
mode == null ? Waypoint.BeaconMode.OFF : mode;
613625
if(safeMode == Waypoint.BeaconMode.OFF)
@@ -765,7 +777,7 @@ public void onRenderGUI(DrawContext context, float partialTicks)
765777
String coords = dir + ": " + ix + " " + iy + " " + iz;
766778
int cw = tr.getWidth(coords);
767779
int cx = centerX - cw / 2;
768-
int cy = Math.max(2, barY - 12); // avoid off-screen
780+
int cy = Math.max(2, barY - 13); // was 12, now 13
769781
context.drawText(tr, coords, cx, cy, 0xFFFFFFFF, false);
770782
}
771783

@@ -874,7 +886,7 @@ public void onRenderGUI(DrawContext context, float partialTicks)
874886
int dw = tr.getWidth(distText);
875887
int titleX = centerX - tw / 2;
876888
int distX = centerX - dw / 2;
877-
int titleY = barY + barH + 2;
889+
int titleY = barY + barH + 3; // was 2, now 3 for 1.21.9
878890
int distY = titleY + 10;
879891
// apply compass opacity to text
880892
double opaText =

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,8 @@ public void onUpdate()
318318
oreNamesCache = new ArrayList<>(ores.getBlockNames());
319319
lastOresHash = ores.getBlockNames().hashCode();
320320
rebuildOreCaches();
321+
// reset search and highlights
322+
resetCoordinatorAndHighlights();
321323
MC.worldRenderer.reload();
322324
}else // switched to QUERY
323325
{
@@ -330,6 +332,8 @@ public void onUpdate()
330332
oreKeywords = Stream.of(q.split(","))
331333
.map(s -> s.trim().toLowerCase(java.util.Locale.ROOT))
332334
.filter(s -> !s.isEmpty()).toArray(String[]::new);
335+
// reset search and highlights
336+
resetCoordinatorAndHighlights();
333337
MC.worldRenderer.reload();
334338
}
335339
}
@@ -342,6 +346,8 @@ public void onUpdate()
342346
lastOresHash = currentHash;
343347
oreNamesCache = new ArrayList<>(ores.getBlockNames());
344348
rebuildOreCaches();
349+
// reset so results update instantly
350+
resetCoordinatorAndHighlights();
345351
MC.worldRenderer.reload();
346352
}else
347353
{
@@ -375,6 +381,8 @@ public void onUpdate()
375381
{
376382
oreKeywords = newKw;
377383
oreExactIds = null; // force keyword path
384+
// reset so results update instantly
385+
resetCoordinatorAndHighlights();
378386
MC.worldRenderer.reload();
379387
}
380388
}
@@ -642,4 +650,16 @@ public void openBlockListEditor(Screen prevScreen)
642650
}
643651

644652
// See AbstractBlockRenderContextMixin, RenderLayersMixin
653+
654+
private void resetCoordinatorAndHighlights()
655+
{
656+
// Cancel current searches and clear cached highlights to avoid stale
657+
// results persisting after mode/list/query changes.
658+
coordinator.reset();
659+
highlightPositions.clear();
660+
visibleBoxes.clear();
661+
highlightPositionsUpToDate = false;
662+
visibleBoxesUpToDate = false;
663+
lastCoordinatorChangeMs = System.currentTimeMillis();
664+
}
645665
}

0 commit comments

Comments
 (0)