summaryrefslogtreecommitdiff
path: root/ihl/processing/chemistry/ApparatusProcessableInvSlot.java
blob: f0b69b3c4845f7f126f6a432044d82c39849aea3 (plain)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package ihl.processing.chemistry;

import ic2.core.block.TileEntityInventory;
import ic2.core.block.invslot.InvSlot;
import java.util.ArrayList;
import java.util.List;

import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;

public class ApparatusProcessableInvSlot extends InvSlot {

	public ApparatusProcessableInvSlot(TileEntityInventory base1, String name1,
			int oldStartIndex1, Access access1, int count, int stackSizeLimit1) {
		super(base1, name1, oldStartIndex1, access1, count);
		this.setStackSizeLimit(stackSizeLimit1);
	}
	
	public List<ItemStack> getItemStackList()
	{
		List<ItemStack> list = new ArrayList();
		for(int i=0; i<this.size(); i++)
		{
			if(get(i)!=null)
			{
				list.add(get(i));
			}
		}
		return list;
	}
	
	public ItemStack getItemStack(Item item) {
		for(int i=0; i<this.size(); i++)
		{
			if(get(i)!=null && get(i).getItem()==item)
			{
				return get(i);
			}
		}
		return null;
	}

	public void replaceItemStack(ItemStack stack1) 
	{
		for(int i=0; i<this.size(); i++)
		{
			if(this.get(i)!=null && this.get(i).getItem()==stack1.getItem())
			{
				this.put(i,stack1);
			}
		}
	}

	public void consume(int i, int stackSize1) 
	{
		if(this.get(i)==null)return;
		if(this.get(i).stackSize==stackSize1)
		{
			this.put(i, null);
		}
		else
		{
			this.get(i).stackSize-=stackSize1;
		}
	}

}