"Finished" check now considers the set IO mode (#1709)

* "Finished" check now considers the set IO mode

* Fixed behaviour, removed useless code

* oops, my branch wasnt up to date apparently

* forgot moving drive to output when full

* apparently wrong indentation

* Update NetworkNodeDiskManipulator.java

* changed format

* f o r m a t
This commit is contained in:
ineternet
2018-03-14 19:43:25 +01:00
committed by Raoul
parent e7b7c3052b
commit 727be6c6ec

View File

@@ -195,19 +195,24 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
// We need to check if the stack was inserted
storage.insert(((extracted == remainder) ? remainder.copy() : remainder), remainder.getCount(), false);
}
if (storage.getStacks().size() == 0) {
moveDriveToOutput(slot);
}
}
//Iterate through disk stacks, if none can be inserted, return that it is done processing and can be output.
private boolean checkItemDiskDone(IStorageDisk<ItemStack> storage, int slot) {
if (storage.getStored() == 0) {
if (ioMode == IO_MODE_INSERT && storage.getStored() == 0) {
moveDriveToOutput(slot);
return true;
}
//In Extract mode, we just need to check if the disk is full or not.
if (ioMode == IO_MODE_EXTRACT)
if (storage.getStored() == storage.getCapacity()) {
moveDriveToOutput(slot);
return true;
} else {
return false;
}
List<ItemStack> stacks = new ArrayList<>(storage.getStacks());
for (int i = 0; i < stacks.size(); ++i) {
ItemStack stack = stacks.get(i);
@@ -226,11 +231,6 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
}
private void extractItemFromNetwork(IStorageDisk<ItemStack> storage, int slot) {
if (storage.getStored() == storage.getCapacity()) {
moveDriveToOutput(slot);
return;
}
ItemStack extracted = null;
int i = 0;
@@ -298,11 +298,20 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
}
private boolean checkFluidDiskDone(IStorageDisk<FluidStack> storage, int slot) {
if (storage.getStored() == 0) {
if (ioMode == IO_MODE_INSERT && storage.getStored() == 0) {
moveDriveToOutput(slot);
return true;
}
//In Extract mode, we just need to check if the disk is full or not.
if (ioMode == IO_MODE_EXTRACT)
if (storage.getStored() == storage.getCapacity()) {
moveDriveToOutput(slot);
return true;
} else {
return false;
}
List<FluidStack> stacks = new ArrayList<>(storage.getStacks());
for (int i = 0; i < stacks.size(); ++i) {
FluidStack stack = stacks.get(i);
@@ -321,11 +330,6 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
}
private void extractFluidFromNetwork(IStorageDisk<FluidStack> storage, int slot) {
if (storage.getStored() == storage.getCapacity()) {
moveDriveToOutput(slot);
return;
}
FluidStack extracted = null;
int i = 0;