aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/firmament/features
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/features')
-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?,