From 52195ceb2e20f3aa4300dae0d5940cf27af7230c Mon Sep 17 00:00:00 2001 From: Lilly Rosaline Date: Mon, 12 Dec 2022 12:51:08 -0600 Subject: [PATCH] Fix failed compilation from possible syntax errors (#2) * fix cause of IllegalAccessException * logger not supposed to be private? * Revert "logger not supposed to be private?" This reverts commit 4674c49b1bf844473fb423dbd6f909ec1b9d3754. * Revert "fix cause of IllegalAccessException" This reverts commit 1edbf0204daaa7f5f3d45d7649021e4d1952f93b. * Fix QMJ to use kotlin language adapter --- .../java/com/example/example_mod/mixin/TitleScreenMixin.java | 2 +- src/main/kotlin/com/example/example_mod/ExampleMod.kt | 2 +- src/main/resources/quilt.mod.json | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/example/example_mod/mixin/TitleScreenMixin.java b/src/main/java/com/example/example_mod/mixin/TitleScreenMixin.java index 8250b0e..92af17e 100644 --- a/src/main/java/com/example/example_mod/mixin/TitleScreenMixin.java +++ b/src/main/java/com/example/example_mod/mixin/TitleScreenMixin.java @@ -11,6 +11,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; public class TitleScreenMixin { @Inject(method = "init", at = @At("TAIL")) public void exampleMod$onInit(CallbackInfo ci) { - ExampleMod.Companion.getLOGGER().info("This line is printed by an example mod mixin!"); + ExampleMod.INSTANCE.getLOGGER().info("This line is printed by an example mod mixin!"); } } diff --git a/src/main/kotlin/com/example/example_mod/ExampleMod.kt b/src/main/kotlin/com/example/example_mod/ExampleMod.kt index 7dabc46..a8ad1bb 100644 --- a/src/main/kotlin/com/example/example_mod/ExampleMod.kt +++ b/src/main/kotlin/com/example/example_mod/ExampleMod.kt @@ -6,7 +6,7 @@ import org.slf4j.Logger import org.slf4j.LoggerFactory object ExampleMod : ModInitializer { - private val LOGGER: Logger = LoggerFactory.getLogger("Example Mod") + val LOGGER: Logger = LoggerFactory.getLogger("Example Mod") override fun onInitialize(mod: ModContainer) { LOGGER.info("Hello Quilt world from {}!", mod.metadata()?.name()) diff --git a/src/main/resources/quilt.mod.json b/src/main/resources/quilt.mod.json index 834d325..1592438 100644 --- a/src/main/resources/quilt.mod.json +++ b/src/main/resources/quilt.mod.json @@ -19,7 +19,10 @@ }, "intermediate_mappings": "net.fabricmc:intermediary", "entrypoints": { - "init": "com.example.example_mod.ExampleMod" + "init": { + "adapter": "kotlin", + "value": "com.example.example_mod.ExampleMod" + } }, "depends": [ {