Skip to content

Commit f8d21e7

Browse files
committed
reverting logically unchanged lines, renaming to stateFilters
1 parent f8fb17e commit f8d21e7

File tree

3 files changed

+44
-73
lines changed

3 files changed

+44
-73
lines changed

src/main/java/meteordevelopment/meteorclient/systems/modules/render/blockesp/BlockESP.java

Lines changed: 39 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -42,89 +42,60 @@ public class BlockESP extends Module {
4242

4343
// General
4444

45-
private final Setting<List<Block>> blocks = sgGeneral.add(
46-
new BlockListSetting.Builder()
47-
.name("blocks")
48-
.description("Blocks to search for.")
49-
.onChanged(blocks1 -> {
50-
if (isActive() && Utils.canUpdate()) onActivate();
51-
})
52-
.build()
45+
private final Setting<List<Block>> blocks = sgGeneral.add(new BlockListSetting.Builder()
46+
.name("blocks")
47+
.description("Blocks to search for.")
48+
.onChanged(blocks1 -> {
49+
if (isActive() && Utils.canUpdate()) onActivate();
50+
})
51+
.build()
5352
);
54-
55-
// uncomment if NBT-Data should apply to all blocks !!! UNTESTED !!!
56-
57-
/*
58-
private final Setting<List<String>> customFilters = sgGeneral.add(
59-
new StringListSetting.Builder()
60-
.name("NTB-Data")
61-
.description(
62-
"Filters with ntbdata (e.g. 'waterlogged=true')."
53+
54+
private final Setting<ESPBlockData> defaultBlockConfig = sgGeneral.add(new GenericSetting.Builder<ESPBlockData>()
55+
.name("default-block-config")
56+
.description("Default block config.")
57+
.defaultValue(
58+
new ESPBlockData(
59+
ShapeMode.Lines,
60+
new SettingColor(0, 255, 200),
61+
new SettingColor(0, 255, 200, 25),
62+
true,
63+
new SettingColor(0, 255, 200, 125)
6364
)
64-
.defaultValue(new ArrayList<>())
65-
.onChanged(this::parseFilters)
66-
.build()
65+
)
66+
.build()
6767
);
68-
*/
69-
70-
private final Setting<ESPBlockData> defaultBlockConfig = sgGeneral.add(
71-
new GenericSetting.Builder<ESPBlockData>()
72-
.name("default-block-config")
73-
.description("Default block config.")
74-
.defaultValue(
75-
new ESPBlockData(
76-
ShapeMode.Lines,
77-
new SettingColor(0, 255, 200),
78-
new SettingColor(0, 255, 200, 25),
79-
true,
80-
new SettingColor(0, 255, 200, 125)
81-
)
82-
)
83-
.build()
68+
69+
private final Setting<Map<Block, ESPBlockData>> blockConfigs = sgGeneral.add(new BlockDataSetting.Builder<ESPBlockData>()
70+
.name("block-configs")
71+
.description("Config for each block.")
72+
.defaultData(defaultBlockConfig)
73+
.onChanged(configs -> {
74+
if (isActive() && Utils.canUpdate()) onActivate();
75+
})
76+
.build()
8477
);
8578

86-
private final Setting<Map<Block, ESPBlockData>> blockConfigs =
87-
sgGeneral.add(
88-
new BlockDataSetting.Builder<ESPBlockData>()
89-
.name("block-configs")
90-
.description("Config for each block.")
91-
.defaultData(defaultBlockConfig)
92-
.onChanged(configs -> {
93-
if (isActive() && Utils.canUpdate()) onActivate();
94-
})
95-
.build()
96-
);
97-
98-
private final Setting<Boolean> tracers = sgGeneral.add(
99-
new BoolSetting.Builder()
100-
.name("tracers")
101-
.description("Render tracer lines.")
102-
.defaultValue(false)
103-
.build()
79+
private final Setting<Boolean> tracers = sgGeneral.add(new BoolSetting.Builder()
80+
.name("tracers")
81+
.description("Render tracer lines.")
82+
.defaultValue(false)
83+
.build()
10484
);
10585

10686
private final BlockPos.Mutable blockPos = new BlockPos.Mutable();
10787

108-
private final Map<
109-
Block,
110-
Map<Property<?>, Comparable<?>>
111-
> activeFilterCache = new HashMap<>();
88+
private final Map<Block, Map<Property<?>, Comparable<?>>> activeFilterCache = new HashMap<>();
11289

113-
private final Long2ObjectMap<ESPChunk> chunks =
114-
new Long2ObjectOpenHashMap<>();
90+
private final Long2ObjectMap<ESPChunk> chunks = new Long2ObjectOpenHashMap<>();
11591
private final Set<ESPGroup> groups = new ReferenceOpenHashSet<>();
116-
private final ExecutorService workerThread =
117-
Executors.newSingleThreadExecutor();
92+
private final ExecutorService workerThread = Executors.newSingleThreadExecutor();
11893

11994
private DimensionType lastDimension;
12095

12196
public BlockESP() {
122-
super(
123-
Categories.Render,
124-
"block-esp",
125-
"Renders specified blocks through walls.",
126-
"search"
127-
);
97+
super(Categories.Render, "block-esp", "Renders specified blocks through walls.", "search");
98+
12899
RainbowColors.register(this::onTickRainbow);
129100
}
130101

src/main/java/meteordevelopment/meteorclient/systems/modules/render/blockesp/ESPBlockData.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class ESPBlockData implements IGeneric<ESPBlockData>, IChangeable, IBlock
3131
public boolean tracer;
3232
public SettingColor tracerColor;
3333

34-
public List<String> stateFilters = new ArrayList<>();
34+
public final List<String> stateFilters = new ArrayList<>();
3535

3636
private boolean changed;
3737

@@ -108,7 +108,7 @@ public NbtCompound toTag() {
108108
for (String filter : stateFilters) {
109109
filtersList.add(NbtString.of(filter));
110110
}
111-
tag.put("NBT-Data", filtersList);
111+
tag.put("stateFilters", filtersList);
112112

113113
tag.putBoolean("changed", changed);
114114

@@ -125,7 +125,7 @@ public ESPBlockData fromTag(NbtCompound tag) {
125125
tracerColor.fromTag(tag.getCompoundOrEmpty("tracerColor"));
126126

127127
stateFilters.clear();
128-
tag.getList("NBT-Data").ifPresent(filtersList -> {
128+
tag.getList("stateFilters").ifPresent(filtersList -> {
129129
for (int i = 0; i < filtersList.size(); i++) {
130130
filtersList.getString(i).ifPresent(stateFilters::add);
131131
}

src/main/java/meteordevelopment/meteorclient/systems/modules/render/blockesp/ESPBlockDataScreen.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public void initWidgets() {
4141
Settings settings = new Settings();
4242
SettingGroup sgGeneral = settings.getDefaultGroup();
4343
SettingGroup sgTracer = settings.createGroup("Tracer");
44-
SettingGroup sgFilters = settings.createGroup("NBT-Data");
44+
SettingGroup sgFilters = settings.createGroup("stateFilters");
4545

4646
sgGeneral.add(new EnumSetting.Builder<ShapeMode>()
4747
.name("shape-mode")
@@ -115,7 +115,7 @@ public void initWidgets() {
115115

116116
// Add state filters setting
117117
sgFilters.add(new StringListSetting.Builder()
118-
.name("NBT-Data")
118+
.name("stateFilters")
119119
.description("Filters with states (e.g. 'waterlogged=false', 'facing=north', 'ominous=true'). Only blocks matching ALL filters will be shown.")
120120
.defaultValue(new ArrayList<>())
121121
.onModuleActivated(stringSetting -> stringSetting.set(blockData.stateFilters))

0 commit comments

Comments
 (0)