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
68
69
70
71
72
73
74
75
76
77
78
|
package miscutil.core.handler;
import ic2.core.block.invslot.InvSlot;
import miscutil.core.tileentities.TileEntityHeliumGenerator;
import net.minecraft.item.ItemStack;
public class InvSlotRadiation extends InvSlot
{
public InvSlotRadiation(TileEntityHeliumGenerator base, String name1, int oldStartIndex1, int count)
{
super(base, name1, oldStartIndex1, InvSlot.Access.IO, count);
setStackSizeLimit(1);
}
@Override
public boolean accepts(ItemStack itemStack)
{
return ((TileEntityHeliumGenerator)this.base).isUsefulItem(itemStack, true);
}
@Override
public int size()
{
//Utils.LOG_INFO("InvSlotRadiation/Size");
return 3 * 6;
}
public int rawSize()
{
return super.size();
}
@Override
public ItemStack get(int index)
{
return super.get(mapIndex(index));
}
public ItemStack get(int x, int y)
{
return super.get(y * 9 + x);
}
@Override
public void put(int index, ItemStack content)
{
super.put(mapIndex(index), content);
}
public void put(int x, int y, ItemStack content)
{
super.put(y * 9 + x, content);
}
private int mapIndex(int index)
{
int size = size();
int cols = size / 6;
if (index < size)
{
int row = index / cols;
int col = index % cols;
return row * 9 + col;
}
index -= size;
int remCols = 9 - cols;
int row = index / remCols;
int col = cols + index % remCols;
return row * 9 + col;
}
private final int rows = 6;
private final int maxCols = 9;
}
|