diff options
Diffstat (limited to 'src/main/kotlin/Firmament.kt')
-rw-r--r-- | src/main/kotlin/Firmament.kt | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/src/main/kotlin/Firmament.kt b/src/main/kotlin/Firmament.kt index 2c2a6b7..b00546a 100644 --- a/src/main/kotlin/Firmament.kt +++ b/src/main/kotlin/Firmament.kt @@ -1,5 +1,6 @@ package moe.nea.firmament +import com.google.gson.Gson import com.mojang.brigadier.CommandDispatcher import io.ktor.client.HttpClient import io.ktor.client.plugins.UserAgent @@ -18,6 +19,8 @@ import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents +import net.fabricmc.fabric.api.resource.ResourceManagerHelper +import net.fabricmc.fabric.api.resource.ResourcePackActivationType import net.fabricmc.loader.api.FabricLoader import net.fabricmc.loader.api.Version import net.fabricmc.loader.api.metadata.ModMetadata @@ -48,6 +51,8 @@ import moe.nea.firmament.repo.RepoManager import moe.nea.firmament.util.MC import moe.nea.firmament.util.SBData import moe.nea.firmament.util.data.IDataHolder +import moe.nea.firmament.util.mc.InitLevel +import moe.nea.firmament.util.tr object Firmament { val modContainer by lazy { FabricLoader.getInstance().getModContainer(MOD_ID).get() } @@ -62,6 +67,8 @@ object Firmament { } val version: Version by lazy { metadata.version } + private val DEFAULT_JSON_INDENT = " " + @OptIn(ExperimentalSerializationApi::class) val json = Json { prettyPrint = DEBUG @@ -69,9 +76,23 @@ object Firmament { allowTrailingComma = true ignoreUnknownKeys = true encodeDefaults = true + prettyPrintIndent = if (prettyPrint) "\t" else DEFAULT_JSON_INDENT + } + + /** + * FUCK two space indentation + */ + val twoSpaceJson = Json(from = json) { + prettyPrint = true + prettyPrintIndent = " " } + val gson = Gson() val tightJson = Json(from = json) { prettyPrint = false + // Reset pretty print indent back to default to prevent getting yelled at by json + prettyPrintIndent = DEFAULT_JSON_INDENT + encodeDefaults = false + explicitNulls = false } @@ -114,10 +135,10 @@ object Firmament { @JvmStatic fun onClientInitialize() { + InitLevel.bump(InitLevel.MC_INIT) FeatureManager.subscribeEvents() - var tick = 0 ClientTickEvents.END_CLIENT_TICK.register(ClientTickEvents.EndTick { instance -> - TickEvent.publish(TickEvent(tick++)) + TickEvent.publish(TickEvent(MC.currentTick++)) }) IDataHolder.registerEvents() RepoManager.initialize() @@ -143,6 +164,12 @@ object Firmament { }) }) ClientInitEvent.publish(ClientInitEvent()) + ResourceManagerHelper.registerBuiltinResourcePack( + identifier("transparent_overlay"), + modContainer, + tr("firmament.resourcepack.transparentoverlay", "Transparent Firmament Overlay"), + ResourcePackActivationType.NORMAL + ) } |