diff --git a/core/src/mindustry/world/blocks/distribution/StackRouter.java b/core/src/mindustry/world/blocks/distribution/StackRouter.java index ea707098b4..e763b2ece1 100644 --- a/core/src/mindustry/world/blocks/distribution/StackRouter.java +++ b/core/src/mindustry/world/blocks/distribution/StackRouter.java @@ -44,7 +44,7 @@ public class StackRouter extends DuctRouter{ if(unloading && current != null){ //unload when possible var target = target(); - while(target != null && items.total() > 0){ + while(target != null && items.get(current) > 0){ target.handleItem(this, current); items.remove(current, 1); @@ -52,13 +52,13 @@ public class StackRouter extends DuctRouter{ } //if out of items, unloading is over - if(items.total() == 0){ + if(items.get(current) == 0){ current = null; unloading = false; } } - if(current == null && items.total() > 0){ + if((current == null || items.get(current) == 0) && items.total() > 0){ current = items.first(); } }