From 214742e08cfd685be0e85582726b636284e8881b Mon Sep 17 00:00:00 2001 From: Raoul Van den Berge Date: Sat, 4 Jun 2016 00:54:40 +0200 Subject: [PATCH] Update changelog --- CHANGELOG.md | 2 ++ .../refinedstorage/storage/NBTStorage.java | 4 ++- .../tile/TileExternalStorage.java | 4 +-- .../tile/controller/TileController.java | 28 ++++++++----------- 4 files changed, 18 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0c3719ce..828fd1635 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ - Fixed solderer not supporting ore dictionary - Fixed recipes not supporting ore dictionary - Fixed destructor not being able to destroy some blocks +- Fixed not being able to place or destroy sugar cane +- New items now go to the first available storage that has items in it already - Performance improvements **Features** diff --git a/src/main/java/refinedstorage/storage/NBTStorage.java b/src/main/java/refinedstorage/storage/NBTStorage.java index 7a38374f7..7a80cb857 100755 --- a/src/main/java/refinedstorage/storage/NBTStorage.java +++ b/src/main/java/refinedstorage/storage/NBTStorage.java @@ -47,7 +47,9 @@ public abstract class NBTStorage implements IStorage { stack.setTagCompound(tag.hasKey(NBT_ITEM_NBT) ? ((NBTTagCompound) tag.getTag(NBT_ITEM_NBT)) : null); - stacks.add(stack); + if (stack.getItem() != null) { + stacks.add(stack); + } } } diff --git a/src/main/java/refinedstorage/tile/TileExternalStorage.java b/src/main/java/refinedstorage/tile/TileExternalStorage.java index 0c9d21dff..47c07da5a 100755 --- a/src/main/java/refinedstorage/tile/TileExternalStorage.java +++ b/src/main/java/refinedstorage/tile/TileExternalStorage.java @@ -46,7 +46,7 @@ public class TileExternalStorage extends TileMachine implements IStorageProvider IDeepStorageUnit storageUnit = getStorageUnit(); if (storageUnit != null) { - if (storageUnit.getStoredItemType() != null) { + if (storageUnit.getStoredItemType() != null && storageUnit.getStoredItemType().getItem() != null) { items.add(storageUnit.getStoredItemType().copy()); } } else { @@ -54,7 +54,7 @@ public class TileExternalStorage extends TileMachine implements IStorageProvider if (handler != null) { for (int i = 0; i < handler.getSlots(); ++i) { - if (handler.getStackInSlot(i) != null) { + if (handler.getStackInSlot(i) != null && handler.getStackInSlot(i).getItem() != null) { items.add(handler.getStackInSlot(i).copy()); } } diff --git a/src/main/java/refinedstorage/tile/controller/TileController.java b/src/main/java/refinedstorage/tile/controller/TileController.java index bd51e0625..53606f1ba 100755 --- a/src/main/java/refinedstorage/tile/controller/TileController.java +++ b/src/main/java/refinedstorage/tile/controller/TileController.java @@ -335,26 +335,20 @@ public class TileController extends TileBase implements IEnergyReceiver, ISynchr ItemStack stack = items.get(i); - // If the item doesn't exist anymore, remove it from storage to avoid crashes - if (stack.getItem() == null) { - combinedItems.add(stack); - combinedItemsIndices.add(i); - } else { - for (int j = i + 1; j < items.size(); ++j) { - if (combinedItemsIndices.contains(j)) { - continue; - } + for (int j = i + 1; j < items.size(); ++j) { + if (combinedItemsIndices.contains(j)) { + continue; + } - ItemStack otherStack = items.get(j); + ItemStack otherStack = items.get(j); - if (RefinedStorageUtils.compareStackNoQuantity(stack, otherStack)) { - // We copy here so we don't modify the quantity of the ItemStack IStorage uses. - // We re-get the ItemStack because the stack may change from a previous iteration in this loop - items.set(i, ItemHandlerHelper.copyStackWithSize(items.get(i), items.get(i).stackSize + otherStack.stackSize)); + if (RefinedStorageUtils.compareStackNoQuantity(stack, otherStack)) { + // We copy here so we don't modify the quantity of the ItemStack IStorage uses. + // We re-get the ItemStack because the stack may change from a previous iteration in this loop + items.set(i, ItemHandlerHelper.copyStackWithSize(items.get(i), items.get(i).stackSize + otherStack.stackSize)); - combinedItems.add(otherStack); - combinedItemsIndices.add(j); - } + combinedItems.add(otherStack); + combinedItemsIndices.add(j); } } }