Skip to content

Commit 5871165

Browse files
committed
Updated SpearAssist
1 parent f7f8381 commit 5871165

9 files changed

Lines changed: 106 additions & 79 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ I did not, nor could I copy their code directly as most are Meteor based mods. S
406406
- Allow reverse toggle lets you hold S/back while attacking to flip boosts so they launch you backward instead.
407407
- Highlighting: You can highlight near and far entities within your attack range. Near meaning the distance you can jab at them and far the distance you can charge at them. Default set to 7 for near and 8.5 blocks for far.
408408
- Your charge is automatically and constantly resumed (no cooldown) so you can forever hold right click. It will be noisy but even if the spear is pointed down you will still be able to attack.
409-
- You can optionally allow aim assist to work whilst holding right click.
409+
- You can optionally allow aim assist to work whilst holding right click or stay on while spear is being used.
410410
- Auto Attack, your jab attack will continue to auto hit once the cooldown has expired so long as you're hitting an entity.
411411
- Auto alignment flys you up or down to match the level of your target when AimAssist is enabled
412412
- Extended AimAssist range (Max 100 Blocks) while using SpearAssist

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

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ protected void onEnable()
103103
bufferUpToDate = false;
104104
if(shaderSafeMode)
105105
ChatUtils
106-
.message("Shaders detected - using safe mode for CaveFinder.");
106+
.message("Shaders detected - using safe mode for CaveFinder.");
107107
EVENTS.add(UpdateListener.class, this);
108108
EVENTS.add(PacketInputListener.class, coordinator);
109109
EVENTS.add(RenderListener.class, this);
@@ -129,17 +129,17 @@ protected void onDisable()
129129
@Override
130130
public void onUpdate()
131131
{
132-
boolean currentShaderSafeMode = ShaderUtils.refreshShadersActive();
132+
boolean currentShaderSafeMode = ShaderUtils.refreshShadersActive();
133133
if(currentShaderSafeMode != shaderSafeMode)
134134
{
135135
shaderSafeMode = currentShaderSafeMode;
136136
stopBuildingBuffer();
137137
if(shaderSafeMode)
138138
ChatUtils.message(
139-
"Shaders detected - using safe mode for CaveFinder.");
139+
"Shaders detected - using safe mode for CaveFinder.");
140140
else
141141
ChatUtils.message(
142-
"Shaders disabled - returning CaveFinder to normal mode.");
142+
"Shaders disabled - returning CaveFinder to normal mode.");
143143
}
144144

145145
boolean searchersChanged = coordinator.update();
@@ -261,10 +261,10 @@ private void buildBufferSafeMode()
261261
{
262262
if(bufferUpToDate)
263263
return;
264-
265-
if(getMatchingBlocksTask != null || compileVerticesTask != null)
264+
265+
if(getMatchingBlocksTask != null || compileVerticesTask != null)
266266
stopBuildingBuffer();
267-
267+
268268
BlockPos eyesPos = BlockPos.containing(RotationUtils.getEyesPos());
269269
Comparator<BlockPos> comparator =
270270
Comparator.comparingInt(pos -> eyesPos.distManhattan(pos));
@@ -302,7 +302,7 @@ private void setBufferFromTask()
302302
setBufferFromVertices(vertices);
303303
}
304304

305-
private void setBufferFromVertices(ArrayList<int[]> vertices)
305+
private void setBufferFromVertices(ArrayList<int[]> vertices)
306306
{
307307
RegionPos region = RenderUtils.getCameraRegion();
308308

@@ -320,6 +320,3 @@ private void setBufferFromVertices(ArrayList<int[]> vertices)
320320
bufferRegion = region;
321321
}
322322
}
323-
324-
325-

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ public CoordLoggerHack()
253253
{
254254
super("CoordLogger");
255255
setCategory(Category.OTHER);
256-
256+
257257
// Settings in ClickGUI
258258
addSetting(minDistance);
259259
addSetting(playerTeleports);

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

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ protected void onEnable()
105105
shaderSafeMode = ShaderUtils.refreshShadersActive();
106106
if(shaderSafeMode)
107107
ChatUtils
108-
.message("Shaders detected - using safe mode for Excavator.");
108+
.message("Shaders detected - using safe mode for Excavator.");
109109
EVENTS.add(UpdateListener.class, this);
110110
EVENTS.add(RenderListener.class, this);
111111
EVENTS.add(GUIRenderListener.class, this);
@@ -135,16 +135,16 @@ protected void onDisable()
135135
@Override
136136
public void onUpdate()
137137
{
138-
boolean currentShaderSafeMode = ShaderUtils.refreshShadersActive();
138+
boolean currentShaderSafeMode = ShaderUtils.refreshShadersActive();
139139
if(currentShaderSafeMode != shaderSafeMode)
140140
{
141141
shaderSafeMode = currentShaderSafeMode;
142142
if(shaderSafeMode)
143143
ChatUtils.message(
144-
"Shaders detected - using safe mode for Excavator.");
144+
"Shaders detected - using safe mode for Excavator.");
145145
else
146146
ChatUtils.message(
147-
"Shaders disabled - returning Excavator to normal mode.");
147+
"Shaders disabled - returning Excavator to normal mode.");
148148
}
149149

150150
if(step.selectPos)
@@ -393,7 +393,7 @@ Comparator.<BlockPos> comparingInt(pos -> pos.getY()).reversed()
393393
? BlockUtils::canBeClicked : pos -> BlockUtils.canBeClicked(pos)
394394
&& !BlockUtils.isUnbreakable(pos);
395395
java.util.List<BlockPos> blocksSnapshot =
396-
shaderSafeMode ? new ArrayList<>(area.blocksList) : null;
396+
shaderSafeMode ? new ArrayList<>(area.blocksList) : null;
397397
if(shaderSafeMode)
398398
area.remainingBlocks =
399399
(int)blocksSnapshot.stream().filter(pBreakable).count();
@@ -410,7 +410,7 @@ Comparator.<BlockPos> comparingInt(pos -> pos.getY()).reversed()
410410
if(pathFinder == null)
411411
{
412412
java.util.stream.Stream<BlockPos> blockStream = shaderSafeMode
413-
? blocksSnapshot.stream() : area.blocksList.parallelStream();
413+
? blocksSnapshot.stream() : area.blocksList.parallelStream();
414414
BlockPos closestBlock =
415415
blockStream.filter(pBreakable).min(cNextTargetBlock).get();
416416

@@ -580,6 +580,3 @@ protected boolean checkDone()
580580
}
581581
}
582582
}
583-
584-
585-

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

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ protected void onEnable()
208208
shaderSafeMode = ShaderUtils.refreshShadersActive();
209209
if(shaderSafeMode)
210210
ChatUtils
211-
.message("Shaders detected - using safe mode for PlayerESP.");
211+
.message("Shaders detected - using safe mode for PlayerESP.");
212212
}
213213

214214
@Override
@@ -225,24 +225,24 @@ protected void onDisable()
225225
@Override
226226
public void onUpdate()
227227
{
228-
boolean currentShaderSafeMode = ShaderUtils.refreshShadersActive();
228+
boolean currentShaderSafeMode = ShaderUtils.refreshShadersActive();
229229
if(currentShaderSafeMode != shaderSafeMode)
230230
{
231231
shaderSafeMode = currentShaderSafeMode;
232232
if(shaderSafeMode)
233233
ChatUtils.message(
234-
"Shaders detected - using safe mode for PlayerESP.");
234+
"Shaders detected - using safe mode for PlayerESP.");
235235
else
236236
ChatUtils.message(
237-
"Shaders disabled - returning PlayerESP to normal mode.");
237+
"Shaders disabled - returning PlayerESP to normal mode.");
238238
}
239239

240240
players.clear();
241241

242242
java.util.List<AbstractClientPlayer> playerSnapshot =
243-
shaderSafeMode ? new ArrayList<>(MC.level.players()) : null;
243+
shaderSafeMode ? new ArrayList<>(MC.level.players()) : null;
244244
Stream<AbstractClientPlayer> stream = (shaderSafeMode
245-
? playerSnapshot.stream() : MC.level.players().parallelStream())
245+
? playerSnapshot.stream() : MC.level.players().parallelStream())
246246
.filter(e -> !e.isRemoved() && e.getHealth() > 0)
247247
.filter(e -> e != MC.player)
248248
.filter(e -> !(e instanceof FakePlayerEntity))
@@ -939,6 +939,3 @@ public String toString()
939939
}
940940
}
941941
}
942-
943-
944-

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

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ protected void onEnable()
209209
lastMatchesVersion = coordinator.getMatchesVersion();
210210
if(shaderSafeMode)
211211
ChatUtils
212-
.message("Shaders detected - using safe mode for SearchHack.");
212+
.message("Shaders detected - using safe mode for SearchHack.");
213213
EVENTS.add(UpdateListener.class, this);
214214
EVENTS.add(PacketInputListener.class, coordinator);
215215
EVENTS.add(RenderListener.class, this);
@@ -239,17 +239,17 @@ protected void onDisable()
239239
@Override
240240
public void onUpdate()
241241
{
242-
boolean currentShaderSafeMode = ShaderUtils.refreshShadersActive();
242+
boolean currentShaderSafeMode = ShaderUtils.refreshShadersActive();
243243
if(currentShaderSafeMode != shaderSafeMode)
244244
{
245245
shaderSafeMode = currentShaderSafeMode;
246246
stopBuildingBuffer(true);
247247
if(shaderSafeMode)
248248
ChatUtils.message(
249-
"Shaders detected - using safe mode for SearchHack.");
249+
"Shaders detected - using safe mode for SearchHack.");
250250
else
251251
ChatUtils.message(
252-
"Shaders disabled - returning SearchHack to normal mode.");
252+
"Shaders disabled - returning SearchHack to normal mode.");
253253
}
254254

255255
SearchMode currentMode = mode.getSelected();
@@ -566,8 +566,8 @@ private void buildBufferSafeMode()
566566
{
567567
if(bufferUpToDate)
568568
return;
569-
570-
if(getMatchingBlocksTask != null || compileVerticesTask != null)
569+
570+
if(getMatchingBlocksTask != null || compileVerticesTask != null)
571571
stopBuildingBuffer(false);
572572

573573
// Use a bounded max-heap to keep only the closest N matches without
@@ -679,6 +679,3 @@ private void stopBuildingBuffer(boolean discardCurrent)
679679
}
680680
}
681681
}
682-
683-
684-

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

Lines changed: 55 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,8 @@ public final class SpearAssistHack extends Hack
8686
"Automatically re-presses use to keep the spear raised when it drops.",
8787
true);
8888

89-
private final CheckboxSetting allowAimAssistWhileCharging =
90-
new CheckboxSetting("Allow AimAssist while charging",
91-
"Temporarily lets AimAssist run while you hold right-click.", true);
89+
private final EnumSetting<AimAssistMode> aimAssistMode = new EnumSetting<>(
90+
"AimAssist mode", AimAssistMode.values(), AimAssistMode.OFF);
9291

9392
private final SliderSetting aimAssistRangeOverride = new SliderSetting(
9493
"AimAssist range", "Overrides AimAssist range while holding a spear.",
@@ -111,6 +110,7 @@ public final class SpearAssistHack extends Hack
111110
private boolean attackKeyDown;
112111
private double dashDistanceRemaining;
113112
private boolean aimAssistTemporarilyAllowed;
113+
private boolean aimAssistTemporarilyEnabled;
114114
private final ArrayList<TargetHighlight> highlightTargets =
115115
new ArrayList<>();
116116
private boolean useGlowFallback = true;
@@ -134,7 +134,7 @@ public SpearAssistHack()
134134
addSetting(nearHighlightColor);
135135
addSetting(farHighlightColor);
136136
addSetting(autoResumeCharge);
137-
addSetting(allowAimAssistWhileCharging);
137+
addSetting(aimAssistMode);
138138
addSetting(aimAssistRangeOverride);
139139
addSetting(aimAssistLockOnOverride);
140140
addSetting(autoAlignment);
@@ -148,7 +148,7 @@ protected void onEnable()
148148
EVENTS.add(RenderListener.class, this);
149149
EVENTS.add(RightClickListener.class, this);
150150
resetState();
151-
updateAimAssist(false);
151+
updateAimAssist(false, false);
152152
}
153153

154154
@Override
@@ -159,8 +159,8 @@ protected void onDisable()
159159
EVENTS.remove(RightClickListener.class, this);
160160
clearAimAssistRangeOverride();
161161
clearAimAssistLockOnOverride();
162+
updateAimAssist(false, false);
162163
resetState();
163-
updateAimAssist(false);
164164
}
165165

166166
@Override
@@ -209,9 +209,9 @@ public void onUpdate()
209209

210210
updateHighlights(holdingSpear);
211211
updateHighlightMode();
212+
updateAimAssist(charging, holdingSpear);
212213
updateAimAssistRangeOverride(holdingSpear);
213214
updateAimAssistLockOnOverride(holdingSpear);
214-
updateAimAssist(charging);
215215
updateAutoAlignment(charging, holdingSpear);
216216
handleAutoAttack(holdingSpear, attackHeld);
217217
}
@@ -441,6 +441,7 @@ private void resetState()
441441
useGlowFallback = true;
442442
currentStyle = null;
443443
aimAssistTemporarilyAllowed = false;
444+
aimAssistTemporarilyEnabled = false;
444445
autoAttackPrimed = false;
445446
reverseDashActive = false;
446447
aimAssistRangeOverridden = false;
@@ -522,11 +523,35 @@ private void silentlyStartUseItem()
522523
MC.player.setSilent(false);
523524
}
524525

525-
private void updateAimAssist(boolean charging)
526+
private void updateAimAssist(boolean charging, boolean holdingSpear)
526527
{
527528
var aimAssist = WURST.getHax().aimAssistHack;
528-
if(aimAssist == null || !aimAssist.isEnabled()
529-
|| !allowAimAssistWhileCharging.isChecked())
529+
if(aimAssist == null)
530+
return;
531+
532+
boolean shouldEnable = switch(aimAssistMode.getSelected())
533+
{
534+
case OFF -> false;
535+
case WHILE_HOLDING_SPEAR -> holdingSpear;
536+
case WHILE_CHARGING -> charging;
537+
};
538+
539+
if(shouldEnable)
540+
{
541+
if(!aimAssist.isEnabled())
542+
{
543+
aimAssist.setEnabled(true);
544+
aimAssistTemporarilyEnabled = true;
545+
}
546+
}else if(aimAssistTemporarilyEnabled)
547+
{
548+
if(aimAssist.isEnabled())
549+
aimAssist.setEnabled(false);
550+
551+
aimAssistTemporarilyEnabled = false;
552+
}
553+
554+
if(!aimAssist.isEnabled())
530555
{
531556
if(aimAssistTemporarilyAllowed && aimAssist != null)
532557
aimAssist.setTemporarilyAllowBlocking(false);
@@ -756,6 +781,26 @@ public String toString()
756781
}
757782
}
758783

784+
private enum AimAssistMode
785+
{
786+
OFF("Off"),
787+
WHILE_HOLDING_SPEAR("While holding spear"),
788+
WHILE_CHARGING("While charging");
789+
790+
private final String name;
791+
792+
private AimAssistMode(String name)
793+
{
794+
this.name = name;
795+
}
796+
797+
@Override
798+
public String toString()
799+
{
800+
return name;
801+
}
802+
}
803+
759804
private static final class TargetHighlight
760805
{
761806
private final LivingEntity entity;

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ public enum BlockVertexCompiler
2727

2828
public static ArrayList<int[]> compile(HashSet<BlockPos> blocks)
2929
{
30-
Stream<BlockPos> stream = ShaderUtils.isShaderSafeMode()
31-
? blocks.stream() : blocks.parallelStream();
30+
Stream<BlockPos> stream = ShaderUtils.isShaderSafeMode()
31+
? blocks.stream() : blocks.parallelStream();
3232
return stream.flatMap(pos -> getVertices(pos, blocks))
3333
.collect(Collectors.toCollection(ArrayList::new));
3434
}
3535

3636
public static ArrayList<int[]> compile(HashSet<BlockPos> blocks,
3737
RegionPos region)
3838
{
39-
Stream<BlockPos> stream = ShaderUtils.isShaderSafeMode()
40-
? blocks.stream() : blocks.parallelStream();
39+
Stream<BlockPos> stream = ShaderUtils.isShaderSafeMode()
40+
? blocks.stream() : blocks.parallelStream();
4141
return stream.flatMap(pos -> getVertices(pos, blocks))
4242
.map(v -> applyRegionOffset(v, region))
4343
.collect(Collectors.toCollection(ArrayList::new));
@@ -111,6 +111,3 @@ private static int[] getVertex(BlockPos pos, int x, int y, int z)
111111
return new int[]{pos.getX() + x, pos.getY() + y, pos.getZ() + z};
112112
}
113113
}
114-
115-
116-

0 commit comments

Comments
 (0)