Skip to content

Commit

Permalink
Rename Search to Block ESP
Browse files Browse the repository at this point in the history
  • Loading branch information
RacoonDog authored and arlomcwalter committed Dec 16, 2022
1 parent 8011a2b commit f1ca61b
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 107 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import meteordevelopment.meteorclient.systems.modules.player.*;
import meteordevelopment.meteorclient.systems.modules.render.*;
import meteordevelopment.meteorclient.systems.modules.render.marker.Marker;
import meteordevelopment.meteorclient.systems.modules.render.search.Search;
import meteordevelopment.meteorclient.systems.modules.render.blockesp.BlockESP;
import meteordevelopment.meteorclient.systems.modules.world.Timer;
import meteordevelopment.meteorclient.systems.modules.world.*;
import meteordevelopment.meteorclient.utils.Utils;
Expand Down Expand Up @@ -501,7 +501,7 @@ private void initRender() {
add(new Marker());
add(new Nametags());
add(new NoRender());
add(new Search());
add(new BlockESP());
add(new StorageESP());
add(new TimeChanger());
add(new Tracers());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) Meteor Development.
*/

package meteordevelopment.meteorclient.systems.modules.render.search;
package meteordevelopment.meteorclient.systems.modules.render.blockesp;

import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
Expand Down Expand Up @@ -32,7 +32,7 @@
import java.util.List;
import java.util.Map;

public class Search extends Module {
public class BlockESP extends Module {
private final SettingGroup sgGeneral = settings.getDefaultGroup();

// General
Expand All @@ -46,11 +46,11 @@ public class Search extends Module {
.build()
);

private final Setting<SBlockData> defaultBlockConfig = sgGeneral.add(new GenericSetting.Builder<SBlockData>()
private final Setting<ESPBlockData> defaultBlockConfig = sgGeneral.add(new GenericSetting.Builder<ESPBlockData>()
.name("default-block-config")
.description("Default block config.")
.defaultValue(
new SBlockData(
new ESPBlockData(
ShapeMode.Lines,
new SettingColor(0, 255, 200),
new SettingColor(0, 255, 200, 25),
Expand All @@ -61,7 +61,7 @@ public class Search extends Module {
.build()
);

private final Setting<Map<Block, SBlockData>> blockConfigs = sgGeneral.add(new BlockDataSetting.Builder<SBlockData>()
private final Setting<Map<Block, ESPBlockData>> blockConfigs = sgGeneral.add(new BlockDataSetting.Builder<ESPBlockData>()
.name("block-configs")
.description("Config for each block.")
.defaultData(defaultBlockConfig)
Expand All @@ -77,13 +77,13 @@ public class Search extends Module {

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

private final Long2ObjectMap<SChunk> chunks = new Long2ObjectOpenHashMap<>();
private final List<SGroup> groups = new UnorderedArrayList<>();
private final Long2ObjectMap<ESPChunk> chunks = new Long2ObjectOpenHashMap<>();
private final List<ESPGroup> groups = new UnorderedArrayList<>();

private Dimension lastDimension;

public Search() {
super(Categories.Render, "search", "Searches for specified blocks.");
public BlockESP() {
super(Categories.Render, "block-esp", "Renders specified blocks through walls.");

RainbowColors.register(this::onTickRainbow);
}
Expand Down Expand Up @@ -114,38 +114,38 @@ private void onTickRainbow() {
if (!isActive()) return;

defaultBlockConfig.get().tickRainbow();
for (SBlockData blockData : blockConfigs.get().values()) blockData.tickRainbow();
for (ESPBlockData blockData : blockConfigs.get().values()) blockData.tickRainbow();
}

SBlockData getBlockData(Block block) {
SBlockData blockData = blockConfigs.get().get(block);
ESPBlockData getBlockData(Block block) {
ESPBlockData blockData = blockConfigs.get().get(block);
return blockData == null ? defaultBlockConfig.get() : blockData;
}

private void updateChunk(int x, int z) {
SChunk chunk = chunks.get(ChunkPos.toLong(x, z));
ESPChunk chunk = chunks.get(ChunkPos.toLong(x, z));
if (chunk != null) chunk.update();
}

private void updateBlock(int x, int y, int z) {
SChunk chunk = chunks.get(ChunkPos.toLong(x >> 4, z >> 4));
ESPChunk chunk = chunks.get(ChunkPos.toLong(x >> 4, z >> 4));
if (chunk != null) chunk.update(x, y, z);
}

public SBlock getBlock(int x, int y, int z) {
SChunk chunk = chunks.get(ChunkPos.toLong(x >> 4, z >> 4));
public ESPBlock getBlock(int x, int y, int z) {
ESPChunk chunk = chunks.get(ChunkPos.toLong(x >> 4, z >> 4));
return chunk == null ? null : chunk.get(x, y, z);
}

public SGroup newGroup(Block block) {
public ESPGroup newGroup(Block block) {
synchronized (chunks) {
SGroup group = new SGroup(block);
ESPGroup group = new ESPGroup(block);
groups.add(group);
return group;
}
}

public void removeGroup(SGroup group) {
public void removeGroup(ESPGroup group) {
synchronized (chunks) {
groups.remove(group);
}
Expand All @@ -159,7 +159,7 @@ private void onChunkData(ChunkDataEvent event) {
private void searchChunk(Chunk chunk, ChunkDataEvent event) {
MeteorExecutor.execute(() -> {
if (!isActive()) return;
SChunk schunk = SChunk.searchChunk(chunk, blocks.get());
ESPChunk schunk = ESPChunk.searchChunk(chunk, blocks.get());

if (schunk.size() > 0) {
synchronized (chunks) {
Expand Down Expand Up @@ -195,10 +195,10 @@ private void onBlockUpdate(BlockUpdateEvent event) {
if (added || removed) {
MeteorExecutor.execute(() -> {
synchronized (chunks) {
SChunk chunk = chunks.get(key);
ESPChunk chunk = chunks.get(key);

if (chunk == null) {
chunk = new SChunk(chunkX, chunkZ);
chunk = new ESPChunk(chunkX, chunkZ);
if (chunk.shouldBeDeleted()) return;

chunks.put(key, chunk);
Expand Down Expand Up @@ -236,12 +236,12 @@ private void onPostTick(TickEvent.Post event) {
@EventHandler
private void onRender(Render3DEvent event) {
synchronized (chunks) {
for (Iterator<SChunk> it = chunks.values().iterator(); it.hasNext();) {
SChunk chunk = it.next();
for (Iterator<ESPChunk> it = chunks.values().iterator(); it.hasNext();) {
ESPChunk chunk = it.next();

if (chunk.shouldBeDeleted()) {
MeteorExecutor.execute(() -> {
for (SBlock block : chunk.blocks.values()) {
for (ESPBlock block : chunk.blocks.values()) {
block.group.remove(block, false);
block.loaded = false;
}
Expand All @@ -253,8 +253,8 @@ private void onRender(Render3DEvent event) {
}

if (tracers.get()) {
for (Iterator<SGroup> it = groups.iterator(); it.hasNext();) {
SGroup group = it.next();
for (Iterator<ESPGroup> it = groups.iterator(); it.hasNext();) {
ESPGroup group = it.next();

if (group.blocks.isEmpty()) it.remove();
else group.render(event);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) Meteor Development.
*/

package meteordevelopment.meteorclient.systems.modules.render.search;
package meteordevelopment.meteorclient.systems.modules.render.blockesp;

import meteordevelopment.meteorclient.events.render.Render3DEvent;
import meteordevelopment.meteorclient.renderer.ShapeMode;
Expand All @@ -17,10 +17,10 @@

import static meteordevelopment.meteorclient.MeteorClient.mc;

public class SBlock {
public class ESPBlock {
private static final BlockPos.Mutable blockPos = new BlockPos.Mutable();

private static final Search search = Modules.get().get(Search.class);
private static final BlockESP blockEsp = Modules.get().get(BlockESP.class);

public static final int FO = 1 << 1;
public static final int FO_RI = 1 << 2;
Expand Down Expand Up @@ -48,36 +48,36 @@ public class SBlock {
private BlockState state;
public int neighbours;

public SGroup group;
public ESPGroup group;

public boolean loaded = true;

public SBlock(int x, int y, int z) {
public ESPBlock(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
}

public SBlock getSideBlock(int side) {
public ESPBlock getSideBlock(int side) {
switch (side) {
case FO: return search.getBlock(x, y, z + 1);
case BA: return search.getBlock(x, y, z - 1);
case LE: return search.getBlock(x - 1, y, z);
case RI: return search.getBlock(x + 1, y, z);
case TO: return search.getBlock(x, y + 1, z);
case BO: return search.getBlock(x, y - 1, z);
case FO: return blockEsp.getBlock(x, y, z + 1);
case BA: return blockEsp.getBlock(x, y, z - 1);
case LE: return blockEsp.getBlock(x - 1, y, z);
case RI: return blockEsp.getBlock(x + 1, y, z);
case TO: return blockEsp.getBlock(x, y + 1, z);
case BO: return blockEsp.getBlock(x, y - 1, z);
}

return null;
}

private void assignGroup() {
SGroup firstGroup = null;
ESPGroup firstGroup = null;

for (int side : SIDES) {
if ((neighbours & side) != side) continue;

SBlock neighbour = getSideBlock(side);
ESPBlock neighbour = getSideBlock(side);
if (neighbour == null || neighbour.group == null) continue;

if (firstGroup == null) {
Expand All @@ -89,7 +89,7 @@ private void assignGroup() {
}

if (firstGroup == null) {
firstGroup = search.newGroup(state.getBlock());
firstGroup = blockEsp.newGroup(state.getBlock());
}

firstGroup.add(this);
Expand Down Expand Up @@ -188,7 +188,7 @@ public void render(Render3DEvent event) {
z2 = z + shape.getMax(Direction.Axis.Z);
}

SBlockData blockData = search.getBlockData(state.getBlock());
ESPBlockData blockData = blockEsp.getBlockData(state.getBlock());

ShapeMode shapeMode = blockData.shapeMode;
Color lineColor = blockData.lineColor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) Meteor Development.
*/

package meteordevelopment.meteorclient.systems.modules.render.search;
package meteordevelopment.meteorclient.systems.modules.render.blockesp;

import meteordevelopment.meteorclient.gui.GuiTheme;
import meteordevelopment.meteorclient.gui.WidgetScreen;
Expand All @@ -18,7 +18,7 @@
import net.minecraft.block.Block;
import net.minecraft.nbt.NbtCompound;

public class SBlockData implements ICopyable<SBlockData>, ISerializable<SBlockData>, IChangeable, IBlockData<SBlockData>, IScreenFactory {
public class ESPBlockData implements ICopyable<ESPBlockData>, ISerializable<ESPBlockData>, IChangeable, IBlockData<ESPBlockData>, IScreenFactory {
public ShapeMode shapeMode;
public SettingColor lineColor;
public SettingColor sideColor;
Expand All @@ -28,7 +28,7 @@ public class SBlockData implements ICopyable<SBlockData>, ISerializable<SBlockDa

private boolean changed;

public SBlockData(ShapeMode shapeMode, SettingColor lineColor, SettingColor sideColor, boolean tracer, SettingColor tracerColor) {
public ESPBlockData(ShapeMode shapeMode, SettingColor lineColor, SettingColor sideColor, boolean tracer, SettingColor tracerColor) {
this.shapeMode = shapeMode;
this.lineColor = lineColor;
this.sideColor = sideColor;
Expand All @@ -38,13 +38,13 @@ public SBlockData(ShapeMode shapeMode, SettingColor lineColor, SettingColor side
}

@Override
public WidgetScreen createScreen(GuiTheme theme, Block block, BlockDataSetting<SBlockData> setting) {
return new SBlockDataScreen(theme, this, block, setting);
public WidgetScreen createScreen(GuiTheme theme, Block block, BlockDataSetting<ESPBlockData> setting) {
return new ESPBlockDataScreen(theme, this, block, setting);
}

@Override
public WidgetScreen createScreen(GuiTheme theme) {
return new SBlockDataScreen(theme, this, null, null);
return new ESPBlockDataScreen(theme, this, null, null);
}

@Override
Expand All @@ -63,7 +63,7 @@ public void tickRainbow() {
}

@Override
public SBlockData set(SBlockData value) {
public ESPBlockData set(ESPBlockData value) {
shapeMode = value.shapeMode;
lineColor.set(value.lineColor);
sideColor.set(value.sideColor);
Expand All @@ -77,8 +77,8 @@ public SBlockData set(SBlockData value) {
}

@Override
public SBlockData copy() {
return new SBlockData(shapeMode, new SettingColor(lineColor), new SettingColor(sideColor), tracer, new SettingColor(tracerColor));
public ESPBlockData copy() {
return new ESPBlockData(shapeMode, new SettingColor(lineColor), new SettingColor(sideColor), tracer, new SettingColor(tracerColor));
}

@Override
Expand All @@ -98,7 +98,7 @@ public NbtCompound toTag() {
}

@Override
public SBlockData fromTag(NbtCompound tag) {
public ESPBlockData fromTag(NbtCompound tag) {
shapeMode = ShapeMode.valueOf(tag.getString("shapeMode"));
lineColor.fromTag(tag.getCompound("lineColor"));
sideColor.fromTag(tag.getCompound("sideColor"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) Meteor Development.
*/

package meteordevelopment.meteorclient.systems.modules.render.search;
package meteordevelopment.meteorclient.systems.modules.render.blockesp;

import meteordevelopment.meteorclient.gui.GuiTheme;
import meteordevelopment.meteorclient.gui.WindowScreen;
Expand All @@ -12,12 +12,12 @@
import meteordevelopment.meteorclient.utils.render.color.SettingColor;
import net.minecraft.block.Block;

public class SBlockDataScreen extends WindowScreen {
private final SBlockData blockData;
public class ESPBlockDataScreen extends WindowScreen {
private final ESPBlockData blockData;
private final Block block;
private final BlockDataSetting<SBlockData> setting;
private final BlockDataSetting<ESPBlockData> setting;

public SBlockDataScreen(GuiTheme theme, SBlockData blockData, Block block, BlockDataSetting<SBlockData> setting) {
public ESPBlockDataScreen(GuiTheme theme, ESPBlockData blockData, Block block, BlockDataSetting<ESPBlockData> setting) {
super(theme, "Configure Block");

this.blockData = blockData;
Expand Down Expand Up @@ -95,7 +95,7 @@ public void initWidgets() {
add(theme.settings(settings)).expandX();
}

private void changed(SBlockData blockData, Block block, BlockDataSetting<SBlockData> setting) {
private void changed(ESPBlockData blockData, Block block, BlockDataSetting<ESPBlockData> setting) {
if (!blockData.isChanged() && block != null && setting != null) {
setting.get().put(block, blockData);
setting.onChanged();
Expand Down
Loading

0 comments on commit f1ca61b

Please sign in to comment.