Skip to content

Commit e7e6161

Browse files
committed
Improved ESP
1 parent 7c2c7e7 commit e7e6161

File tree

9 files changed

+761
-69
lines changed

9 files changed

+761
-69
lines changed

src/main/java/dev/xpple/seedmapper/SeedMapper.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,5 +113,7 @@ private static void registerCommands(CommandDispatcher<FabricClientCommandSource
113113
WorldPresetCommand.register(dispatcher);
114114
DiscordCommand.register(dispatcher);
115115
SampleCommand.register(dispatcher);
116+
// ESP config command
117+
dev.xpple.seedmapper.command.commands.EspConfigCommand.register(dispatcher);
116118
}
117119
}

src/main/java/dev/xpple/seedmapper/command/commands/EspConfigCommand.java

Lines changed: 431 additions & 0 deletions
Large diffs are not rendered by default.

src/main/java/dev/xpple/seedmapper/command/commands/HighlightCommand.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import dev.xpple.seedmapper.config.Configs;
2020
import dev.xpple.seedmapper.feature.OreTypes;
2121
import dev.xpple.seedmapper.render.RenderManager;
22+
import dev.xpple.seedmapper.render.esp.EspStyle;
2223
import dev.xpple.seedmapper.util.ComponentUtils;
2324
import dev.xpple.seedmapper.util.SpiralLoop;
2425
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
@@ -169,7 +170,7 @@ private static int highlightBlock(CustomClientCommandSource source, Pair<Integer
169170
.toList();
170171
count[0] += blockOres.size();
171172
source.getClient().schedule(() -> {
172-
RenderManager.drawBoxes(blockOres, colour);
173+
RenderManager.drawBoxes(blockOres, Configs.BlockHighlightESP, colour);
173174
source.sendFeedback(Component.translatable("command.highlight.block.chunkSuccess", accent(String.valueOf(blockOres.size())), ComponentUtils.formatXZ(chunkX, chunkZ)));
174175
});
175176

@@ -229,7 +230,7 @@ private static int highlightOreVein(CustomClientCommandSource source, int chunkR
229230
}
230231
count[0] += positions.size();
231232
int colour = BLOCKS.values().stream().filter(pair -> Objects.equals(block, pair.getFirst())).findAny().orElseThrow().getSecond();
232-
RenderManager.drawBoxes(positions, colour);
233+
RenderManager.drawBoxes(positions, Configs.OreVeinESP, colour);
233234
if (block == Cubiomes.RAW_COPPER_BLOCK() || block == Cubiomes.RAW_IRON_BLOCK()) {
234235
source.getClient().schedule(() -> source.sendFeedback(Component.translatable("command.highlight.oreVein.rawBlocks", ComponentUtils.formatXYZCollection(positions))));
235236
}
@@ -279,7 +280,7 @@ private static int highlightTerrain(CustomClientCommandSource source, int chunkR
279280
}
280281
return false;
281282
});
282-
RenderManager.drawBoxes(blocks, 0xFF_FF0000);
283+
RenderManager.drawBoxes(blocks, Configs.TerrainESP, 0xFF_FF0000);
283284
return blocks.size();
284285
}
285286
}
@@ -302,7 +303,7 @@ private static int highlightCanyon(CustomClientCommandSource source, int canyonC
302303
throw CommandExceptions.INVALID_DIMENSION_EXCEPTION.create();
303304
}
304305
var biomeFunction = LocateCommand.getCarverBiomeFunction(arena, seed, dimension, version);
305-
return highlightCarver(source, chunkRange, (chunkX, chunkZ) -> {
306+
return highlightCarver(source, chunkRange, Configs.CanyonESP, (chunkX, chunkZ) -> {
306307
int biome = biomeFunction.applyAsInt(chunkX, chunkZ);
307308
if (Cubiomes.isViableCanyonBiome(canyonCarver, biome) == 0) {
308309
return null;
@@ -330,7 +331,7 @@ private static int highlightCave(CustomClientCommandSource source, int caveCarve
330331
throw CommandExceptions.INVALID_DIMENSION_EXCEPTION.create();
331332
}
332333
var biomeFunction = LocateCommand.getCarverBiomeFunction(arena, seed, dimension, version);
333-
return highlightCarver(source, chunkRange, (chunkX, chunkZ) -> {
334+
return highlightCarver(source, chunkRange, Configs.CaveESP, (chunkX, chunkZ) -> {
334335
int biome = biomeFunction.applyAsInt(chunkX, chunkZ);
335336
if (Cubiomes.isViableCaveBiome(caveCarver, biome) == 0) {
336337
return null;
@@ -340,7 +341,7 @@ private static int highlightCave(CustomClientCommandSource source, int caveCarve
340341
}
341342
}
342343

343-
private static int highlightCarver(CustomClientCommandSource source, int chunkRange, BiFunction<Integer, Integer, @Nullable MemorySegment> carverFunction) {
344+
private static int highlightCarver(CustomClientCommandSource source, int chunkRange, EspStyle style, BiFunction<Integer, Integer, @Nullable MemorySegment> carverFunction) {
344345
ChunkPos center = new ChunkPos(BlockPos.containing(source.getPosition()));
345346
Set<BlockPos> blocks = new HashSet<>();
346347
SpiralLoop.spiral(center.x, center.z, chunkRange, (chunkX, chunkZ) -> {
@@ -357,7 +358,7 @@ private static int highlightCarver(CustomClientCommandSource source, int chunkRa
357358

358359
return false;
359360
});
360-
RenderManager.drawBoxes(blocks, 0xFF_FF0000);
361+
RenderManager.drawBoxes(blocks, style, 0xFF_FF0000);
361362
source.getClient().schedule(() -> source.sendFeedback(Component.translatable("command.highlight.carver.success", accent(String.valueOf(blocks.size())))));
362363
return blocks.size();
363364
}

src/main/java/dev/xpple/seedmapper/config/Configs.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import net.minecraft.client.Minecraft;
1212
import net.minecraft.network.chat.Component;
1313
import net.minecraft.util.Util;
14+
import dev.xpple.seedmapper.render.esp.EspStyle;
1415

1516
import java.util.EnumSet;
1617
import java.util.HashMap;
@@ -141,6 +142,28 @@ public static Component getDevModeComment() {
141142
return Component.translatable("config.devMode.comment");
142143
}
143144

145+
@Config(comment = "getEspTimeoutComment")
146+
public static double EspTimeoutMinutes = 5.0D;
147+
148+
private static Component getEspTimeoutComment() {
149+
return Component.translatable("config.espTimeout.comment");
150+
}
151+
152+
@Config
153+
public static EspStyle BlockHighlightESP = EspStyle.useCommandColorDefaults();
154+
155+
@Config
156+
public static EspStyle OreVeinESP = EspStyle.useCommandColorDefaults();
157+
158+
@Config
159+
public static EspStyle TerrainESP = EspStyle.useCommandColorDefaults();
160+
161+
@Config
162+
public static EspStyle CanyonESP = EspStyle.useCommandColorDefaults();
163+
164+
@Config
165+
public static EspStyle CaveESP = EspStyle.useCommandColorDefaults();
166+
144167
@Config(setter = @Config.Setter("setWorldPresetId"))
145168
public static String WorldPresetId = "minecraft:default";
146169

src/main/java/dev/xpple/seedmapper/render/NoDepthLayer.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,25 @@ private NoDepthLayer() {
2121
.build()
2222
);
2323

24+
// pipeline for filled quads (renders quads as two triangles each)
25+
private static final RenderPipeline QUADS_NO_DEPTH_PIPELINE = RenderPipelines.register(
26+
RenderPipeline.builder(RenderPipelines.DEBUG_FILLED_SNIPPET)
27+
.withLocation(Identifier.fromNamespaceAndPath(SeedMapper.MOD_ID, "pipeline/quads_no_depth"))
28+
.withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST)
29+
.build()
30+
);
31+
2432
public static final RenderType LINES_NO_DEPTH_LAYER = RenderType.create(SeedMapper.MOD_ID + "_no_depth",
2533
RenderSetup.builder(LINES_NO_DEPTH_PIPELINE)
2634
.setLayeringTransform(LayeringTransform.VIEW_OFFSET_Z_LAYERING)
2735
.setOutputTarget(OutputTarget.ITEM_ENTITY_TARGET)
2836
.createRenderSetup()
2937
);
38+
39+
public static final RenderType QUADS_NO_DEPTH_LAYER = RenderType.create(SeedMapper.MOD_ID + "_quads_no_depth",
40+
RenderSetup.builder(QUADS_NO_DEPTH_PIPELINE)
41+
.setLayeringTransform(LayeringTransform.VIEW_OFFSET_Z_LAYERING)
42+
.setOutputTarget(OutputTarget.ITEM_ENTITY_TARGET)
43+
.createRenderSetup()
44+
);
3045
}

0 commit comments

Comments
 (0)