some changes to make sure 1.11 stacks don't mess with the old insert extract code
This commit is contained in:
@@ -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++);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user