|
11 | 11 | import com.mojang.brigadier.exceptions.DynamicCommandExceptionType; |
12 | 12 | import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; |
13 | 13 | import com.mojang.brigadier.suggestion.Suggestions; |
14 | | -import com.mojang.brigadier.tree.CommandNode; |
15 | 14 | import dev.xpple.seedmapper.SeedMapper; |
16 | 15 | import dev.xpple.seedmapper.command.CustomClientCommandSource; |
17 | 16 | import dev.xpple.seedmapper.config.Configs; |
@@ -56,37 +55,6 @@ private EspConfigCommand() { |
56 | 55 | private static final double MAX_ZOOM_BLOCKS = 100_000.0D; |
57 | 56 |
|
58 | 57 | public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher) { |
59 | | - CommandNode<FabricClientCommandSource> cconfigRoot = dispatcher.getRoot().getChild("cconfig"); |
60 | | - if (cconfigRoot == null) { |
61 | | - // If the BetterConfig client command isn't present, register a direct sm:config fallback |
62 | | - registerDirectSmConfig(dispatcher); |
63 | | - return; |
64 | | - } |
65 | | - CommandNode<FabricClientCommandSource> modRoot = cconfigRoot.getChild(SeedMapper.MOD_ID); |
66 | | - if (modRoot == null) { |
67 | | - // fallback to direct registration if mod-specific cconfig node missing |
68 | | - registerDirectSmConfig(dispatcher); |
69 | | - return; |
70 | | - } |
71 | | - |
72 | | - // Use a single target argument that accepts any case but suggests TitleCase names |
73 | | - com.mojang.brigadier.builder.RequiredArgumentBuilder<FabricClientCommandSource, String> targetArgNode = argument("target", StringArgumentType.word()) |
74 | | - .suggests(EspConfigCommand::suggestTargets); |
75 | | - targetArgNode.then(literal("get") |
76 | | - .executes(ctx -> executeGet(ctx, getTargetArgument(ctx, "target"), null)) |
77 | | - .then(argument("property", StringArgumentType.word()) |
78 | | - .suggests(EspConfigCommand::suggestProperties) |
79 | | - .executes(ctx -> executeGet(ctx, getTargetArgument(ctx, "target"), getPropertyArgument(ctx, "property"))))); |
80 | | - targetArgNode.then(literal("set") |
81 | | - .then(argument("pairs", StringArgumentType.greedyString()) |
82 | | - .executes(ctx -> executeSet(ctx, getTargetArgument(ctx, "target"))))); |
83 | | - targetArgNode.then(literal("reset") |
84 | | - .executes(ctx -> executeReset(ctx, getTargetArgument(ctx, "target")))); |
85 | | - modRoot.addChild(targetArgNode.build()); |
86 | | - modRoot.addChild(buildZoomLiteral("Zoom").build()); |
87 | | - } |
88 | | - |
89 | | - private static void registerDirectSmConfig(CommandDispatcher<FabricClientCommandSource> dispatcher) { |
90 | 58 | LiteralArgumentBuilder<FabricClientCommandSource> smRoot = literal("sm:config"); |
91 | 59 | // single target argument for sm:config that suggests TitleCase but accepts any case when typed |
92 | 60 | com.mojang.brigadier.builder.RequiredArgumentBuilder<FabricClientCommandSource, String> targetArgNode = argument("target", StringArgumentType.word()) |
|
0 commit comments