Fix getArmorTexture by passing it the subtype

This commit is contained in:
copyboy 2013-07-24 22:12:38 +02:00
parent 75907e3815
commit c9af365d44
3 changed files with 29 additions and 3 deletions

View file

@ -54,9 +54,15 @@ public class ForgeHooksClient
return FMLClientHandler.instance().getClient().renderEngine; return FMLClientHandler.instance().getClient().renderEngine;
} }
@Deprecated
public static String getArmorTexture(Entity entity, ItemStack armor, String _default, int slot, int layer, String type) public static String getArmorTexture(Entity entity, ItemStack armor, String _default, int slot, int layer, String type)
{ {
String result = armor.getItem().getArmorTexture(armor, entity, slot, layer); return getArmorTexture(entity, armor, _default, slot, type);
}
public static String getArmorTexture(Entity entity, ItemStack armor, String _default, int slot, String type)
{
String result = armor.getItem().getArmorTexture(armor, entity, slot, type);
return result != null ? result : _default; return result != null ? result : _default;
} }

View file

@ -49,7 +49,7 @@
+ String s1 = String.format("textures/models/armor/%s_layer_%d%s.png", + String s1 = String.format("textures/models/armor/%s_layer_%d%s.png",
+ bipedArmorFilenamePrefix[item.renderIndex], (slot == 2 ? 2 : 1), type == null ? "" : String.format("_%s", type)); + bipedArmorFilenamePrefix[item.renderIndex], (slot == 2 ? 2 : 1), type == null ? "" : String.format("_%s", type));
+ +
+ s1 = ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, (slot == 2 ? 2 : 1), type); + s1 = ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, type);
+ ResourceLocation resourcelocation = (ResourceLocation)field_110859_k.get(s1); + ResourceLocation resourcelocation = (ResourceLocation)field_110859_k.get(s1);
+ +
+ if (resourcelocation == null) + if (resourcelocation == null)

View file

@ -66,7 +66,7 @@
Vec3 vec31 = vec3.addVector((double)f7 * d3, (double)f6 * d3, (double)f8 * d3); Vec3 vec31 = vec3.addVector((double)f7 * d3, (double)f6 * d3, (double)f8 * d3);
return par1World.rayTraceBlocks_do_do(vec3, vec31, par3, !par3); return par1World.rayTraceBlocks_do_do(vec3, vec31, par3, !par3);
} }
@@ -740,4 +755,514 @@ @@ -740,4 +755,534 @@
{ {
StatList.initStats(); StatList.initStats();
} }
@ -428,6 +428,7 @@
+ { + {
+ return 0.0F; //getDamageVsEntity(par1Entity); + return 0.0F; //getDamageVsEntity(par1Entity);
+ } + }
+
+ /** + /**
+ * Called by RenderBiped and RenderPlayer to determine the armor texture that + * Called by RenderBiped and RenderPlayer to determine the armor texture that
+ * should be use for the currently equiped item. + * should be use for the currently equiped item.
@ -441,10 +442,29 @@
+ * @param layer The render layer, either 1 or 2, 2 is only used for CLOTH armor by default + * @param layer The render layer, either 1 or 2, 2 is only used for CLOTH armor by default
+ * @return Path of texture to bind, or null to use default + * @return Path of texture to bind, or null to use default
+ */ + */
+ @Deprecated //Replaced with more useful version below
+ public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer) + public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer)
+ { + {
+ return null; + return null;
+ } + }
+
+ /**
+ * Called by RenderBiped and RenderPlayer to determine the armor texture that
+ * should be use for the currently equiped item.
+ * This will only be called on instances of ItemArmor.
+ *
+ * Returning null from this function will use the default value.
+ *
+ * @param stack ItemStack for the equpt armor
+ * @param entity The entity wearing the armor
+ * @param slot The slot the armor is in
+ * @param type The subtype, can be null or "overlay"
+ * @return Path of texture to bind, or null to use default
+ */
+ public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
+ {
+ return getArmorTexture(stack, entity, slot, (slot == 2 ? 2 : 1));
+ }
+ +
+ +
+ /** + /**