Stack router fix

This commit is contained in:
Anuken
2023-05-25 09:13:37 -04:00
parent f5a32fdb6b
commit 6a8e0eb6b2

View File

@@ -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();
}
}