Fixed OpenComputers "unknown error" when using extract item API. Fixes #2049

This commit is contained in:
raoulvdberge
2018-10-22 19:37:00 +02:00
parent 0ce1c3e12e
commit 2f0b7b3eba
2 changed files with 7 additions and 2 deletions

View File

@@ -1,5 +1,8 @@
# Refined Storage Changelog
### 1.6.9
- Fixed OpenComputers "unknown error" when using extract item API (raoulvdberge)
### 1.6.8
- Fixed Ender IO incompatibility (raoulvdberge)

View File

@@ -270,7 +270,7 @@ public class EnvironmentNetwork extends AbstractManagedEnvironment {
// Simulate extracting the item and get the amount of items that can be extracted
ItemStack extractedSim = node.getNetwork().extractItem(stack, count, Action.SIMULATE);
if (extractedSim.isEmpty() || extractedSim.getCount() == 0) {
if (extractedSim == null) {
return new Object[]{null, "could not extract the specified item"};
}
@@ -290,7 +290,9 @@ public class EnvironmentNetwork extends AbstractManagedEnvironment {
// Actually do it and return how many items we've inserted
ItemStack extracted = node.getNetwork().extractItem(stack, count, Action.PERFORM);
ItemHandlerHelper.insertItemStacked(handler, extracted, false);
if (extracted != null) {
ItemHandlerHelper.insertItemStacked(handler, extracted, false);
}
return new Object[]{transferableAmount};
}