aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/firmament
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-04-17 16:17:52 +0200
committerLinnea Gräf <nea@nea.moe>2024-04-17 16:17:52 +0200
commitfbe94315a45082bdf50d0a95583725352e3f20ec (patch)
tree7ff4018c9edab6a36dba78b79b8b3c19e86b7ec1 /src/main/kotlin/moe/nea/firmament
parent749f2571614a8e8cf57080518518b686ee983b8c (diff)
downloadFirmament-fbe94315a45082bdf50d0a95583725352e3f20ec.tar.gz
Firmament-fbe94315a45082bdf50d0a95583725352e3f20ec.tar.bz2
Firmament-fbe94315a45082bdf50d0a95583725352e3f20ec.zip
Add armor retexturing for skyblock items
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament')
-rw-r--r--src/main/kotlin/moe/nea/firmament/features/texturepack/CustomSkyBlockTextures.kt18
1 files changed, 18 insertions, 0 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 66c0036..3fb5e9c 100644
--- a/src/main/kotlin/moe/nea/firmament/features/texturepack/CustomSkyBlockTextures.kt
+++ b/src/main/kotlin/moe/nea/firmament/features/texturepack/CustomSkyBlockTextures.kt
@@ -14,6 +14,7 @@ import net.minecraft.block.SkullBlock
import net.minecraft.client.MinecraftClient
import net.minecraft.client.render.RenderLayer
import net.minecraft.client.util.ModelIdentifier
+import net.minecraft.item.ItemStack
import net.minecraft.util.Identifier
import moe.nea.firmament.events.CustomItemModelEvent
import moe.nea.firmament.events.TickEvent
@@ -70,6 +71,23 @@ object CustomSkyBlockTextures : FirmamentFeature {
return Identifier("firmskyblock", "textures/placedskull/$id.png")
}
+ fun getArmorTexture(
+ itemStack: ItemStack, secondLayer: Boolean,
+ overlay: String?
+ ): Identifier? {
+ val modelIdentifier = CustomItemModelEvent.getModelIdentifier(itemStack) ?: return null
+ // Vanilla scheme: "textures/models/armor/" + var10000 + "_layer_" + (secondLayer ? 2 : 1) + (overlay == null ? "" : "_" + overlay) + ".png";
+ val overlayPart = if (overlay != null) "_$overlay" else ""
+ val identifier = Identifier(
+ modelIdentifier.namespace,
+ "textures/models/armor/${modelIdentifier.path}_layer_${if (secondLayer) 2 else 1}$overlayPart.png"
+ )
+ if (MC.resourceManager.getResource(identifier).isPresent) {
+ return identifier
+ }
+ return null
+ }
+
fun modifySkullTexture(
type: SkullBlock.SkullType?,
profile: GameProfile?,