EntityPlayer sensitive version of Item.isValidArmor, deprecated older version. Closes #551

This commit is contained in:
LexManos 2013-05-08 15:09:53 -07:00
parent 0444cc063c
commit 810b03bd83
3 changed files with 10 additions and 2 deletions

View File

@ -113,6 +113,8 @@ public+f yn.c #FD:ShapedRecipes/field_77577_c #recipeHeight
public yo.b #FD:ShapelessRecipes/field_77579_b #recipeItems
# GuiContainer
protected ayl.a(Lul;)V #MD:GuiContainer/func_74192_a #drawSlotInventory
# ContainerPlayer
protected tz.h #FD:ContainerPlayer/field_82862_h #player
# BlockButton
protected ali.n(Laab;III)V #MD:BlockButton/func_82535_o #checkActivation
protected-f ali.a #FD:BlockButton/field_82537_a #sensible

View File

@ -6,7 +6,7 @@
{
- return par1ItemStack == null ? false : (par1ItemStack.getItem() instanceof ItemArmor ? ((ItemArmor)par1ItemStack.getItem()).armorType == this.armorType : (par1ItemStack.getItem().itemID != Block.pumpkin.blockID && par1ItemStack.getItem().itemID != Item.skull.itemID ? false : this.armorType == 0));
+ Item item = (par1ItemStack == null ? null : par1ItemStack.getItem());
+ return item != null && item.isValidArmor(par1ItemStack, armorType);
+ return item != null && item.isValidArmor(par1ItemStack, armorType, parent.thePlayer);
}
@SideOnly(Side.CLIENT)

View File

@ -60,7 +60,7 @@
Vec3 vec31 = vec3.addVector((double)f7 * d3, (double)f6 * d3, (double)f8 * d3);
return par1World.rayTraceBlocks_do_do(vec3, vec31, par3, !par3);
}
@@ -720,4 +736,491 @@
@@ -720,4 +736,497 @@
{
StatList.initStats();
}
@ -357,8 +357,14 @@
+ *
+ * @param stack The ItemStack
+ * @param armorType Armor slot ID: 0: Helmet, 1: Chest, 2: Legs, 3: Boots
+ * @param players The player trying to equip the armor
+ * @return True if the given ItemStack can be inserted in the slot
+ */
+ public boolean isValidArmor(ItemStack stack, int armorType, EntityPlayer player)
+ {
+ return isValidArmor(stack, armorType);
+ }
+ @Deprecated //Deprecated in 1.5.2, remove in 1.6, see EntityPlayer sensitive version above.
+ public boolean isValidArmor(ItemStack stack, int armorType)
+ {
+ if (this instanceof ItemArmor)