aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/ambientaddons/AmbientAddons.kt
diff options
context:
space:
mode:
authorAppability <appable@icloud.com>2022-10-11 23:59:37 -0700
committerAppability <appable@icloud.com>2022-10-11 23:59:37 -0700
commit2c0e73deb53f54d78bd5594786313ac82151be1a (patch)
tree97fc2f389cc99d8f9e078a1cd7b0c6a5859a3f34 /src/main/kotlin/com/ambientaddons/AmbientAddons.kt
parent363b2426f8d9e45e52c472750c798dcaceb05a88 (diff)
downloadAmbientAddons-2c0e73deb53f54d78bd5594786313ac82151be1a.tar.gz
AmbientAddons-2c0e73deb53f54d78bd5594786313ac82151be1a.tar.bz2
AmbientAddons-2c0e73deb53f54d78bd5594786313ac82151be1a.zip
added chest qol features (complete, i think)
Diffstat (limited to 'src/main/kotlin/com/ambientaddons/AmbientAddons.kt')
-rw-r--r--src/main/kotlin/com/ambientaddons/AmbientAddons.kt65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/main/kotlin/com/ambientaddons/AmbientAddons.kt b/src/main/kotlin/com/ambientaddons/AmbientAddons.kt
new file mode 100644
index 0000000..bf8e503
--- /dev/null
+++ b/src/main/kotlin/com/ambientaddons/AmbientAddons.kt
@@ -0,0 +1,65 @@
+import com.ambientaddons.commands.AmbientCommand
+import com.ambientaddons.config.Config
+import com.ambientaddons.config.PersistentData
+import com.ambientaddons.features.dungeon.AutoBuyChest
+import com.ambientaddons.utils.LocationUtils
+import net.minecraft.client.Minecraft
+import net.minecraft.client.gui.GuiScreen
+import net.minecraftforge.client.ClientCommandHandler
+import net.minecraftforge.common.MinecraftForge
+import net.minecraftforge.fml.common.Mod
+import net.minecraftforge.fml.common.ModMetadata
+import net.minecraftforge.fml.common.event.FMLInitializationEvent
+import net.minecraftforge.fml.common.event.FMLPreInitializationEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.TickEvent
+import java.io.File
+
+@Mod(
+ modid = "ambientaddons",
+ name = "AmbientAddons",
+ version = "0.1",
+ useMetadata = true,
+ clientSideOnly = true
+)
+class AmbientAddons {
+
+ @Mod.EventHandler
+ fun preInit(event: FMLPreInitializationEvent) {
+ metadata = event.modMetadata
+ val directory = File(event.modConfigurationDirectory, "ambientaddons-forge")
+ directory.mkdirs()
+ configDirectory = directory
+ persistentData = PersistentData.load()
+ config = Config
+ }
+
+ @Mod.EventHandler
+ fun onInit(event: FMLInitializationEvent) {
+ ClientCommandHandler.instance.registerCommand(AmbientCommand())
+
+ listOf(
+ this,
+ LocationUtils,
+ AutoBuyChest
+ ).forEach(MinecraftForge.EVENT_BUS::register)
+ }
+
+ @SubscribeEvent
+ fun onTick(event: TickEvent.ClientTickEvent) {
+ if (event.phase != TickEvent.Phase.START || currentGui == null) return
+ mc.displayGuiScreen(currentGui)
+ currentGui = null
+ }
+
+ companion object {
+ val mc: Minecraft = Minecraft.getMinecraft()
+ var currentGui: GuiScreen? = null
+
+ lateinit var configDirectory: File
+ lateinit var config: Config
+ lateinit var persistentData: PersistentData
+
+ lateinit var metadata: ModMetadata
+ }
+} \ No newline at end of file