* fixes #1147 Previously, the manipulator would stop and stuck on a disk when it isn't empty, but also cannot be emptied any more (network is full). This fixes this: If the network cannot accept any items anymore, the disk will be moved to output. * Update CHANGELOG.md * removed testing leftovers * changed behaviour
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
- Changed stack quantity of craftable items from 1 to 0 to fix Quantity Sorting (ineternet)
|
- Changed stack quantity of craftable items from 1 to 0 to fix Quantity Sorting (ineternet)
|
||||||
- Changed fluid stack amount to not display "0" anymore (ineternet)
|
- Changed fluid stack amount to not display "0" anymore (ineternet)
|
||||||
- Fixed NBT/metadata check on exporting in an Interface (ineternet)
|
- Fixed NBT/metadata check on exporting in an Interface (ineternet)
|
||||||
|
- Fixed Disk Manipulator being stuck on unemptiable, non-empty disks (ineternet)
|
||||||
|
|
||||||
### 1.5.31
|
### 1.5.31
|
||||||
- Improved the "cannot craft! loop in processing..." error message (raoulvdberge)
|
- Improved the "cannot craft! loop in processing..." error message (raoulvdberge)
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
|
|||||||
|
|
||||||
int slot = 0;
|
int slot = 0;
|
||||||
if (type == IType.ITEMS) {
|
if (type == IType.ITEMS) {
|
||||||
while (slot < 3 && itemStorages[slot] == null) {
|
while (slot < 3 && (itemStorages[slot] == null || checkItemDiskDone(itemStorages[slot], slot))) {
|
||||||
slot++;
|
slot++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
|
|||||||
extractItemFromNetwork(storage, slot);
|
extractItemFromNetwork(storage, slot);
|
||||||
}
|
}
|
||||||
} else if (type == IType.FLUIDS) {
|
} else if (type == IType.FLUIDS) {
|
||||||
while (slot < 3 && fluidStorages[slot] == null) {
|
while (slot < 3 && (fluidStorages[slot] == null || checkFluidDiskDone(fluidStorages[slot], slot))) {
|
||||||
slot++;
|
slot++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,11 +166,6 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void insertItemIntoNetwork(IStorageDisk<ItemStack> storage, int slot) {
|
private void insertItemIntoNetwork(IStorageDisk<ItemStack> storage, int slot) {
|
||||||
if (storage.getStored() == 0) {
|
|
||||||
moveDriveToOutput(slot);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<ItemStack> stacks = new ArrayList<>(storage.getStacks());
|
List<ItemStack> stacks = new ArrayList<>(storage.getStacks());
|
||||||
for (int i = 0; i < stacks.size(); ++i) {
|
for (int i = 0; i < stacks.size(); ++i) {
|
||||||
ItemStack stack = stacks.get(i);
|
ItemStack stack = stacks.get(i);
|
||||||
@@ -194,6 +189,30 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//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) {
|
||||||
|
moveDriveToOutput(slot);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ItemStack> stacks = new ArrayList<>(storage.getStacks());
|
||||||
|
for (int i = 0; i < stacks.size(); ++i) {
|
||||||
|
ItemStack stack = stacks.get(i);
|
||||||
|
|
||||||
|
ItemStack extracted = storage.extract(stack, upgrades.getItemInteractCount(), compare, true);
|
||||||
|
if (extracted == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemStack remainder = network.insertItem(extracted, extracted.getCount(), true);
|
||||||
|
if (remainder == null) { //An item could be inserted (no remainders when trying to). This disk isn't done.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private void extractItemFromNetwork(IStorageDisk<ItemStack> storage, int slot) {
|
private void extractItemFromNetwork(IStorageDisk<ItemStack> storage, int slot) {
|
||||||
if (storage.getStored() == storage.getCapacity()) {
|
if (storage.getStored() == storage.getCapacity()) {
|
||||||
moveDriveToOutput(slot);
|
moveDriveToOutput(slot);
|
||||||
@@ -243,11 +262,6 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void insertFluidIntoNetwork(IStorageDisk<FluidStack> storage, int slot) {
|
private void insertFluidIntoNetwork(IStorageDisk<FluidStack> storage, int slot) {
|
||||||
if (storage.getStored() == 0) {
|
|
||||||
moveDriveToOutput(slot);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<FluidStack> stacks = new ArrayList<>(storage.getStacks());
|
List<FluidStack> stacks = new ArrayList<>(storage.getStacks());
|
||||||
|
|
||||||
FluidStack extracted = null;
|
FluidStack extracted = null;
|
||||||
@@ -271,6 +285,29 @@ public class NetworkNodeDiskManipulator extends NetworkNode implements IComparab
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean checkFluidDiskDone(IStorageDisk<FluidStack> storage, int slot) {
|
||||||
|
if (storage.getStored() == 0) {
|
||||||
|
moveDriveToOutput(slot);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<FluidStack> stacks = new ArrayList<>(storage.getStacks());
|
||||||
|
for (int i = 0; i < stacks.size(); ++i) {
|
||||||
|
FluidStack stack = stacks.get(i);
|
||||||
|
|
||||||
|
FluidStack extracted = storage.extract(stack, upgrades.getItemInteractCount(), compare, true);
|
||||||
|
if (extracted == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
FluidStack remainder = network.insertFluid(extracted, extracted.amount, true);
|
||||||
|
if (remainder == null) { //A fluid could be inserted (no remainders when trying to). This disk isn't done.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private void extractFluidFromNetwork(IStorageDisk<FluidStack> storage, int slot) {
|
private void extractFluidFromNetwork(IStorageDisk<FluidStack> storage, int slot) {
|
||||||
if (storage.getStored() == storage.getCapacity()) {
|
if (storage.getStored() == storage.getCapacity()) {
|
||||||
moveDriveToOutput(slot);
|
moveDriveToOutput(slot);
|
||||||
|
|||||||
Reference in New Issue
Block a user