11package org.polyfrost.polyhitbox
22
3+ // #if FABRIC
4+ import net.fabricmc.api.ClientModInitializer
5+ // #elseif FORGE
6+ // #if MC >= 1.16.5
7+ // $$ import net.minecraftforge.eventbus.api.IEventBus
8+ // $$ import net.minecraftforge.fml.common.Mod
9+ // $$ import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent
10+ // $$ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext
11+ // #else
12+ // $$ import net.minecraftforge.fml.common.Mod
13+ // $$ import net.minecraftforge.fml.common.event.FMLInitializationEvent
14+ // #endif
15+ // #endif
16+
317import dev.deftu.omnicore.api.client.client
418import org.apache.logging.log4j.LogManager
519import org.polyfrost.oneconfig.api.config.v1.ConfigManager
620
7- // #if FORGE
8- // $$ @net.minecraftforge.fml.common.Mod(
9- // #if MC >=1.20.1 || MC <=1.12.2
10- // $$ modid = PolyHitbox.MODID,
11- // $$ name = PolyHitbox.NAME,
12- // $$ version = PolyHitbox.VERSION,
13- // $$ modLanguageAdapter = "org.polyfrost.oneconfig.utils.v1.forge.KotlinLanguageAdapter"
21+ // #if FORGE-LIKE
22+ // #if MC >= 1.16.5
23+ // $$ @Mod(PolyHitboxConstants.ID)
1424// #else
15- // $$ value = PolyHitbox.MODID
25+ // $$ @Mod(modid = PolyHitboxConstants.ID, version = PolyHitboxConstants.VERSION)
1626// #endif
17- // $$ )
1827// #endif
1928object PolyHitbox
2029// #if FABRIC
21- : net.fabricmc.api. ClientModInitializer
30+ : ClientModInitializer
2231// #endif
2332{
24- const val MODID = " @MOD_ID@"
25- const val NAME = " @MOD_NAME@"
26- const val VERSION = " @MOD_VERSION@"
2733 private val LOGGER = LogManager .getLogger(" PolyHitbox" )
2834 private val hitboxInfo = HitboxInfo (" hitbox.yaml" )
2935
@@ -43,7 +49,20 @@ object PolyHitbox
4349 // #endif
4450 }
4551
46- fun initialize () {
52+ // #if FABRIC
53+ override
54+ // #elseif FORGE && MC <= 1.12.2
55+ // $$ @Mod.EventHandler
56+ // #endif
57+ fun onInitializeClient (
58+ // #if FORGE-LIKE
59+ // #if MC >= 1.16.5
60+ // $$ event: FMLClientSetupEvent
61+ // #else
62+ // $$ event: FMLInitializationEvent
63+ // #endif
64+ // #endif
65+ ) {
4766 hitboxInfo.tree.title = " PolyHitbox"
4867 hitboxInfo.tree = ConfigManager .active().register(hitboxInfo.tree).tree
4968 var enabled = false
@@ -59,17 +78,18 @@ object PolyHitbox
5978 // hitboxesEnabled = enabled
6079 // #endif
6180 }
81+ // #endif
6282
63- // TODO: Fix 1.16.5 Forge (idk what changed)
64- // #if FORGE
65- // $$ @net.minecraftforge.fml.common.Mod.EventHandler
66- // $$ fun onFMLInit(event: net.minecraftforge.fml.common.event.FMLInitializationEvent) {
67- // $$ initialize()
83+ // #if FORGE && MC >= 1.16.5
84+ // $$ init {
85+ // $$ setupForgeEvents(FMLJavaModLoadingContext.get().modEventBus)
86+ // $$ }
87+ // #endif
88+
89+ // #if FORGE-LIKE && MC >= 1.16.5
90+ // $$ private fun setupForgeEvents(modEventBus: IEventBus) {
91+ // $$ modEventBus.addListener(this::onInitializeClient)
6892 // $$ }
69- // #else
70- override fun onInitializeClient () {
71- initialize()
72- }
7393 // #endif
7494
7595 fun getHitboxInfo (): HitboxInfo {
0 commit comments