blob: 3694aee140ff484aea99aa135db258a490b6bc93 (
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
package ihl.flexible_cable;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public class InvSlotOutputInProgress extends IronWorkbenchInvSlot{
public short[] slotRecipe;
private int size;
public InvSlotOutputInProgress(IronWorkbenchTileEntity base1, String name1, int oldStartIndex1, int count) {
super(base1, name1, oldStartIndex1, Access.NONE, count);
slotRecipe = new short[count];
size=count;
for(int i=0;i<slotRecipe.length;i++)
{
slotRecipe[i]=-1;
}
}
@Override
public boolean accepts(ItemStack itemStack)
{
return false;
}
@Override
public boolean getCanTakeStack()
{
return false;
}
@Override
public void writeToNbt(NBTTagCompound nbtTagCompound){}
@Override
public void readFromNbt(NBTTagCompound nbtTagCompound){}
public short put(List<ItemStack> outputs)
{
short slot=this.getFirstEmptySlot();
if(slot!=-1 && outputs!=null && !outputs.isEmpty() && slot<=this.size()-outputs.size())
{
for(int i=0;i<outputs.size();i++)
{
ItemStack output = outputs.get(i);
this.put(slot+i,output.copy());
this.slotRecipe[slot+i]=slot;
}
}
return slot;
}
private short getFirstEmptySlot()
{
for(short i=0; i<this.size();i++)
{
if(this.get(i)==null)
{
return i;
}
}
return -1;
}
public int getCheckSum()
{
int sum=0;
for(short i=0; i<this.size();i++)
{
sum+=this.slotRecipe[i];
}
return sum;
}
public List<ItemStack> getRecipeOutputs(int currentSlot)
{
int slotRecipeIndex=this.slotRecipe[currentSlot];
List<ItemStack> list = new ArrayList<ItemStack>();
for(int i=0;i<this.size;i++)
{
if(this.slotRecipe[i]==slotRecipeIndex)
{
list.add(get(i));
}
}
return list;
}
}
|