]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/blob - src/main/java/com/irtimaled/bbor/client/commands/StructuresCommand.java
Add logic to load structures from save files
[BoundingBoxOutlineReloaded.git] / src / main / java / com / irtimaled / bbor / client / commands / StructuresCommand.java
1 package com.irtimaled.bbor.client.commands;
2
3 import com.irtimaled.bbor.client.gui.LoadSavesScreen;
4 import com.irtimaled.bbor.client.interop.ClientInterop;
5 import com.mojang.brigadier.CommandDispatcher;
6 import com.mojang.brigadier.builder.LiteralArgumentBuilder;
7 import net.minecraft.command.Commands;
8 import net.minecraft.command.ISuggestionProvider;
9
10 public class StructuresCommand {
11     private static final String COMMAND = "bbor:structures";
12     private static final String LOAD = "load";
13     private static final String CLEAR = "clear";
14
15     public static void register(CommandDispatcher<ISuggestionProvider> commandDispatcher) {
16         LiteralArgumentBuilder command = Commands.literal(COMMAND)
17                 .then(Commands.literal(LOAD)
18                         .executes(context -> {
19                             LoadSavesScreen.show();
20                             return 0;
21                         }))
22                 .then(Commands.literal(CLEAR)
23                         .executes(context -> {
24                             ClientInterop.clearStructures();
25                             return 0;
26                         }));
27
28         commandDispatcher.register(command);
29     }
30 }