blob: b73c5916942a8fc5b07a1de8d00d440402443e18 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
package moe.nea.firmament.features.texturepack
import net.minecraft.client.util.ModelIdentifier
import moe.nea.firmament.events.CustomItemModelEvent
import moe.nea.firmament.events.TickEvent
import moe.nea.firmament.features.FirmamentFeature
import moe.nea.firmament.gui.config.ManagedConfig
import moe.nea.firmament.util.skyBlockId
object CustomSkyBlockTextures : FirmamentFeature {
override val identifier: String
get() = "custom-skyblock-textures"
object TConfig : ManagedConfig(identifier) {
val enabled by toggle("enabled") { true }
val cacheDuration by integer("cache-duration", 0, 20) { 1 }
}
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 (it.tickCount % TConfig.cacheDuration == 0)
CustomItemModelEvent.clearCache()
}
}
}
|