From eb954543138a126cb8e332562677beb3d2429863 Mon Sep 17 00:00:00 2001 From: Username404-59 Date: Wed, 28 Apr 2021 12:30:59 +0200 Subject: [PATCH] Depend on fabric-rendering-v1 (+ fabric-api-base) and handle hud rendering on fabric too --- fabric/build.gradle.kts | 5 +++-- .../fr/username404/snowygui/fabric/FabricInit.kt | 14 +++++++++++++- fabric/src/main/resources/fabric.mod.json | 1 + gradle.properties | 2 ++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/fabric/build.gradle.kts b/fabric/build.gradle.kts index e224c9a..52ca933 100644 --- a/fabric/build.gradle.kts +++ b/fabric/build.gradle.kts @@ -14,8 +14,9 @@ architectury { platformSetupLoomIde(); fabric() } dependencies { modImplementation("${Groups.Fabric}:fabric-loader:${rootProject.property("fabric_loader_version")}") - modApi("${Groups.FabricApi}:fabric-resource-loader-v0:${rootProject.property("fabric_resource_loader_version")}") - include("${Groups.FabricApi}:fabric-resource-loader-v0:${rootProject.property("fabric_resource_loader_version")}") { isTransitive = false } + include(modApi("${Groups.FabricApi}:fabric-rendering-v1:${rootProject.property("fabric_rendering_api_version")}")!!) + include(modRuntime("${Groups.FabricApi}:fabric-resource-loader-v0:${rootProject.property("fabric_resource_loader_version")}")!!) + include(modRuntime("${Groups.FabricApi}:fabric-api-base:${rootProject.property("fabric_api_base_version")}")!!) modRuntime(modCompileOnly("com.terraformersmc:modmenu:${rootProject.property("modmenu_version")}") { exclude(group = Groups.FabricApi, module = "fabric-resource-loader-v0") }) diff --git a/fabric/src/main/kotlin/fr/username404/snowygui/fabric/FabricInit.kt b/fabric/src/main/kotlin/fr/username404/snowygui/fabric/FabricInit.kt index 82f2dc9..01f472c 100644 --- a/fabric/src/main/kotlin/fr/username404/snowygui/fabric/FabricInit.kt +++ b/fabric/src/main/kotlin/fr/username404/snowygui/fabric/FabricInit.kt @@ -1,8 +1,20 @@ package fr.username404.snowygui.fabric +import com.mojang.blaze3d.vertex.PoseStack +import fr.username404.snowygui.EventSnowy import fr.username404.snowygui.Snowy import net.fabricmc.api.ClientModInitializer +import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback +import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback.EVENT class FabricInit: Snowy(), ClientModInitializer { - override fun onInitializeClient() = atInit() + override fun onInitializeClient() { + atInit() + EVENT.register( + object: HudRenderCallback, EventSnowy { + override val type: String = "HudRender" + override fun onHudRender(matrixStack: PoseStack?, tickDelta: Float) = fire(matrixStack) + } + ) + } } \ No newline at end of file diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index 2ec7dd0..37c8690 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -30,6 +30,7 @@ "depends": { "fabricloader": ">=0.9.3", "fabric-resource-loader-v0": "*", + "fabric-rendering-v1": "*", "minecraft": ">=${minecraft_version}" }, "breaks": { diff --git a/gradle.properties b/gradle.properties index 48929d2..55d287a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,4 +11,6 @@ minecraft=1.16.5 forge_version=36.1.4 fabric_loader_version=0.11.3 fabric_resource_loader_version=0.2.5+059ea8667c +fabric_rendering_api_version=1.1.2+346247d77c +fabric_api_base_version=0.1.3+12a8474c7c modmenu_version=1.16.9 \ No newline at end of file