-
Notifications
You must be signed in to change notification settings - Fork 497
/
InventoryIterator.java
47 lines (36 loc) · 1.03 KB
/
InventoryIterator.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package buildcraft.core.inventory;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
/**
* @author CovertJaguar <http://www.railcraft.info>
*/
public class InventoryIterator {
/**
* Returns an Iterable object for the specified side of the inventory.
*
* @param inv
* @param side
* @return Iterable
*/
public static Iterable<IInvSlot> getIterable(IInventory inv, ForgeDirection side) {
if (inv instanceof ISidedInventory) {
return new InventoryIteratorSided((ISidedInventory) inv, side);
}
return new InventoryIteratorSimple(inv);
}
public interface IInvSlot {
/**
* Returns the slot number of the underlying Inventory.
*
* @return the slot number
*/
int getIndex();
boolean canPutStackInSlot(ItemStack stack);
boolean canTakeStackFromSlot(ItemStack stack);
ItemStack decreaseStackInSlot();
ItemStack getStackInSlot();
void setStackInSlot(ItemStack stack);
}
}