-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
154 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,11 @@ | ||
package dev.deftu.modtemplate | ||
|
||
//#if FABRIC | ||
import net.fabricmc.api.ModInitializer | ||
//#elseif FORGE | ||
//#if MC >= 1.15.2 | ||
//$$ import net.minecraftforge.fml.common.Mod | ||
//$$ import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent | ||
//$$ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext | ||
//#else | ||
//$$ import net.minecraftforge.fml.common.Mod | ||
//$$ import net.minecraftforge.fml.common.Mod.EventHandler | ||
//$$ import net.minecraftforge.fml.common.event.FMLInitializationEvent | ||
//#endif | ||
//#elseif NEOFORGE | ||
//$$ import net.neoforged.bus.api.IEventBus | ||
//$$ import net.neoforged.fml.common.Mod | ||
//$$ import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent | ||
//#endif | ||
object ModTemplate { | ||
|
||
//#if FORGE-LIKE | ||
//#if MC >= 1.15.2 | ||
//$$ @Mod(ModTemplate.ID) | ||
//#else | ||
//$$ @Mod(modid = ModTemplate.ID) | ||
//#endif | ||
//#endif | ||
object ModTemplate | ||
//#if FABRIC | ||
: ModInitializer | ||
//#endif | ||
{ | ||
|
||
const val NAME = "@MOD_NAME@" | ||
const val ID = "@MOD_ID@" | ||
const val VERSION = "@MOD_VERSION@" | ||
|
||
//#if FORGE && MC >= 1.15.2 | ||
//$$ init { | ||
//$$ FMLJavaModLoadingContext.get().modEventBus.addListener(this::onClientSetup) | ||
//$$ } | ||
//#elseif NEOFORGE | ||
//$$ constructor(modEventBus: IEventBus) { | ||
//$$ modEventBus.addListener(this::onClientSetup) | ||
//$$ } | ||
//#endif | ||
|
||
//#if FABRIC | ||
override | ||
//#endif | ||
fun onInitialize( | ||
//#if FORGE-LIKE | ||
//#if MC >= 1.15.2 | ||
//$$ event: FMLClientSetupEvent | ||
//#else | ||
//$$ event: FMLInitializationEvent | ||
//#endif | ||
//#endif | ||
) { | ||
// Your common (both client & server) logic goes here... | ||
/** | ||
* Initialize common (both client & server) logic here. | ||
*/ | ||
fun onInitializeCommon() { | ||
} | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
src/main/kotlin/dev/deftu/modtemplate/ModTemplateConstants.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package dev.deftu.modtemplate | ||
|
||
object ModTemplateConstants { | ||
|
||
const val NAME = "@MOD_NAME@" | ||
const val ID = "@MOD_ID@" | ||
const val VERSION = "@MOD_VERSION@" | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
src/main/kotlin/dev/deftu/modtemplate/client/ModTemplateClient.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package dev.deftu.modtemplate.client | ||
|
||
object ModTemplateClient { | ||
|
||
/** | ||
* Your client-only logic goes here... | ||
*/ | ||
fun onInitializeClient() { | ||
} | ||
|
||
} |
117 changes: 117 additions & 0 deletions
117
src/main/kotlin/dev/deftu/modtemplate/entrypoint/ModTemplateEntrypoint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
package dev.deftu.modtemplate.entrypoint | ||
|
||
//#if FABRIC | ||
import net.fabricmc.api.ClientModInitializer | ||
import net.fabricmc.api.DedicatedServerModInitializer | ||
import net.fabricmc.api.ModInitializer | ||
//#elseif FORGE | ||
//#if MC >= 1.15.2 | ||
//$$ import net.minecraftforge.eventbus.api.IEventBus | ||
//$$ import net.minecraftforge.fml.common.Mod | ||
//$$ import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent | ||
//$$ import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent | ||
//$$ import net.minecraftforge.fml.event.lifecycle.FMLDedicatedServerSetupEvent | ||
//$$ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext | ||
//#else | ||
//$$ import net.minecraftforge.fml.common.Mod | ||
//$$ import net.minecraftforge.fml.common.Mod.EventHandler | ||
//$$ import net.minecraftforge.fml.common.event.FMLInitializationEvent | ||
//#endif | ||
//#elseif NEOFORGE | ||
//$$ import net.neoforged.bus.api.IEventBus | ||
//$$ import net.neoforged.fml.common.Mod | ||
//$$ import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent | ||
//$$ import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent | ||
//$$ import net.neoforged.fml.event.lifecycle.FMLDedicatedServerSetupEvent | ||
//#endif | ||
|
||
import dev.deftu.modtemplate.ModTemplate | ||
import dev.deftu.modtemplate.client.ModTemplateClient | ||
import dev.deftu.modtemplate.server.ModTemplateServer | ||
|
||
//#if FORGE-LIKE | ||
//$$ import dev.deftu.modtemplate.ModTemplateConstants | ||
//#if MC >= 1.15.2 | ||
//$$ @Mod(ModTemplateConstants.ID) | ||
//#else | ||
//$$ @Mod(modid = ModTemplateConstants.ID) | ||
//#endif | ||
//#endif | ||
object ModTemplateEntrypoint | ||
//#if FABRIC | ||
: ModInitializer, ClientModInitializer, DedicatedServerModInitializer | ||
//#endif | ||
{ | ||
|
||
//#if FORGE && MC >= 1.15.2 | ||
//$$ init { | ||
//$$ setupForgeEvents(FMLJavaModLoadingContext.get().modEventBus) | ||
//$$ } | ||
//#elseif NEOFORGE | ||
//$$ constructor(modEventBus: IEventBus) { | ||
//$$ setupForgeEvents(modEventBus) | ||
//$$ } | ||
//#endif | ||
|
||
//#if FABRIC | ||
override | ||
//#endif | ||
fun onInitialize( | ||
//#if FORGE-LIKE | ||
//#if MC >= 1.15.2 | ||
//$$ event: FMLCommonSetupEvent | ||
//#else | ||
//$$ event: FMLInitializationEvent | ||
//#endif | ||
//#endif | ||
) { | ||
ModTemplate.onInitializeCommon() | ||
} | ||
|
||
//#if FABRIC | ||
override | ||
//#endif | ||
fun onInitializeClient( | ||
//#if FORGE-LIKE | ||
//#if MC >= 1.15.2 | ||
//$$ event: FMLClientSetupEvent | ||
//#else | ||
//$$ event: FMLInitializationEvent | ||
//#endif | ||
//#endif | ||
) { | ||
//#if MC <= 1.12.2 | ||
//$$ if (!event.side.isClient) return | ||
//#endif | ||
|
||
ModTemplateClient.onInitializeClient() | ||
} | ||
|
||
//#if FABRIC | ||
override | ||
//#endif | ||
fun onInitializeServer( | ||
//#if FORGE-LIKE | ||
//#if MC >= 1.15.2 | ||
//$$ event: FMLDedicatedServerSetupEvent | ||
//#else | ||
//$$ event: FMLInitializationEvent | ||
//#endif | ||
//#endif | ||
) { | ||
//#if MC <= 1.12.2 | ||
//$$ if (!event.side.isServer) return | ||
//#endif | ||
|
||
ModTemplateServer.onInitializeServer() | ||
} | ||
|
||
//#if FORGE-LIKE && MC >= 1.15.2 | ||
//$$ fun setupForgeEvents(modEventBus: IEventBus) { | ||
//$$ modEventBus.addListener(this::onInitialize) | ||
//$$ modEventBus.addListener(this::onInitializeClient) | ||
//$$ modEventBus.addListener(this::onInitializeServer) | ||
//$$ } | ||
//#endif | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
src/main/kotlin/dev/deftu/modtemplate/server/ModTemplateServer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package dev.deftu.modtemplate.server | ||
|
||
object ModTemplateServer { | ||
|
||
/** | ||
* Your server-only logic goes here... | ||
*/ | ||
fun onInitializeServer() { | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters