108 lines
5.6 KiB
Diff
108 lines
5.6 KiB
Diff
--- ../src-base/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java
|
|
+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java
|
|
@@ -58,31 +58,29 @@
|
|
if (itemarmor.func_185083_B_() == p_188361_9_)
|
|
{
|
|
T t = this.func_188360_a(p_188361_9_);
|
|
+ t = getArmorModelHook(p_188361_1_, itemstack, p_188361_9_, t);
|
|
t.func_178686_a(this.field_177190_a.func_177087_b());
|
|
t.func_78086_a(p_188361_1_, p_188361_2_, p_188361_3_, p_188361_4_);
|
|
this.func_188359_a(t, p_188361_9_);
|
|
boolean flag = this.func_188363_b(p_188361_9_);
|
|
- this.field_177190_a.func_110776_a(this.func_177181_a(itemarmor, flag));
|
|
+ this.field_177190_a.func_110776_a(this.getArmorResource(p_188361_1_, itemstack, p_188361_9_, null));
|
|
|
|
- switch (itemarmor.func_82812_d())
|
|
{
|
|
- case LEATHER:
|
|
+ if (itemarmor.hasOverlay(itemstack)) // Allow this for anything, not only cloth
|
|
+ {
|
|
int i = itemarmor.func_82814_b(itemstack);
|
|
float f = (float)(i >> 16 & 255) / 255.0F;
|
|
float f1 = (float)(i >> 8 & 255) / 255.0F;
|
|
float f2 = (float)(i & 255) / 255.0F;
|
|
GlStateManager.func_179131_c(this.field_177184_f * f, this.field_177185_g * f1, this.field_177192_h * f2, this.field_177187_e);
|
|
t.func_78088_a(p_188361_1_, p_188361_2_, p_188361_3_, p_188361_5_, p_188361_6_, p_188361_7_, p_188361_8_);
|
|
- this.field_177190_a.func_110776_a(this.func_177178_a(itemarmor, flag, "overlay"));
|
|
- case CHAIN:
|
|
- case IRON:
|
|
- case GOLD:
|
|
- case DIAMOND:
|
|
+ this.field_177190_a.func_110776_a(this.getArmorResource(p_188361_1_, itemstack, p_188361_9_, "overlay"));
|
|
+ }
|
|
+ { // Non-colored
|
|
GlStateManager.func_179131_c(this.field_177184_f, this.field_177185_g, this.field_177192_h, this.field_177187_e);
|
|
t.func_78088_a(p_188361_1_, p_188361_2_, p_188361_3_, p_188361_5_, p_188361_6_, p_188361_7_, p_188361_8_);
|
|
- default:
|
|
-
|
|
- if (!this.field_177193_i && itemstack.func_77948_v())
|
|
+ } // Default
|
|
+ if (!this.field_177193_i && itemstack.func_77962_s())
|
|
{
|
|
func_188364_a(this.field_177190_a, p_188361_1_, t, p_188361_2_, p_188361_3_, p_188361_4_, p_188361_5_, p_188361_6_, p_188361_7_, p_188361_8_);
|
|
}
|
|
@@ -139,11 +137,13 @@
|
|
Minecraft.func_71410_x().field_71460_t.func_191514_d(false);
|
|
}
|
|
|
|
+ @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 s = String.format("textures/models/armor/%s_layer_%d%s.png", p_177178_1_.func_82812_d().func_179242_c(), p_177178_2_ ? 2 : 1, p_177178_3_ == null ? "" : String.format("_%s", p_177178_3_));
|
|
@@ -161,4 +161,49 @@
|
|
protected abstract void func_177177_a();
|
|
|
|
protected abstract void func_188359_a(T p_188359_1_, EntityEquipmentSlot p_188359_2_);
|
|
+
|
|
+ /*=================================== FORGE START =========================================*/
|
|
+
|
|
+ /**
|
|
+ * Hook to allow item-sensitive armor model. for LayerBipedArmor.
|
|
+ */
|
|
+ protected T getArmorModelHook(EntityLivingBase entity, ItemStack itemStack, EntityEquipmentSlot slot, T model)
|
|
+ {
|
|
+ return model;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * 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, EntityEquipmentSlot slot, String type)
|
|
+ {
|
|
+ ItemArmor item = (ItemArmor)stack.func_77973_b();
|
|
+ String texture = item.func_82812_d().func_179242_c();
|
|
+ String domain = "minecraft";
|
|
+ int idx = texture.indexOf(':');
|
|
+ if (idx != -1)
|
|
+ {
|
|
+ domain = texture.substring(0, idx);
|
|
+ texture = texture.substring(idx + 1);
|
|
+ }
|
|
+ String s1 = String.format("%s:textures/models/armor/%s_layer_%d%s.png", domain, texture, (func_188363_b(slot) ? 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 ===========================================*/
|
|
}
|