TheElenium: BLockESP: Added support for NBT-Data filtering#5933
Open
TheElenium wants to merge 2 commits intoMeteorDevelopment:masterfrom
Open
TheElenium: BLockESP: Added support for NBT-Data filtering#5933TheElenium wants to merge 2 commits intoMeteorDevelopment:masterfrom
TheElenium wants to merge 2 commits intoMeteorDevelopment:masterfrom
Conversation
crosby-moe
suggested changes
Dec 16, 2025
Collaborator
crosby-moe
left a comment
There was a problem hiding this comment.
- 'NBT Data' is the wrong nomenclature here since they only apply to block entities & entities, you should call them 'Properties' instead
- property filters should apply to all blocks
- please dont touch the formatting on lines you dont otherwise modify
Comment on lines
108
to
111
| private final Map< | ||
| Block, | ||
| Map<Property<?>, Comparable<?>> | ||
| > activeFilterCache = new HashMap<>(); |
Collaborator
There was a problem hiding this comment.
this map is always empty
Comment on lines
117
to
128
| sgFilters.add(new StringListSetting.Builder() | ||
| .name("NBT-Data") | ||
| .description("Filters with states (e.g. 'waterlogged=false', 'facing=north', 'ominous=true'). Only blocks matching ALL filters will be shown.") | ||
| .defaultValue(new ArrayList<>()) | ||
| .onModuleActivated(stringSetting -> stringSetting.set(blockData.stateFilters)) | ||
| .onChanged(filters -> { | ||
| blockData.stateFilters.clear(); | ||
| blockData.stateFilters.addAll(filters); | ||
| onChanged(); | ||
| }) | ||
| .build() | ||
| ); |
Collaborator
There was a problem hiding this comment.
imho using a string list for this is super unintuitive, it should be a separate setting type
| public boolean tracer; | ||
| public SettingColor tracerColor; | ||
|
|
||
| public List<String> stateFilters = new ArrayList<>(); |
Comment on lines
+329
to
+354
| private boolean matchesStateFilters(BlockState state, Block block, List<String> filters) { | ||
| for (String filter : filters) { | ||
| try { | ||
| // Parse "key=value" format | ||
| String[] kv = filter.split("="); | ||
| if (kv.length != 2) continue; | ||
|
|
||
| String propertyName = kv[0].trim(); | ||
| String expectedValue = kv[1].trim(); | ||
|
|
||
| Property<?> property = block.getStateManager().getProperty(propertyName); | ||
| if (property == null) continue; | ||
|
|
||
| Optional<?> parsedValue = property.parse(expectedValue); | ||
| if (parsedValue.isEmpty()) continue; | ||
|
|
||
| if (!state.get(property).equals(parsedValue.get())) { | ||
| return false; | ||
| } | ||
| } catch (Exception e) { | ||
| // Invalid filter format | ||
| } | ||
| } | ||
|
|
||
| return true; | ||
| } |
Collaborator
There was a problem hiding this comment.
this is a hot method, parsing should be done ahead of time
f8fb17e to
69f5c66
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of change
Description
Added a feature to the BlockESP module to allow players to filter searched block by nbt data (e.g. waterlogged, facing=north/west etc.). Mainly implemented it, because i wanted an easier way to find ominous trial vaults, but the normal esp modules had no option to distinguish between a normal and an ominous, since they are the same block (minecraft:vault).
Related issues
None
How Has This Been Tested?
I created some blocks that only differ in the nbt data and filtered the in the blockesp module for those tags in the specific block configs
Checklist: