aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/firmament/features/texturepack
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-05-07 21:11:09 +0200
committerLinnea Gräf <nea@nea.moe>2024-05-07 21:11:09 +0200
commit93e6e0ab16df0808ee7720202a32967eddcf5c10 (patch)
tree0939d44ec0c848f8712df8b03f30af1d34eabfa0 /src/main/kotlin/moe/nea/firmament/features/texturepack
parent8f3cc34740fcfe1572d23c8f1c1db1a309217b84 (diff)
downloadfirmament-93e6e0ab16df0808ee7720202a32967eddcf5c10.tar.gz
firmament-93e6e0ab16df0808ee7720202a32967eddcf5c10.tar.bz2
firmament-93e6e0ab16df0808ee7720202a32967eddcf5c10.zip
Fix up most of the remaining event handlers
[no changelog]
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/features/texturepack')
-rw-r--r--src/main/kotlin/moe/nea/firmament/features/texturepack/CustomSkyBlockTextures.kt24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/features/texturepack/CustomSkyBlockTextures.kt b/src/main/kotlin/moe/nea/firmament/features/texturepack/CustomSkyBlockTextures.kt
index 9c2eafc..e66a24a 100644
--- a/src/main/kotlin/moe/nea/firmament/features/texturepack/CustomSkyBlockTextures.kt
+++ b/src/main/kotlin/moe/nea/firmament/features/texturepack/CustomSkyBlockTextures.kt
@@ -16,6 +16,7 @@ import net.minecraft.client.render.RenderLayer
import net.minecraft.client.util.ModelIdentifier
import net.minecraft.component.type.ProfileComponent
import net.minecraft.util.Identifier
+import moe.nea.firmament.annotations.Subscribe
import moe.nea.firmament.events.CustomItemModelEvent
import moe.nea.firmament.events.TickEvent
import moe.nea.firmament.features.FirmamentFeature
@@ -38,20 +39,21 @@ object CustomSkyBlockTextures : FirmamentFeature {
override val config: ManagedConfig
get() = TConfig
- override fun onLoad() {
- CustomItemModelEvent.subscribe {
- if (!TConfig.enabled) return@subscribe
- val id = it.itemStack.skyBlockId ?: return@subscribe
- it.overrideModel = ModelIdentifier("firmskyblock", id.identifier.path, "inventory")
- }
- TickEvent.subscribe {
- if (TConfig.cacheDuration < 1 || it.tickCount % TConfig.cacheDuration == 0) {
- CustomItemModelEvent.clearCache()
- skullTextureCache.clear()
- }
+ @Subscribe
+ fun onTick(it: TickEvent) {
+ if (TConfig.cacheDuration < 1 || it.tickCount % TConfig.cacheDuration == 0) {
+ CustomItemModelEvent.clearCache()
+ skullTextureCache.clear()
}
}
+ @Subscribe
+ fun onCustomModelId(it: CustomItemModelEvent) {
+ if (!TConfig.enabled) return
+ val id = it.itemStack.skyBlockId ?: return
+ it.overrideModel = ModelIdentifier("firmskyblock", id.identifier.path, "inventory")
+ }
+
private val skullTextureCache = mutableMapOf<IdentityCharacteristics<ProfileComponent>, Any>()
private val sentinelPresentInvalid = Object()