Skip to content

Commit 2d54929

Browse files
committed
Above Ground Option Updated
1 parent 7c21392 commit 2d54929

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ Examples:
224224
- Extended up to 65×65 chunks for all chunk-based features.
225225

226226
### Above Ground (New Option)
227-
- ItemESP, MobSearch, ChestESP, BedESP, SignESP, PortalESP, RedstoneESP and WorkstationESP now have an adjustable Y limit (default 62 which is approximately sea level)
227+
- ItemESP, MobSearch, Search, ChestESP, BedESP, SignESP, PortalESP, RedstoneESP and WorkstationESP now have an adjustable Y limit (default 62 which is approximately sea level)
228228
- There is a global toggle and setting that can apply to all, or the user can set toggle and set them individually in the hack's settings (```.aboveground on/off```, ```.aboveground toggle```, ```.aboveground y #```)
229229
- This will help prevent you from detecting inaccessible mobs/items and essentially only scanning the surface of the world
230230

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

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ private enum SearchMode
9090
new net.wurstclient.settings.CheckboxSetting("HackList count",
9191
"Appends the number of found blocks to this hack's entry in the HackList.",
9292
false);
93+
94+
// Above-ground filter
95+
private final net.wurstclient.settings.CheckboxSetting onlyAboveGround =
96+
new net.wurstclient.settings.CheckboxSetting("Above ground only",
97+
"Only show blocks at or above the configured Y level.", false);
98+
private final SliderSetting aboveGroundY = new SliderSetting(
99+
"Above ground Y", 62, 0, 255, 1, SliderSetting.ValueDisplay.INTEGER);
93100
private Block lastBlock;
94101
private String lastQuery = "";
95102
private ChunkAreaSetting.ChunkArea lastAreaSelection;
@@ -145,6 +152,8 @@ public SearchHack()
145152
addSetting(fixedColor);
146153
addSetting(area);
147154
addSetting(limit);
155+
addSetting(onlyAboveGround);
156+
addSetting(aboveGroundY);
148157
// new setting
149158
addSetting(showCountInHackList);
150159
}
@@ -390,6 +399,8 @@ private void applySearchCriteria(Block currentBlock, String normalizedQuery)
390399
listExactIds = exact;
391400
listKeywords = kw.toArray(new String[0]);
392401
coordinator.setQuery((pos, state) -> {
402+
if(onlyAboveGround.isChecked() && pos.getY() < aboveGroundY.getValue())
403+
return false;
393404
String idFull = BlockUtils.getName(state.getBlock());
394405
if(listExactIds.contains(idFull))
395406
return true;
@@ -414,13 +425,21 @@ private void applySearchCriteria(Block currentBlock, String normalizedQuery)
414425
case QUERY:
415426
lastBlock = currentBlock;
416427
coordinator.setQuery((pos,
417-
state) -> blockMatchesQuery(state.getBlock(), normalizedQuery));
428+
state) -> {
429+
if(onlyAboveGround.isChecked() && pos.getY() < aboveGroundY.getValue())
430+
return false;
431+
return blockMatchesQuery(state.getBlock(), normalizedQuery);
432+
});
418433
lastQuery = normalizedQuery;
419434
break;
420435
case BLOCK_ID:
421436
default:
422437
lastBlock = currentBlock;
423-
coordinator.setTargetBlock(currentBlock);
438+
coordinator.setQuery((pos, state) -> {
439+
if(onlyAboveGround.isChecked() && pos.getY() < aboveGroundY.getValue())
440+
return false;
441+
return state.getBlock() == currentBlock;
442+
});
424443
lastQuery = "";
425444
}
426445
notify = true;

0 commit comments

Comments
 (0)