ForgePatch/patches/minecraft/net/minecraft/enchantment/EnchantmentThorns.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

43 lines
1.4 KiB
Diff

--- ../src-base/minecraft/net/minecraft/enchantment/EnchantmentThorns.java
+++ ../src-work/minecraft/net/minecraft/enchantment/EnchantmentThorns.java
@@ -51,12 +51,12 @@
if (!itemstack.func_190926_b())
{
- itemstack.func_77972_a(3, p_151367_1_);
+ damageArmor(itemstack, 3, p_151367_1_);
}
}
else if (!itemstack.func_190926_b())
{
- itemstack.func_77972_a(1, p_151367_1_);
+ damageArmor(itemstack, 1, p_151367_1_);
}
}
@@ -76,4 +76,25 @@
{
return p_92095_0_ > 10 ? p_92095_0_ - 10 : 1 + p_92095_1_.nextInt(4);
}
+
+ private void damageArmor(ItemStack stack, int amount, EntityLivingBase entity)
+ {
+ int slot = -1;
+ int x = 0;
+ for (ItemStack i : entity.func_184193_aE())
+ {
+ if (i == stack){
+ slot = x;
+ break;
+ }
+ x++;
+ }
+ if (slot == -1 || !(stack.func_77973_b() instanceof net.minecraftforge.common.ISpecialArmor))
+ {
+ stack.func_77972_a(1, entity);
+ return;
+ }
+ net.minecraftforge.common.ISpecialArmor armor = (net.minecraftforge.common.ISpecialArmor)stack.func_77973_b();
+ armor.damageArmor(entity, stack, DamageSource.func_92087_a(entity), amount, slot);
+ }
}