Storage bus can now update all the way down to zero items for External Storages.
This commit is contained in:
parent
e1c6b18399
commit
60d1ecc965
2 changed files with 23 additions and 5 deletions
|
@ -18,6 +18,7 @@ public class IMEAdaptor extends InventoryAdaptor
|
||||||
|
|
||||||
IMEInventory<IAEItemStack> target;
|
IMEInventory<IAEItemStack> target;
|
||||||
BaseActionSource src;
|
BaseActionSource src;
|
||||||
|
int maxSlots = 0;
|
||||||
|
|
||||||
public IMEAdaptor(IMEInventory<IAEItemStack> input, BaseActionSource src) {
|
public IMEAdaptor(IMEInventory<IAEItemStack> input, BaseActionSource src) {
|
||||||
target = input;
|
target = input;
|
||||||
|
@ -32,7 +33,7 @@ public class IMEAdaptor extends InventoryAdaptor
|
||||||
@Override
|
@Override
|
||||||
public Iterator<ItemSlot> iterator()
|
public Iterator<ItemSlot> iterator()
|
||||||
{
|
{
|
||||||
return new IMEAdaptorIterator( getList() );
|
return new IMEAdaptorIterator( this, getList() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack doRemoveItemsFuzzy(int how_many, ItemStack Filter, IInventoryDestination destination, Actionable type, FuzzyMode fuzzyMode)
|
public ItemStack doRemoveItemsFuzzy(int how_many, ItemStack Filter, IInventoryDestination destination, Actionable type, FuzzyMode fuzzyMode)
|
||||||
|
|
|
@ -11,23 +11,40 @@ public class IMEAdaptorIterator implements Iterator<ItemSlot>
|
||||||
Iterator<IAEItemStack> stack;
|
Iterator<IAEItemStack> stack;
|
||||||
ItemSlot slot = new ItemSlot();
|
ItemSlot slot = new ItemSlot();
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
boolean hasNext;
|
||||||
|
|
||||||
public IMEAdaptorIterator(IItemList<IAEItemStack> availableItems) {
|
final IMEAdaptor parent;
|
||||||
|
final int containerSize;
|
||||||
|
|
||||||
|
public IMEAdaptorIterator(IMEAdaptor parent, IItemList<IAEItemStack> availableItems) {
|
||||||
stack = availableItems.iterator();
|
stack = availableItems.iterator();
|
||||||
|
containerSize = parent.maxSlots;
|
||||||
|
this.parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasNext()
|
public boolean hasNext()
|
||||||
{
|
{
|
||||||
return stack.hasNext();
|
hasNext = stack.hasNext();
|
||||||
|
return offset < containerSize || hasNext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemSlot next()
|
public ItemSlot next()
|
||||||
|
{
|
||||||
|
slot.slot = offset++;
|
||||||
|
|
||||||
|
if ( parent.maxSlots < offset )
|
||||||
|
parent.maxSlots = offset;
|
||||||
|
|
||||||
|
if ( hasNext )
|
||||||
{
|
{
|
||||||
IAEItemStack item = stack.next();
|
IAEItemStack item = stack.next();
|
||||||
slot.setAEItemStack( item );
|
slot.setAEItemStack( item );
|
||||||
slot.slot = offset++;
|
return slot;
|
||||||
|
}
|
||||||
|
|
||||||
|
slot.setItemStack( null );
|
||||||
return slot;
|
return slot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue