Skip to content

Commit 5d2cbf7

Browse files
committed
Add DevMode config + add 1.21.10 to version list + prevent occasional off-thread rendering bug
1 parent 2585ab2 commit 5d2cbf7

File tree

7 files changed

+44
-24
lines changed

7 files changed

+44
-24
lines changed

gradle.properties

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ maven_group=dev.xpple
88
archives_base_name=seedmapper
99

1010
# Minecraft properties
11-
minecraft_version=1.21.10-rc1
12-
minecraft_version_dependency=>=1.21.9-rc.1 <1.22
11+
minecraft_version=1.21.10
12+
minecraft_version_dependency=>=1.21.10 <1.22
1313

1414
# Fabric Properties
1515
# check these on https://fabricmc.net/develop
1616
# https://maven.parchmentmc.org/org/parchmentmc/data/
17-
fabric_api_version=0.134.1+1.21.10
18-
parchment_mappings=parchment-1.21.8:2025.09.14@zip
19-
fabric_loader_version=0.17.2
17+
fabric_api_version=0.135.0+1.21.10
18+
parchment_mappings=parchment-1.21.9:2025.10.05@zip
19+
fabric_loader_version=0.17.3
2020
fabric_loom_version=1.11-SNAPSHOT
2121

2222
# Library dependencies

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import dev.xpple.seedmapper.util.SeedDatabaseHelper;
2323
import dev.xpple.simplewaypoints.api.SimpleWaypointsAPI;
2424
import net.fabricmc.api.ClientModInitializer;
25+
import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager;
2526
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
2627
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
2728
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
@@ -60,6 +61,14 @@ public void onInitializeClient() {
6061
new ModConfigBuilder<>(MOD_ID, Configs.class)
6162
.registerType(SeedResolutionArgument.SeedResolution.class, new SeedResolutionAdapter(), SeedResolutionArgument::seedResolution)
6263
.registerType(MapFeature.class, new MapFeatureAdapter(), MapFeatureArgument::mapFeature)
64+
.registerGlobalChangeHook(event -> {
65+
if (event.config().equals("DevMode")) {
66+
try {
67+
ClientCommandManager.refreshCommandCompletions();
68+
} catch (IllegalStateException _) {
69+
}
70+
}
71+
})
6372
.build();
6473

6574
SimpleWaypointsAPI.getInstance().registerCommandAlias("sm:waypoint");

src/main/java/dev/xpple/seedmapper/command/arguments/VersionArgument.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ public class VersionArgument implements ArgumentType<Integer> {
130130
.put("1.21.7", Cubiomes.MC_1_21_5())
131131
.put("1.21.8", Cubiomes.MC_1_21_5())
132132
.put("1.21.9", Cubiomes.MC_1_21_9())
133+
.put("1.21.10", Cubiomes.MC_1_21_9())
133134
.build();
134135
//</editor-fold>
135136

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ public static void register(CommandDispatcher<FabricClientCommandSource> dispatc
6363
.then(argument("chunks", integer(0, 20))
6464
.executes(ctx -> submit(() -> highlightOreVein(CustomClientCommandSource.of(ctx.getSource()), getInteger(ctx, "chunks"))))))
6565
.then(literal("canyon")
66-
.requires(_ -> false) // TODO add config + client command tree updating
66+
.requires(_ -> Configs.DevMode)
6767
.then(argument("canyon", canyonCarver())
6868
.executes(ctx -> highlightCanyon(CustomClientCommandSource.of(ctx.getSource()), getCanyonCarver(ctx, "canyon")))
6969
.then(argument("chunks", integer(0, 20))
7070
.executes(ctx -> highlightCanyon(CustomClientCommandSource.of(ctx.getSource()), getCanyonCarver(ctx, "canyon"), getInteger(ctx, "chunks"))))))
7171
.then(literal("cave")
72-
.requires(_ -> false) // TODO
72+
.requires(_ -> Configs.DevMode)
7373
.then(argument("cave", caveCarver())
7474
.executes(ctx -> highlightCave(CustomClientCommandSource.of(ctx.getSource()), getCaveCarver(ctx, "cave")))
7575
.then(argument("chunks", integer(0, 20))

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

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ public static void register(CommandDispatcher<FabricClientCommandSource> dispatc
8585
.then(argument("item", itemAndEnchantments())
8686
.executes(ctx -> submit(() -> locateLoot(CustomClientCommandSource.of(ctx.getSource()), getInteger(ctx, "amount"), getItemAndEnchantments(ctx, "item")))))))
8787
.then(literal("slimechunk")
88-
.executes(ctx -> submit(() -> locateSlimeChunk(CustomClientCommandSource.of(ctx.getSource())))))
88+
.executes(ctx -> locateSlimeChunk(CustomClientCommandSource.of(ctx.getSource()))))
8989
.then(literal("spawn")
90-
.executes(ctx -> submit(() -> locateSpawn(CustomClientCommandSource.of(ctx.getSource())))))
90+
.executes(ctx -> locateSpawn(CustomClientCommandSource.of(ctx.getSource()))))
9191
.then(literal("orevein")
9292
.then(literal("copper")
9393
.executes(ctx -> submit(() -> locateOreVein(CustomClientCommandSource.of(ctx.getSource()), true))))
@@ -116,7 +116,7 @@ private static int locateBiome(CustomClientCommandSource source, int biome) thro
116116
throw CommandExceptions.NO_BIOME_FOUND_EXCEPTION.create(BIOME_SEARCH_RADIUS);
117117
}
118118

119-
source.sendFeedback(Component.translatable("command.locate.biome.foundAt", ComponentUtils.formatXZ(pos.x(), pos.z())));
119+
source.getClient().schedule(() -> source.sendFeedback(Component.translatable("command.locate.biome.foundAt", ComponentUtils.formatXZ(pos.x(), pos.z()))));
120120
return Command.SINGLE_SUCCESS;
121121
}
122122
}
@@ -177,41 +177,43 @@ private static int locateStructure(CustomClientCommandSource source, StructureAn
177177
throw CommandExceptions.NO_STRUCTURE_FOUND_EXCEPTION.create(Level.MAX_LEVEL_SIZE);
178178
}
179179

180-
source.sendFeedback(Component.translatable("command.locate.feature.structure.foundAt", ComponentUtils.formatXZ(Pos.x(structurePos), Pos.z(structurePos))));
180+
int structureXPos = Pos.x(structurePos);
181+
int structureZPos = Pos.z(structurePos);
182+
source.getClient().schedule(() -> source.sendFeedback(Component.translatable("command.locate.feature.structure.foundAt", ComponentUtils.formatXZ(structureXPos, structureZPos))));
181183

182184
if (structure == Cubiomes.End_City()) {
183-
int numPieces = Cubiomes.getEndCityPieces(pieces, seed, Pos.x(structurePos) >> 4, Pos.z(structurePos) >> 4);
185+
int numPieces = Cubiomes.getEndCityPieces(pieces, seed, structureXPos >> 4, structureZPos >> 4);
184186
IntStream.range(0, numPieces)
185187
.mapToObj(i -> Piece.asSlice(pieces, i))
186188
.filter(piece -> Piece.type(piece) == Cubiomes.END_SHIP())
187189
.findAny() // only one ship per end city
188190
.map(Piece::pos)
189191
.map(city -> new BlockPos(Pos3.x(city), Pos3.y(city) + 60, Pos3.z(city)))
190-
.ifPresent(city -> source.sendFeedback(Component.literal(" - ")
191-
.append(Component.translatable("command.locate.feature.structure.endCity.hasShip", ComponentUtils.formatXYZ(city.getX(), city.getY(), city.getZ())))));
192+
.ifPresent(city -> source.getClient().schedule(() -> source.sendFeedback(Component.literal(" - ")
193+
.append(Component.translatable("command.locate.feature.structure.endCity.hasShip", ComponentUtils.formatXYZ(city.getX(), city.getY(), city.getZ()))))));
192194
} else if (structure == Cubiomes.Fortress()) {
193-
int numPieces = Cubiomes.getFortressPieces(pieces, StructureChecks.MAX_END_CITY_AND_FORTRESS_PIECES, version, seed, Pos.x(structurePos) >> 4, Pos.z(structurePos) >> 4);
195+
int numPieces = Cubiomes.getFortressPieces(pieces, StructureChecks.MAX_END_CITY_AND_FORTRESS_PIECES, version, seed, structureXPos >> 4, structureZPos >> 4);
194196
IntStream.range(0, numPieces)
195197
.mapToObj(i -> Piece.asSlice(pieces, i))
196198
.filter(piece -> Piece.type(piece) == Cubiomes.BRIDGE_SPAWNER())
197199
.map(Piece::pos)
198200
.map(monsterThrone -> new BlockPos(Pos3.x(monsterThrone), Pos3.y(monsterThrone) + 10, Pos3.z(monsterThrone)))
199-
.forEach(spawnerPos -> source.sendFeedback(Component.literal(" - ")
200-
.append(Component.translatable("command.locate.feature.structure.fortress.hasSpawner", ComponentUtils.formatXYZ(spawnerPos.getX(), spawnerPos.getY(), spawnerPos.getZ())))));
201+
.forEach(spawnerPos -> source.getClient().schedule(() -> source.sendFeedback(Component.literal(" - ")
202+
.append(Component.translatable("command.locate.feature.structure.fortress.hasSpawner", ComponentUtils.formatXYZ(spawnerPos.getX(), spawnerPos.getY(), spawnerPos.getZ()))))));
201203
}
202204

203205
if (!variantData) {
204206
return Command.SINGLE_SUCCESS;
205207
}
206-
int biome = Cubiomes.getBiomeAt(generator, 4, Pos.x(structurePos) >> 2, 320 >> 2, Pos.z(structurePos) >> 2);
207-
Cubiomes.getVariant(structureVariant, structure, version, seed, Pos.x(structurePos), Pos.z(structurePos), biome);
208+
int biome = Cubiomes.getBiomeAt(generator, 4, structureXPos >> 2, 320 >> 2, structureZPos >> 2);
209+
Cubiomes.getVariant(structureVariant, structure, version, seed, structureXPos, structureZPos, biome);
208210

209211
List<Component> components = StructureVariantFeedbackHelper.get(structure, structureVariant);
210212
if (components.isEmpty()) {
211213
return Command.SINGLE_SUCCESS;
212214
}
213-
source.sendFeedback(Component.translatable("command.locate.feature.structure.variantData"));
214-
components.forEach(component -> source.sendFeedback(Component.literal(" - ").append(component)));
215+
source.getClient().schedule(() -> source.sendFeedback(Component.translatable("command.locate.feature.structure.variantData")));
216+
components.forEach(component -> source.getClient().schedule(() -> source.sendFeedback(Component.literal(" - ").append(component))));
215217
return Command.SINGLE_SUCCESS;
216218
}
217219
}
@@ -231,7 +233,7 @@ private static int locateStronghold(CustomClientCommandSource source) throws Com
231233

232234
BlockPos pos = tree.nearestTo(position.atY(0));
233235

234-
source.sendFeedback(Component.translatable("command.locate.feature.stronghold.success", ComponentUtils.formatXZ(pos.getX(), pos.getZ())));
236+
source.getClient().schedule(() -> source.sendFeedback(Component.translatable("command.locate.feature.stronghold.success", ComponentUtils.formatXZ(pos.getX(), pos.getZ()))));
235237
return Command.SINGLE_SUCCESS;
236238
}
237239

@@ -497,7 +499,7 @@ private static int locateOreVein(CustomClientCommandSource source, boolean wantC
497499
throw CommandExceptions.NO_ORE_VEIN_FOUND_EXCEPTION.create(6400);
498500
}
499501

500-
source.sendFeedback(Component.translatable("command.locate.oreVein.foundAt", ComponentUtils.formatXYZ(pos[0].getX(), pos[0].getY(), pos[0].getZ(), Component.translatable("command.locate.oreVein.copy"))));
502+
source.getClient().schedule(() -> source.sendFeedback(Component.translatable("command.locate.oreVein.foundAt", ComponentUtils.formatXYZ(pos[0].getX(), pos[0].getY(), pos[0].getZ(), Component.translatable("command.locate.oreVein.copy")))));
501503

502504
return Command.SINGLE_SUCCESS;
503505
}
@@ -537,7 +539,7 @@ private static int locateCanyon(CustomClientCommandSource source) throws Command
537539
if (pos == null) {
538540
throw CommandExceptions.NO_CANYON_FOUND_EXCEPTION.create(6400);
539541
}
540-
source.sendFeedback(Component.translatable("command.locate.canyon.foundAt", ComponentUtils.formatXZ(SectionPos.sectionToBlockCoord(pos.x()), SectionPos.sectionToBlockCoord(pos.z()), Component.translatable("command.locate.canyon.copy"))));
542+
source.getClient().schedule(() -> source.sendFeedback(Component.translatable("command.locate.canyon.foundAt", ComponentUtils.formatXZ(SectionPos.sectionToBlockCoord(pos.x()), SectionPos.sectionToBlockCoord(pos.z()), Component.translatable("command.locate.canyon.copy")))));
541543
return Command.SINGLE_SUCCESS;
542544
}
543545
}

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,11 @@ public static Component listToggledFeatures() {
7474
.map(MapFeature::getName)
7575
.map(Component::literal));
7676
}
77+
78+
@Config(comment = "getDevModeComment")
79+
public static boolean DevMode = false;
80+
81+
public static Component getDevModeComment() {
82+
return Component.translatable("config.devMode.comment");
83+
}
7784
}

src/main/resources/assets/seedmapper/lang/en_us.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
"command.buildInfo.success": "Running SeedMapper on version %s (%s@{%s}).",
9191

9292
"config.oreAirCheck.comment": "Whether or not SeedMapper should use in-game air checks to invalidate ore positions.",
93+
"config.devMode.comment": "Enables certain debug commands.",
9394

9495
"key.seedMap": "Seed map",
9596

0 commit comments

Comments
 (0)