summaryrefslogtreecommitdiff
path: root/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin')
-rw-r--r--src/main/kotlin/Constants.kt27
-rw-r--r--src/main/kotlin/UltraNotifier.kt24
-rw-r--r--src/main/kotlin/UltraNotifierEntryPoint.kt25
-rw-r--r--src/main/kotlin/UltraNotifierEvents.kt53
4 files changed, 129 insertions, 0 deletions
diff --git a/src/main/kotlin/Constants.kt b/src/main/kotlin/Constants.kt
new file mode 100644
index 0000000..a1903ce
--- /dev/null
+++ b/src/main/kotlin/Constants.kt
@@ -0,0 +1,27 @@
+package moe.nea.ultranotifier
+
+
+object Constants {
+ const val MOD_ID = "ultranotifier"
+ const val VERSION = "1.0.0"
+
+ enum class Platform {
+ FORGE, FABRIC
+ }
+
+ val PLATFORM: Platform =
+//#if FORGE
+//$$ Platform.FORGE
+//#else
+ Platform.FABRIC
+//#endif
+
+ const val MINECRAFT_VERSION: String =
+//#if MC == 10809
+//$$ "1.8.9"
+//#elseif MC == 12006
+ "1.20.6"
+//#elseif MC == 11404
+//$$ "1.14.4"
+//#endif
+}
diff --git a/src/main/kotlin/UltraNotifier.kt b/src/main/kotlin/UltraNotifier.kt
new file mode 100644
index 0000000..e6ce590
--- /dev/null
+++ b/src/main/kotlin/UltraNotifier.kt
@@ -0,0 +1,24 @@
+package moe.nea.ultranotifier
+
+import moe.nea.ultranotifier.init.NeaMixinConfig
+import java.io.File
+
+object UltraNotifier {
+ val logger =
+//#if MC == 10809
+//$$ org.apache.logging.log4j.LogManager.getLogger("UltraNotifier")!!
+//#else
+ org.slf4j.LoggerFactory.getLogger("UltraNotifier")!!
+//#endif
+
+ fun onStartup() {
+ logger.info("Started on ${Constants.MINECRAFT_VERSION} ${Constants.PLATFORM} with version ${Constants.VERSION}!")
+ for (mixinPlugin in NeaMixinConfig.getMixinPlugins()) {
+ logger.info("Loaded ${mixinPlugin.mixins.size} mixins for ${mixinPlugin.mixinPackage}.")
+ }
+ }
+
+ val configFolder = File("config/ultra-notifier").also {
+ it.mkdirs()
+ }
+}
diff --git a/src/main/kotlin/UltraNotifierEntryPoint.kt b/src/main/kotlin/UltraNotifierEntryPoint.kt
new file mode 100644
index 0000000..34525ea
--- /dev/null
+++ b/src/main/kotlin/UltraNotifierEntryPoint.kt
@@ -0,0 +1,25 @@
+package moe.nea.ultranotifier
+
+//#if FORGE
+//$$ import net.minecraftforge.fml.common.Mod
+//$$
+//#if MC == 10809
+//$$ import net.minecraftforge.fml.common.event.FMLInitializationEvent
+//$$ @Mod(modid = Constants.MOD_ID, version = Constants.VERSION, useMetadata = true)
+//#else
+//$$ @Mod(Constants.MOD_ID)
+//#endif
+//$$ class UltraNotifierEntryPoint {
+//$$ @Mod.EventHandler
+//$$ fun onInit(@Suppress("UNUSED_PARAMETER") event: FMLInitializationEvent) {
+//$$ UltraNotifier.onStartup()
+//$$ }
+//$$ }
+//#else
+import net.fabricmc.api.ModInitializer
+object UltraNotifierEntryPoint : ModInitializer {
+ override fun onInitialize() {
+ UltraNotifier.onStartup()
+ }
+}
+//#endif
diff --git a/src/main/kotlin/UltraNotifierEvents.kt b/src/main/kotlin/UltraNotifierEvents.kt
new file mode 100644
index 0000000..eb0d71f
--- /dev/null
+++ b/src/main/kotlin/UltraNotifierEvents.kt
@@ -0,0 +1,53 @@
+package moe.nea.ultranotifier
+
+object UltraNotifierEvents {
+ val eventBus =
+//#if FORGE
+//$$ net.minecraftforge.common.MinecraftForge.EVENT_BUS
+//#else
+ me.bush.eventbus.bus.EventBus { UltraNotifier.logger.warn("EventBus: $it") }
+//#endif
+ @JvmStatic
+ fun <T : UltraEvent> post(event: T): T {
+ UltraNotifier.logger.info("Posting $event")
+ eventBus.post(event)
+ return event
+ }
+}
+
+abstract class UltraEvent :
+//#if FORGE
+//$$ net.minecraftforge.fml.common.eventhandler.Event()
+//#else
+ me.bush.eventbus.event.Event()
+//#endif
+{
+//#if FORGE
+//$$ override fun isCancelable(): Boolean {
+//$$ return this.isCancellable()
+//$$ }
+//$$ fun isCancelled(): Boolean {
+//$$ return isCanceled()
+//$$ }
+//$$ fun setCancelled(value: Boolean) {
+//$$ setCanceled(value)
+//$$ }
+//#else
+ override
+//#endif
+
+ fun isCancellable(): Boolean {
+ return true
+ }
+
+//#if FORGE == 0
+ override
+//#endif
+ fun cancel() {
+ setCancelled(true)
+ }
+
+}
+
+
+class ChatLineAddedEvent() : UltraEvent()