From c83890afc8304fc0a1b1d0ea8da791c6d9b90439 Mon Sep 17 00:00:00 2001 From: nea Date: Thu, 4 Aug 2022 03:56:53 +0200 Subject: screen padding --- .../moe/nea/notenoughupdates/NotEnoughUpdates.kt | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'src/main/kotlin/moe/nea/notenoughupdates/NotEnoughUpdates.kt') diff --git a/src/main/kotlin/moe/nea/notenoughupdates/NotEnoughUpdates.kt b/src/main/kotlin/moe/nea/notenoughupdates/NotEnoughUpdates.kt index ff816f5..1986339 100644 --- a/src/main/kotlin/moe/nea/notenoughupdates/NotEnoughUpdates.kt +++ b/src/main/kotlin/moe/nea/notenoughupdates/NotEnoughUpdates.kt @@ -21,7 +21,6 @@ import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource import net.fabricmc.loader.api.FabricLoader import net.fabricmc.loader.api.Version import net.fabricmc.loader.api.metadata.ModMetadata -import net.minecraft.client.Minecraft import net.minecraft.commands.CommandBuildContext import net.minecraft.network.chat.Component import org.apache.logging.log4j.LogManager @@ -32,7 +31,7 @@ import kotlin.coroutines.EmptyCoroutineContext object NotEnoughUpdates : ModInitializer, ClientModInitializer { const val MOD_ID = "notenoughupdates" - val DEBUG = System.getenv("notenoughupdates.debug") == "true" + val DEBUG = System.getProperty("notenoughupdates.debug") == "true" val DATA_DIR: Path = Path.of(".notenoughupdates").also { Files.createDirectories(it) } val CONFIG_DIR: Path = Path.of("config/notenoughupdates").also { Files.createDirectories(it) } val logger = LogManager.getLogger("NotEnoughUpdates") @@ -58,13 +57,13 @@ object NotEnoughUpdates : ModInitializer, ClientModInitializer { val globalJob = Job() val coroutineScope = - CoroutineScope(EmptyCoroutineContext + CoroutineName("NotEnoughUpdates")) + SupervisorJob(globalJob) + CoroutineScope(EmptyCoroutineContext + CoroutineName("NotEnoughUpdates")) + SupervisorJob(globalJob) val coroutineScopeIo = coroutineScope + Dispatchers.IO + SupervisorJob(globalJob) private fun registerCommands( - dispatcher: CommandDispatcher, - @Suppress("UNUSED_PARAMETER") - _ctx: CommandBuildContext + dispatcher: CommandDispatcher, + @Suppress("UNUSED_PARAMETER") + _ctx: CommandBuildContext ) { dispatcher.register(ClientCommandManager.literal("neureload").executes { it.source.sendFeedback(Component.literal("Reloading repository from disk. This may lag a bit.")) @@ -72,11 +71,11 @@ object NotEnoughUpdates : ModInitializer, ClientModInitializer { Command.SINGLE_SUCCESS }) dispatcher.register(ClientCommandManager.literal("neu") - .then(ClientCommandManager.literal("repo").executes { - it.source.sendFeedback(Component.literal("Hi, this should work")) - Minecraft.getInstance().setScreenLater(CottonClientScreen(RepoManagementGui())) - Command.SINGLE_SUCCESS - })) + .then(ClientCommandManager.literal("repo").executes { + setScreenLater(CottonClientScreen(RepoManagementGui())) + Command.SINGLE_SUCCESS + }) + ) } override fun onInitialize() { -- cgit