Tipped arrows are now not affected by infinite enchantment but are still effected by creative mode.

This commit is contained in:
LexManos 2016-05-23 15:53:52 -07:00
parent 9df1e4b11e
commit 2356f088ee
2 changed files with 14 additions and 1 deletions

View file

@ -0,0 +1,13 @@
--- ../src-base/minecraft/net/minecraft/item/ItemArrow.java
+++ ../src-work/minecraft/net/minecraft/item/ItemArrow.java
@@ -19,4 +19,10 @@
entitytippedarrow.func_184555_a(p_185052_2_);
return entitytippedarrow;
}
+
+ public boolean isInfinite(ItemStack stack, ItemStack bow, net.minecraft.entity.player.EntityPlayer player)
+ {
+ int enchant = net.minecraft.enchantment.EnchantmentHelper.func_77506_a(net.minecraft.init.Enchantments.field_185312_x, bow);
+ return enchant <= 0 ? false : this.getClass() == ItemArrow.class;
+ }
}

View file

@ -21,7 +21,7 @@
if ((double)f >= 0.1D)
{
- boolean flag1 = flag && itemstack.func_77973_b() == Items.field_151032_g;
+ boolean flag1 = flag && itemstack.func_77973_b() instanceof ItemArrow; //Forge: Fix consuming custom arrows.
+ boolean flag1 = entityplayer.field_71075_bZ.field_75098_d || (itemstack.func_77973_b() instanceof ItemArrow ? ((ItemArrow)itemstack.func_77973_b()).isInfinite(itemstack, p_77615_1_, entityplayer) : false);
if (!p_77615_2_.field_72995_K)
{