added getSlotsByCount
This commit is contained in:
parent
9353ccba8a
commit
755e5ff6b4
@ -96,4 +96,16 @@ abstract InvState(Map<TurtleSlot, {count:Int, name:Item, max:Int}>) {
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get all slots with items sorted from low to high.
|
||||||
|
**/
|
||||||
|
public function getSlotsSortedByCount():Array<TurtleSlot> {
|
||||||
|
var keys = [for (k in this.keys()) k];
|
||||||
|
keys.sort((a, b) -> {
|
||||||
|
return this.get(a).count - this.get(b).count;
|
||||||
|
});
|
||||||
|
|
||||||
|
return keys;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user