}
if (targetSlot == 0) {
if (item instanceof ItemSword && !(oldItem.getItem() instanceof ItemSword)) {
shouldEquip = true;
} else if (item instanceof ItemSword && oldItem.getItem() instanceof ItemSword) {
ItemSword newSword = (ItemSword) item;
ItemSword oldSword = (ItemSword) oldItem.getItem();
if (newSword.func_82803_g() == oldSword.func_82803_g()) {
shouldEquip = itemStack.getItemDamage() > oldItem.getItemDamage() || itemStack.hasTagCompound() && !oldItem.hasTagCompound();
} else {
shouldEquip = newSword.func_82803_g() > oldSword.func_82803_g();
}
} else {
shouldEquip = false;
}
} else if (item instanceof ItemArmor && !(oldItem.getItem() instanceof ItemArmor)) {