some changes to make sure 1.11 stacks don't mess with the old insert extract code

This commit is contained in:
way2muchnoise
2017-02-02 17:41:34 +01:00
parent afd38354e3
commit a1ff3960d8
3 changed files with 10 additions and 7 deletions

View File

@@ -168,12 +168,12 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
ItemStack stack = storage.getStacks().get(i); ItemStack stack = storage.getStacks().get(i);
ItemStack extracted = storage.extract(stack, upgrades.getItemInteractCount(), compare, false); ItemStack extracted = storage.extract(stack, upgrades.getItemInteractCount(), compare, false);
if (extracted == null) { if (extracted == null || extracted.isEmpty()) {
continue; continue;
} }
ItemStack remainder = network.insertItem(extracted, extracted.getCount(), false); ItemStack remainder = network.insertItem(extracted, extracted.getCount(), false);
if (remainder == null) { if (remainder == null || remainder.isEmpty()) {
break; break;
} }
@@ -201,7 +201,7 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
int j = 0; int j = 0;
while ((toExtract == null || toExtract.getCount() == 0) && j < networkItems.size()) { while ((toExtract == null || toExtract.isEmpty()) && j < networkItems.size()) {
toExtract = networkItems.get(j++); toExtract = networkItems.get(j++);
} }

View File

@@ -149,11 +149,14 @@ public class Comparer implements IComparer {
return EnumActionResult.FAIL; return EnumActionResult.FAIL;
} }
if (left.isEmpty() && right.isEmpty()) { boolean leftEmpty = left.isEmpty();
boolean rightEmpty = right.isEmpty();
if (leftEmpty && rightEmpty) {
return EnumActionResult.SUCCESS; return EnumActionResult.SUCCESS;
} }
if ((left.isEmpty() && !right.isEmpty()) || (!left.isEmpty() && right.isEmpty())) { if ((leftEmpty && !rightEmpty) || (!rightEmpty) && rightEmpty) {
return EnumActionResult.FAIL; return EnumActionResult.FAIL;
} }

View File

@@ -446,7 +446,7 @@ public class TileController extends TileBase implements INetworkMaster, IRedston
inserted += storage.getCacheDelta(storedPre, size, remainder); inserted += storage.getCacheDelta(storedPre, size, remainder);
} }
if (remainder == null) { if (remainder == null || remainder.isEmpty()) {
// The external storage is responsible for sending changes, we don't need to anymore // The external storage is responsible for sending changes, we don't need to anymore
if (storage instanceof StorageItemExternal && !simulate) { if (storage instanceof StorageItemExternal && !simulate) {
((StorageItemExternal) storage).detectChanges(this); ((StorageItemExternal) storage).detectChanges(this);
@@ -490,7 +490,7 @@ public class TileController extends TileBase implements INetworkMaster, IRedston
took = storage.extract(stack, requested - received, flags, simulate); took = storage.extract(stack, requested - received, flags, simulate);
} }
if (took != null) { if (took != null && !took.isEmpty()) {
// The external storage is responsible for sending changes, we don't need to anymore // The external storage is responsible for sending changes, we don't need to anymore
if (storage instanceof StorageItemExternal && !simulate) { if (storage instanceof StorageItemExternal && !simulate) {
((StorageItemExternal) storage).detectChanges(this); ((StorageItemExternal) storage).detectChanges(this);