Fix an obscure DynEV bug where different items would be detected as the same item and not resolve properly

This commit is contained in:
Pahimar 2014-08-25 12:43:20 -04:00
parent c8ae0b29d6
commit 61558daa61

View file

@ -27,6 +27,9 @@ public class ItemHelper
{ {
// Sort on itemID // Sort on itemID
if (Item.getIdFromItem(itemStack1.getItem()) - Item.getIdFromItem(itemStack2.getItem()) == 0) if (Item.getIdFromItem(itemStack1.getItem()) - Item.getIdFromItem(itemStack2.getItem()) == 0)
{
// Sort on item
if (itemStack1.getItem() == itemStack2.getItem())
{ {
// Then sort on meta // Then sort on meta
if (itemStack1.getItemDamage() == itemStack2.getItemDamage()) if (itemStack1.getItemDamage() == itemStack2.getItemDamage())
@ -35,7 +38,7 @@ public class ItemHelper
if (itemStack1.hasTagCompound() && itemStack2.hasTagCompound()) if (itemStack1.hasTagCompound() && itemStack2.hasTagCompound())
{ {
// Then sort on stack size // Then sort on stack size
if (itemStack1.getTagCompound().equals(itemStack2.getTagCompound())) if (ItemStack.areItemStackTagsEqual(itemStack1, itemStack2))
{ {
return (itemStack1.stackSize - itemStack2.stackSize); return (itemStack1.stackSize - itemStack2.stackSize);
} }
@ -63,6 +66,11 @@ public class ItemHelper
} }
} }
else else
{
return itemStack1.getItem().getUnlocalizedName(itemStack1).compareToIgnoreCase(itemStack2.getItem().getUnlocalizedName(itemStack2));
}
}
else
{ {
return Item.getIdFromItem(itemStack1.getItem()) - Item.getIdFromItem(itemStack2.getItem()); return Item.getIdFromItem(itemStack1.getItem()) - Item.getIdFromItem(itemStack2.getItem());
} }
@ -101,6 +109,9 @@ public class ItemHelper
{ {
// Sort on itemID // Sort on itemID
if (Item.getIdFromItem(itemStack1.getItem()) - Item.getIdFromItem(itemStack2.getItem()) == 0) if (Item.getIdFromItem(itemStack1.getItem()) - Item.getIdFromItem(itemStack2.getItem()) == 0)
{
// Sort on item
if (itemStack1.getItem() == itemStack2.getItem())
{ {
// Then sort on meta // Then sort on meta
if (itemStack1.getItemDamage() == itemStack2.getItemDamage()) if (itemStack1.getItemDamage() == itemStack2.getItemDamage())
@ -109,7 +120,7 @@ public class ItemHelper
if (itemStack1.hasTagCompound() && itemStack2.hasTagCompound()) if (itemStack1.hasTagCompound() && itemStack2.hasTagCompound())
{ {
// Then sort on stack size // Then sort on stack size
if (itemStack1.getTagCompound().equals(itemStack2.getTagCompound())) if (ItemStack.areItemStackTagsEqual(itemStack1, itemStack2))
{ {
return true; return true;
} }
@ -121,6 +132,7 @@ public class ItemHelper
} }
} }
} }
}
return false; return false;
} }