ForgePatch/patches/minecraft/net/minecraft/item/ItemArmor.java.patch
LexManos f1cca475ea Initial patch update to 1.12.
Some things to note:
Netty is screwy so currently can't join single player. @cpw
Crafting has been MAJORY reworked. The current GameRegistry functions are nooped, this is IN THE WORKS.
  Just need to move the recipe list to a full class registry, and then re implement the in-code recipe registration.
  Also, it IS advised that modders move to JSON, because ideally we'll see a S->C recipe syncing system in 1.13
  which would allow servers to have custom recipes.
  OreDictionary currently 1/2 works, need to write a better algorithm for replacing ingredients.
  Please be patient
Rendering:
  A lot of functions got a new float parameter, this is similar to partial ticks, needs more research
2017-06-10 22:22:02 -04:00

72 lines
2.9 KiB
Diff

--- ../src-base/minecraft/net/minecraft/item/ItemArmor.java
+++ ../src-work/minecraft/net/minecraft/item/ItemArmor.java
@@ -187,7 +187,9 @@
public boolean func_82789_a(ItemStack p_82789_1_, ItemStack p_82789_2_)
{
- return this.field_77878_bZ.func_151685_b() == p_82789_2_.func_77973_b() ? true : super.func_82789_a(p_82789_1_, p_82789_2_);
+ ItemStack mat = this.field_77878_bZ.getRepairItemStack();
+ if (!mat.func_190926_b() && net.minecraftforge.oredict.OreDictionary.itemMatches(mat,p_82789_2_,false)) return true;
+ return super.func_82789_a(p_82789_1_, p_82789_2_);
}
public ActionResult<ItemStack> func_77659_a(World p_77659_1_, EntityPlayer p_77659_2_, EnumHand p_77659_3_)
@@ -221,6 +223,19 @@
return multimap;
}
+ /**
+ * Determines if this armor will be rendered with the secondary 'overlay' texture.
+ * If this is true, the first texture will be rendered using a tint of the color
+ * specified by getColor(ItemStack)
+ *
+ * @param stack The stack
+ * @return true/false
+ */
+ public boolean hasOverlay(ItemStack stack)
+ {
+ return this.field_77878_bZ == ItemArmor.ArmorMaterial.LEATHER || func_82814_b(stack) != 0x00FFFFFF;
+ }
+
public static enum ArmorMaterial
{
LEATHER("leather", 5, new int[]{1, 2, 3, 1}, 15, SoundEvents.field_187728_s, 0.0F),
@@ -235,6 +250,8 @@
private final int field_78055_h;
private final SoundEvent field_185020_j;
private final float field_189417_k;
+ //Added by forge for custom Armor materials.
+ public ItemStack repairMaterial = ItemStack.field_190927_a;
private ArmorMaterial(String p_i47117_3_, int p_i47117_4_, int[] p_i47117_5_, int p_i47117_6_, SoundEvent p_i47117_7_, float p_i47117_8_)
{
@@ -266,6 +283,7 @@
return this.field_185020_j;
}
+ @Deprecated // Use getRepairItemStack below
public Item func_151685_b()
{
if (this == LEATHER)
@@ -300,5 +318,21 @@
{
return this.field_189417_k;
}
+
+ public ArmorMaterial setRepairItem(ItemStack stack)
+ {
+ if (!this.repairMaterial.func_190926_b()) throw new RuntimeException("Repair material has already been set");
+ if (this == LEATHER || this == CHAIN || this == GOLD || this == IRON || this == DIAMOND) throw new RuntimeException("Can not change vanilla armor repair materials");
+ this.repairMaterial = stack;
+ return this;
+ }
+
+ public ItemStack getRepairItemStack()
+ {
+ if (!repairMaterial.func_190926_b()) return repairMaterial;
+ Item ret = this.func_151685_b();
+ if (ret != null) repairMaterial = new ItemStack(ret,1,net.minecraftforge.oredict.OreDictionary.WILDCARD_VALUE);
+ return repairMaterial;
+ }
}
}