96 lines
5.1 KiB
Diff
96 lines
5.1 KiB
Diff
--- ../src-base/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java
|
|
+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java
|
|
@@ -56,31 +56,32 @@
|
|
ModelBase modelbase = this.func_177175_a(p_177182_9_);
|
|
modelbase.func_178686_a(this.field_177190_a.func_177087_b());
|
|
modelbase.func_78086_a(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_4_);
|
|
+ modelbase = net.minecraftforge.client.ForgeHooksClient.getArmorModel(p_177182_1_, itemstack, p_177182_9_, modelbase);
|
|
this.func_177179_a(modelbase, p_177182_9_);
|
|
boolean flag = this.func_177180_b(p_177182_9_);
|
|
- this.field_177190_a.func_110776_a(this.func_177181_a(itemarmor, flag));
|
|
+ this.field_177190_a.func_110776_a(this.getArmorResource(p_177182_1_, itemstack, flag ? 2 : 1, null));
|
|
|
|
- switch (LayerArmorBase.SwitchArmorMaterial.field_178747_a[itemarmor.func_82812_d().ordinal()])
|
|
{
|
|
- case 1:
|
|
- int j = itemarmor.func_82814_b(itemstack);
|
|
+ int j = itemarmor.func_82814_b(itemstack);
|
|
+ if (j != -1) //Allow this for anything, not only cloth.
|
|
+ {
|
|
float f7 = (float)(j >> 16 & 255) / 255.0F;
|
|
float f8 = (float)(j >> 8 & 255) / 255.0F;
|
|
float f9 = (float)(j & 255) / 255.0F;
|
|
GlStateManager.func_179131_c(this.field_177184_f * f7, this.field_177185_g * f8, this.field_177192_h * f9, this.field_177187_e);
|
|
modelbase.func_78088_a(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_);
|
|
- this.field_177190_a.func_110776_a(this.func_177178_a(itemarmor, flag, "overlay"));
|
|
- case 2:
|
|
- case 3:
|
|
- case 4:
|
|
- case 5:
|
|
+ this.field_177190_a.func_110776_a(this.getArmorResource(p_177182_1_, itemstack, flag ? 2 : 1, "overlay"));
|
|
+ }
|
|
+ { // Non-cloth
|
|
GlStateManager.func_179131_c(this.field_177184_f, this.field_177185_g, this.field_177192_h, this.field_177187_e);
|
|
modelbase.func_78088_a(p_177182_1_, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_);
|
|
- default:
|
|
+ }
|
|
+ { // Default, Why is this a switch? there were no breaks.
|
|
if (!this.field_177193_i && itemstack.func_77948_v())
|
|
{
|
|
this.func_177183_a(p_177182_1_, modelbase, p_177182_2_, p_177182_3_, p_177182_4_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_);
|
|
}
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
@@ -135,11 +136,13 @@
|
|
GlStateManager.func_179084_k();
|
|
}
|
|
|
|
+ @Deprecated //Use the more sensitive version getArmorResource below
|
|
private ResourceLocation func_177181_a(ItemArmor p_177181_1_, boolean p_177181_2_)
|
|
{
|
|
return this.func_177178_a(p_177181_1_, p_177181_2_, (String)null);
|
|
}
|
|
|
|
+ @Deprecated //Use the more sensitive version getArmorResource below
|
|
private ResourceLocation func_177178_a(ItemArmor p_177178_1_, boolean p_177178_2_, String p_177178_3_)
|
|
{
|
|
String s1 = String.format("textures/models/armor/%s_layer_%d%s.png", new Object[] {p_177178_1_.func_82812_d().func_179242_c(), Integer.valueOf(p_177178_2_ ? 2 : 1), p_177178_3_ == null ? "" : String.format("_%s", new Object[]{p_177178_3_})});
|
|
@@ -158,6 +161,35 @@
|
|
|
|
protected abstract void func_177179_a(ModelBase p_177179_1_, int p_177179_2_);
|
|
|
|
+ /*=================================== FORGE START =========================================*/
|
|
+ /**
|
|
+ * More generic ForgeHook version of the above function, it allows for Items to have more control over what texture they provide.
|
|
+ *
|
|
+ * @param entity Entity wearing the armor
|
|
+ * @param stack ItemStack for the armor
|
|
+ * @param slot Slot ID that the item is in
|
|
+ * @param type Subtype, can be null or "overlay"
|
|
+ * @return ResourceLocation pointing at the armor's texture
|
|
+ */
|
|
+ public ResourceLocation getArmorResource(net.minecraft.entity.Entity entity, ItemStack stack, int slot, String type)
|
|
+ {
|
|
+ ItemArmor item = (ItemArmor)stack.func_77973_b();
|
|
+ String s1 = String.format("textures/models/armor/%s_layer_%d%s.png",
|
|
+ ((ItemArmor)stack.func_77973_b()).func_82812_d().func_179242_c(), (slot == 2 ? 2 : 1), type == null ? "" : String.format("_%s", type));
|
|
+
|
|
+ s1 = net.minecraftforge.client.ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, type);
|
|
+ ResourceLocation resourcelocation = (ResourceLocation)field_177191_j.get(s1);
|
|
+
|
|
+ if (resourcelocation == null)
|
|
+ {
|
|
+ resourcelocation = new ResourceLocation(s1);
|
|
+ field_177191_j.put(s1, resourcelocation);
|
|
+ }
|
|
+
|
|
+ return resourcelocation;
|
|
+ }
|
|
+ /*=================================== FORGE END ===========================================*/
|
|
+
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
static final class SwitchArmorMaterial
|