fix bug where StorageItem compared NBT badly with null

This commit is contained in:
Raoul Van den Berge
2016-02-03 23:17:38 +01:00
parent f84bd3ffa1
commit b0a141bd09

View File

@@ -133,10 +133,18 @@ public class StorageItem
if ((flags & InventoryUtils.COMPARE_NBT) == InventoryUtils.COMPARE_NBT)
{
if (tag != null && !tag.equals(other.getTag()))
if ((tag != null && other.getTag() == null) || (tag == null && other.getTag() != null))
{
return false;
}
if (tag != null && other.getTag() != null)
{
if (!tag.equals(other.getTag()))
{
return false;
}
}
}
if ((flags & InventoryUtils.COMPARE_QUANTITY) == InventoryUtils.COMPARE_QUANTITY)
@@ -162,10 +170,18 @@ public class StorageItem
if ((flags & InventoryUtils.COMPARE_NBT) == InventoryUtils.COMPARE_NBT)
{
if (tag != null && !tag.equals(stack.getTagCompound()))
if ((tag != null && stack.getTagCompound() == null) || (tag == null && stack.getTagCompound() != null))
{
return false;
}
if (tag != null && stack.getTagCompound() != null)
{
if (!tag.equals(stack.getTagCompound()))
{
return false;
}
}
}
if ((flags & InventoryUtils.COMPARE_QUANTITY) == InventoryUtils.COMPARE_QUANTITY)