generated from Polyfrost/OneConfigExampleMod
-
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
15 changed files
with
367 additions
and
207 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
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
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
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
src/main/kotlin/org/polyfrost/polytime/PolyTimeConstants.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,10 @@ | ||
package org.polyfrost.polytime | ||
|
||
object PolyTimeConstants { | ||
|
||
// Sets the variables from `gradle.properties`. Depends on the `bloom` DGT plugin. | ||
const val ID: String = "@MOD_ID@" | ||
const val NAME: String = "@MOD_NAME@" | ||
const val VERSION: String = "@MOD_VERSION@" | ||
|
||
} |
90 changes: 90 additions & 0 deletions
90
src/main/kotlin/org/polyfrost/polytime/PolyTimeEntrypoint.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,90 @@ | ||
package org.polyfrost.polytime | ||
|
||
//#if FABRIC | ||
//$$ import net.fabricmc.api.ModInitializer | ||
//$$ import net.fabricmc.api.ClientModInitializer | ||
//$$ import net.fabricmc.api.DedicatedServerModInitializer | ||
//#elseif FORGE | ||
//#if MC >= 1.16.5 | ||
//$$ import net.minecraftforge.eventbus.api.IEventBus | ||
//$$ import net.minecraftforge.fml.common.Mod | ||
//$$ import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent | ||
//$$ import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent | ||
//$$ 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.FMLCommonSetupEvent | ||
//$$ import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent | ||
//$$ import net.neoforged.fml.event.lifecycle.FMLDedicatedServerSetupEvent | ||
//#endif | ||
|
||
import org.polyfrost.polytime.client.PolyTimeClient | ||
|
||
//#if FORGE-LIKE | ||
//#if MC >= 1.16.5 | ||
//$$ @Mod(ExampleConstants.ID) | ||
//#else | ||
@Mod(modid = PolyTimeConstants.ID, version = PolyTimeConstants.VERSION) | ||
//#endif | ||
//#endif | ||
|
||
class PolyTimeEntrypoint | ||
//#if FABRIC | ||
//$$ : ClientModInitializer | ||
//#endif | ||
{ | ||
|
||
//#if FORGE && MC >= 1.16.5 | ||
//$$ init { | ||
//$$ setupForgeEvents(FMLJavaModLoadingContext.get().getModEventBus()) | ||
//$$ } | ||
//#elseif NEOFORGE | ||
//$$ constructor(modEventBus: IEventBus) { | ||
//$$ setupForgeEvents(modEventBus) | ||
//$$ } | ||
//#endif | ||
|
||
//#if FABRIC | ||
//$$ @Override | ||
//#elseif FORGE && MC <= 1.12.2 | ||
@EventHandler | ||
//#endif | ||
fun onInitializeClient( | ||
//#if FORGE-LIKE | ||
//#if MC >= 1.16.5 | ||
//$$ FMLClientSetupEvent event | ||
//#else | ||
event: FMLInitializationEvent | ||
//#endif | ||
//#endif | ||
) { | ||
//#if FORGE && MC <= 1.12.2 | ||
//$$ if (!event | ||
//#if MC <= 1.8.9 | ||
//$$ .side.isClient | ||
//#else | ||
//$$ .getSide().isClient() | ||
//#endif | ||
//$$ ) { | ||
//$$ return; | ||
//$$ } | ||
//#endif | ||
|
||
PolyTimeClient.initialize() | ||
} | ||
|
||
//#if FORGE-LIKE && MC >= 1.16.5 | ||
//$$ private fun setupForgeEvents(modEventBus: IEventBus) { | ||
//$$ modEventBus.addListener(this::onInitializeClient) | ||
//$$ } | ||
//#endif | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
src/main/kotlin/org/polyfrost/polytime/client/PolyTimeClient.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,18 @@ | ||
package org.polyfrost.polytime.client | ||
|
||
import org.polyfrost.oneconfig.api.commands.v1.CommandManager | ||
import org.polyfrost.polytime.client.realtime.RealTimeHandler | ||
import org.polyfrost.polytime.realTimeToGameTime | ||
|
||
object PolyTimeClient { | ||
|
||
@JvmStatic | ||
val currentTime: Long | ||
get() = (if (PolyTimeConfig.irlTime) RealTimeHandler.currentTime else PolyTimeConfig.time).realTimeToGameTime() | ||
|
||
fun initialize() { | ||
PolyTimeConfig.preload() | ||
CommandManager.registerCommand(PolyTimeCommand()) | ||
} | ||
|
||
} |
Oops, something went wrong.