From 5d231d44ab88766c126659066bf4961859284a61 Mon Sep 17 00:00:00 2001 From: vinceh121 Date: Thu, 18 Aug 2022 01:56:12 +0200 Subject: [PATCH] feat: reconnect command --- .../com/therainbowville/minegasm/common/Minegasm.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/com/therainbowville/minegasm/common/Minegasm.java b/src/main/java/com/therainbowville/minegasm/common/Minegasm.java index bf42d17..d986a54 100644 --- a/src/main/java/com/therainbowville/minegasm/common/Minegasm.java +++ b/src/main/java/com/therainbowville/minegasm/common/Minegasm.java @@ -4,9 +4,12 @@ import org.apache.logging.log4j.Logger; import com.therainbowville.minegasm.client.ClientEventHandler; +import com.therainbowville.minegasm.client.ToyController; import com.therainbowville.minegasm.config.MinegasmConfig; import net.fabricmc.api.ModInitializer; +import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager; +import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback; import net.fabricmc.fabric.api.event.player.AttackEntityCallback; public class Minegasm implements ModInitializer { @@ -22,6 +25,13 @@ public void onInitialize() { MinegasmConfig.loadConfig(); LOGGER.info(MinegasmConfig.INSTANCE.toString()); AttackEntityCallback.EVENT.register(ClientEventHandler::onAttack); + + ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> { + dispatcher.register(ClientCommandManager.literal("minegasm-reconnect").executes(o -> { + ToyController.connectDevice(); + return 0; + })); + }); } }