Skip to content

Commit 13321d0

Browse files
committed
Updated Presets, Fixed TooManyHax
1 parent cbedf8b commit 13321d0

File tree

13 files changed

+2780
-43
lines changed

13 files changed

+2780
-43
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,7 @@ I did not, nor could I copy their code directly as most are Meteor based mods. S
442442
- Lets you delete presets
443443
- Presets are stored under ```.minecraft/wurst/presets/<name>``` for easy backup or sharing
444444
- Accessible through UI Settings in the ClickUI/Navigator or through the Wurst Options menu mixin
445+
- Includes a recommended default if no other preset exists
445446

446447
### Anticheat Detector
447448
- Watches server behavior and packets to estimate if anti-cheats are present and active

src/main/java/net/wurstclient/WurstClient.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,14 @@ public void initialize()
9595
IMC = (IMinecraftClient)MC;
9696
wurstFolder = createWurstFolder();
9797
presetManager = new PresetManager(this, wurstFolder);
98+
try
99+
{
100+
presetManager.seedBundledPresetIfNone("Recommended Default");
101+
}catch(IOException e)
102+
{
103+
System.out.println("Couldn't seed bundled preset.");
104+
e.printStackTrace();
105+
}
98106

99107
Path analyticsFile = wurstFolder.resolve("analytics.json");
100108
plausible = new PlausibleAnalytics(analyticsFile);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ public void renderBackground(GuiGraphics context, int mouseX, int mouseY,
9494
public void removed()
9595
{
9696
gui.clearKeyboardInput();
97+
gui.init();
9798
super.removed();
9899
}
99100
}

src/main/java/net/wurstclient/commands/TargetPlaceCmd.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
*/
88
package net.wurstclient.commands;
99

10-
import net.wurstclient.Category;
1110
import net.wurstclient.WurstClient;
1211
import net.wurstclient.command.CmdException;
1312
import net.wurstclient.command.CmdSyntaxError;
@@ -21,7 +20,6 @@ public TargetPlaceCmd()
2120
{
2221
super("targetplace", "Selects a block for TargetPlace or unselects it.",
2322
".targetplace");
24-
setCategory(Category.BLOCKS);
2523
}
2624

2725
@Override

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

Lines changed: 26 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.lwjgl.glfw.GLFW;
2525
import net.minecraft.client.gui.GuiGraphics;
2626
import net.minecraft.client.input.MouseButtonEvent;
27+
import net.wurstclient.WurstClient;
2728
import net.wurstclient.Category;
2829
import net.wurstclient.DontBlock;
2930
import net.wurstclient.Feature;
@@ -32,6 +33,7 @@
3233
import net.wurstclient.clickgui.ClickGui;
3334
import net.wurstclient.clickgui.ClickGuiIcons;
3435
import net.wurstclient.clickgui.Component;
36+
import net.wurstclient.clickgui.screens.ClickGuiScreen;
3537
import net.wurstclient.hack.Hack;
3638
import net.wurstclient.keybinds.PossibleKeybind;
3739
import net.wurstclient.settings.Setting;
@@ -90,15 +92,8 @@ private void disableBlockedHacks()
9092

9193
((Hack)feature).setEnabled(false);
9294
}
93-
// Refresh ClickGUI so hacks disabled by TooManyHax are hidden there
94-
try
95-
{
96-
if(WURST.getGui() != null)
97-
WURST.getGui().init();
98-
}catch(Exception e)
99-
{
100-
// ignore GUI refresh failures
101-
}
95+
// Refresh ClickGUI so hacks disabled by TooManyHax are hidden there.
96+
refreshClickGui();
10297
}
10398

10499
public ArrayList<Path> listProfiles()
@@ -148,14 +143,7 @@ public void setBlocked(Feature feature, boolean blocked)
148143
blockedFeatures.remove(feature);
149144

150145
file.save();
151-
try
152-
{
153-
if(WURST.getGui() != null)
154-
WURST.getGui().init();
155-
}catch(Exception e)
156-
{
157-
// ignore GUI refresh failures
158-
}
146+
refreshClickGui();
159147
}
160148

161149
public void blockAll()
@@ -179,42 +167,21 @@ public void blockAll()
179167
.sort(Comparator.comparing(f -> f.getName().toLowerCase()));
180168

181169
file.save();
182-
try
183-
{
184-
if(WURST.getGui() != null)
185-
WURST.getGui().init();
186-
}catch(Exception e)
187-
{
188-
// ignore GUI refresh failures
189-
}
170+
refreshClickGui();
190171
}
191172

192173
public void unblockAll()
193174
{
194175
blockedFeatures.clear();
195176
file.save();
196-
try
197-
{
198-
if(WURST.getGui() != null)
199-
WURST.getGui().init();
200-
}catch(Exception e)
201-
{
202-
// ignore GUI refresh failures
203-
}
177+
refreshClickGui();
204178
}
205179

206180
@Override
207181
protected void onDisable()
208182
{
209183
// Rebuild ClickGUI so previously hidden hacks reappear
210-
try
211-
{
212-
if(WURST.getGui() != null)
213-
WURST.getGui().init();
214-
}catch(Exception e)
215-
{
216-
// ignore GUI refresh failures
217-
}
184+
refreshClickGui();
218185
}
219186

220187
public List<Feature> getBlockedFeatures()
@@ -420,4 +387,22 @@ public int getDefaultHeight()
420387
return 110;
421388
}
422389
}
390+
391+
private void refreshClickGui()
392+
{
393+
try
394+
{
395+
if(WURST.getGui() == null)
396+
return;
397+
398+
if(WurstClient.MC != null
399+
&& WurstClient.MC.screen instanceof ClickGuiScreen)
400+
return;
401+
402+
WURST.getGui().init();
403+
}catch(Exception e)
404+
{
405+
// ignore GUI refresh failures
406+
}
407+
}
423408
}

src/main/java/net/wurstclient/presets/PresetManager.java

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
package net.wurstclient.presets;
99

1010
import java.io.IOException;
11+
import java.io.InputStream;
1112
import java.nio.file.Files;
1213
import java.nio.file.NoSuchFileException;
1314
import java.nio.file.Path;
@@ -66,6 +67,46 @@ public void savePreset(String name) throws IOException
6667
copyCurrentFilesToPreset(presetFolder);
6768
}
6869

70+
public void seedBundledPresetIfNone(String name) throws IOException
71+
{
72+
if(name == null || name.isBlank())
73+
return;
74+
75+
if(!listPresets().isEmpty())
76+
return;
77+
78+
installBundledPreset(name);
79+
}
80+
81+
public void installBundledPreset(String name) throws IOException
82+
{
83+
if(name == null || name.isBlank())
84+
return;
85+
86+
Path presetFolder = getPresetFolder(name);
87+
if(Files.isDirectory(presetFolder))
88+
return;
89+
90+
boolean copiedAny = false;
91+
for(String fileName : PRESET_FILES)
92+
{
93+
String resourcePath = "/wurst/presets/" + name + "/" + fileName;
94+
try(InputStream in =
95+
PresetManager.class.getResourceAsStream(resourcePath))
96+
{
97+
if(in == null)
98+
continue;
99+
100+
if(!copiedAny)
101+
Files.createDirectories(presetFolder);
102+
103+
Files.copy(in, presetFolder.resolve(fileName),
104+
StandardCopyOption.REPLACE_EXISTING);
105+
copiedAny = true;
106+
}
107+
}
108+
}
109+
69110
public void loadPreset(String name) throws IOException
70111
{
71112
Path presetFolder = getPresetFolder(name);
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
[
2+
"AntiBlast",
3+
"AntiBlind",
4+
"AntiCheatDetect",
5+
"AntiDrop",
6+
"AntiEntityPush",
7+
"AntiKnockback",
8+
"AntiWaterPush",
9+
"AutoRespawn",
10+
"AutoTool",
11+
"AutoTotem",
12+
"BeaconExploit",
13+
"BedESP",
14+
"Breadcrumbs",
15+
"CheatDetector",
16+
"ChestESP",
17+
"CoordLogger",
18+
"Criticals",
19+
"EnchantmentHandler",
20+
"Fullbright",
21+
"HealthTags",
22+
"ItemESP",
23+
"ItemHandler",
24+
"LogoutSpots",
25+
"MaceDMG",
26+
"MobESP",
27+
"NameTags",
28+
"NoBackground",
29+
"NoFall",
30+
"NoFog",
31+
"NoLevitation",
32+
"NoOverlay",
33+
"NoShieldOverlay",
34+
"NoSlowdown",
35+
"NoWeather",
36+
"NoWeb",
37+
"Outreach",
38+
"PearlESP",
39+
"PlayerESP",
40+
"PortalESP",
41+
"PortalGUI",
42+
"QuickShulker",
43+
"Reach",
44+
"RedstoneESP",
45+
"SignESP",
46+
"SignFramePT",
47+
"SnowShoe",
48+
"SpearAssist",
49+
"TridentESP",
50+
"TrueSight",
51+
"Waypoints",
52+
"WorkstationESP",
53+
"XCarry"
54+
]
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[
2+
"AutoTotem",
3+
"BedESP",
4+
"Breadcrumbs",
5+
"ChestESP",
6+
"Flight",
7+
"HandNoClip",
8+
"ItemESP",
9+
"LavaWaterESP",
10+
"MobESP",
11+
"MobSearch",
12+
"NoFall",
13+
"NoShieldOverlay",
14+
"OpenWaterESP",
15+
"PlayerESP",
16+
"PortalESP",
17+
"RedstoneESP",
18+
"Search",
19+
"SignESP",
20+
"Waypoints",
21+
"X-Ray"
22+
]
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"key.keyboard.apostrophe": ".waypoints",
3+
"key.keyboard.b": "fastplace;fastbreak",
4+
"key.keyboard.c": "fullbright",
5+
"key.keyboard.g": "flight",
6+
"key.keyboard.h": "say /home",
7+
"key.keyboard.j": "jesus",
8+
"key.keyboard.k": "multiaura",
9+
"key.keyboard.keypad.0": "HandNoClip",
10+
"key.keyboard.keypad.1": "PacketDelay",
11+
"key.keyboard.keypad.5": ".say /sm:seedmap",
12+
"key.keyboard.keypad.7": "Blink",
13+
"key.keyboard.keypad.8": "SafeTP",
14+
"key.keyboard.keypad.9": ".setcheckbox noslowdown no_water_slowdown toggle",
15+
"key.keyboard.keypad.add": "Panic",
16+
"key.keyboard.keypad.decimal": "panic restore",
17+
"key.keyboard.left.bracket": "ChestSearch",
18+
"key.keyboard.menu": "clickgui",
19+
"key.keyboard.n": "nuker",
20+
"key.keyboard.r": "multiaura",
21+
"key.keyboard.right.bracket": ".setcheckbox breadcrumbs paused toggle",
22+
"key.keyboard.right.shift": "navigator",
23+
"key.keyboard.semicolon": "itemhandler gui",
24+
"key.keyboard.u": "freecam",
25+
"key.keyboard.x": "x-ray",
26+
"key.keyboard.y": "chestesp"
27+
}

0 commit comments

Comments
 (0)