2013-12-27 23:59:59 +01:00
|
|
|
package appeng.util.iterators;
|
|
|
|
|
|
|
|
import java.util.Iterator;
|
|
|
|
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import appeng.util.inv.ItemSlot;
|
|
|
|
|
|
|
|
public class StackToSlotIterator implements Iterator<ItemSlot>
|
|
|
|
{
|
|
|
|
|
|
|
|
int x = 0;
|
|
|
|
final ItemSlot iss = new ItemSlot();
|
|
|
|
final Iterator<ItemStack> is;
|
|
|
|
|
|
|
|
public StackToSlotIterator(Iterator<ItemStack> is) {
|
|
|
|
this.is = is;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean hasNext()
|
|
|
|
{
|
|
|
|
return is.hasNext();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public ItemSlot next()
|
|
|
|
{
|
|
|
|
iss.slot = x++;
|
2014-05-04 02:21:33 +02:00
|
|
|
iss.setItemStack( is.next() );
|
2013-12-27 23:59:59 +01:00
|
|
|
return iss;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void remove()
|
|
|
|
{
|
|
|
|
// uhh no.
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|