From 71dcc3eb7f8c03c404a20edcc0245c74c98546f1 Mon Sep 17 00:00:00 2001 From: strubium <113206902+strubium@users.noreply.github.com> Date: Sat, 21 Dec 2024 13:41:20 -0600 Subject: [PATCH] #getName() is client only, fix this --- src/main/java/mcjty/theoneprobe/items/ModItems.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/mcjty/theoneprobe/items/ModItems.java b/src/main/java/mcjty/theoneprobe/items/ModItems.java index f50a8c5..53ab97e 100644 --- a/src/main/java/mcjty/theoneprobe/items/ModItems.java +++ b/src/main/java/mcjty/theoneprobe/items/ModItems.java @@ -20,6 +20,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Objects; public class ModItems { public static CreativeProbe creativeProbe; @@ -86,8 +87,16 @@ public boolean getHasSubtypes() { private static String getBaseTexture(Item baseItem) { String registryNamespace = baseItem.getRegistryName().getResourceDomain(); + String registryPath = baseItem.getRegistryName().getResourcePath(); + + String[] parts = registryPath.split("_"); + + if(Objects.equals(parts[0], "golden")){ + parts[0] = "gold"; //Golden helmets use "golden" for their id, but the model uses "gold" + } + // Determine the material (e.g. "gold") for armor textures - String armorMaterial = ((ItemArmor) baseItem).getArmorMaterial().getName().toLowerCase(); + String armorMaterial = parts[0]; // Return the path to the armor texture (layer 1 in this case) return registryNamespace + ":textures/models/armor/" + armorMaterial + "_layer_1.png";