Fixed #446 - Crate stacking non equal items

This commit is contained in:
Calclavia 2014-03-16 08:58:24 +08:00
parent 2fb0886c99
commit 772f6caedb

View file

@ -252,23 +252,23 @@ public class BlockCrate extends BlockTile
if (currentStack != null) if (currentStack != null)
{ {
if (currentStack.getItem().itemID == this.blockID) if (currentStack.getItem().itemID == blockID)
{ {
ItemStack containedStack = ItemBlockCrate.getContainingItemStack(currentStack); ItemStack containedStack = ItemBlockCrate.getContainingItemStack(currentStack);
ItemStack crateStack = tileEntity.getSampleStack(); ItemStack crateStack = tileEntity.getSampleStack();
if (containedStack != null && (crateStack == null || (crateStack != null && containedStack.isItemEqual(crateStack))))
if (containedStack != null && (crateStack == null || ItemStack.areItemStacksEqual(containedStack, crateStack)))
{ {
ItemStack returned = BlockCrate.addStackToCrate(tileEntity, containedStack); ItemStack returned = BlockCrate.addStackToCrate(tileEntity, containedStack);
ItemBlockCrate.setContainingItemStack(currentStack, returned); ItemBlockCrate.setContainingItemStack(currentStack, returned);
return true; return true;
} }
} }
else else
{ {
if (tileEntity.getSampleStack() != null) if (tileEntity.getSampleStack() != null)
{ {
if (!(tileEntity.getSampleStack().isItemEqual(currentStack) || OreDictionary.getOreID(tileEntity.getSampleStack()) == OreDictionary.getOreID(currentStack))) if (!(tileEntity.getSampleStack().isItemEqual(currentStack) || (!OreDictionary.getOreName(OreDictionary.getOreID(tileEntity.getSampleStack())).equals("Unknown") && OreDictionary.getOreID(tileEntity.getSampleStack()) == OreDictionary.getOreID(currentStack))))
{ {
return false; return false;
} }