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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
|
package gregtech.common.gui;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.gui.GT_ContainerMetaTile_Machine;
import gregtech.api.gui.GT_Slot_Holo;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.common.tileentities.debug.GT_MetaTileEntity_AdvDebugStructureWriter;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class GT_Container_AdvDebugStructureWriter extends GT_ContainerMetaTile_Machine {
public short[] numbers = new short[6];
public boolean transpose;
public boolean showHighlightBox;
public Slot printSlot;
public Slot transposeSlot;
public Slot highlightSlot;
public GT_Container_AdvDebugStructureWriter(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
super(aInventoryPlayer, aTileEntity);
}
@Override
public void addSlots(InventoryPlayer aInventoryPlayer) {
addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 5, false, false, 1));
addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 23, false, false, 1));
addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 41, false, false, 1));
addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 63, false, false, 1));
addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 81, false, false, 1));
addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 99, false, false, 1));
addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 5, false, false, 1));
addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 23, false, false, 1));
addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 41, false, false, 1));
addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 63, false, false, 1));
addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 81, false, false, 1));
addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 99, false, false, 1));
addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 5, false, false, 1));
addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 23, false, false, 1));
addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 41, false, false, 1));
addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 63, false, false, 1));
addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 81, false, false, 1));
addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 99, false, false, 1));
addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 5, false, false, 1));
addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 23, false, false, 1));
addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 41, false, false, 1));
addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 63, false, false, 1));
addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 81, false, false, 1));
addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 99, false, false, 1));
printSlot = addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 12, 129, false, false, 1));
transposeSlot = addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 33, 129, false, false, 1));
highlightSlot = addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 54, 129, false, false, 1));
}
public boolean doesBindPlayerInventory() {
return false;
}
@Override
public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) {
if (aSlotIndex < 0) {
return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
}
Slot tSlot = (Slot) inventorySlots.get(aSlotIndex);
if (tSlot != null && mTileEntity.getMetaTileEntity() != null) {
GT_MetaTileEntity_AdvDebugStructureWriter dsw =
(GT_MetaTileEntity_AdvDebugStructureWriter) mTileEntity.getMetaTileEntity();
if (dsw.numbers == null) {
return null;
}
switch (aSlotIndex) {
case 0:
dsw.numbers[0] -= aShifthold == 1 ? 512 : 64;
return null;
case 1:
dsw.numbers[1] -= aShifthold == 1 ? 512 : 64;
return null;
case 2:
dsw.numbers[2] -= aShifthold == 1 ? 512 : 64;
return null;
case 3:
dsw.numbers[3] -= aShifthold == 1 ? 512 : 64;
return null;
case 4:
dsw.numbers[4] -= aShifthold == 1 ? 512 : 64;
return null;
case 5:
dsw.numbers[5] -= aShifthold == 1 ? 512 : 64;
return null;
case 6:
dsw.numbers[0] -= aShifthold == 1 ? 16 : 1;
return null;
case 7:
dsw.numbers[1] -= aShifthold == 1 ? 16 : 1;
return null;
case 8:
dsw.numbers[2] -= aShifthold == 1 ? 16 : 1;
return null;
case 9:
dsw.numbers[3] -= aShifthold == 1 ? 16 : 1;
return null;
case 10:
dsw.numbers[4] -= aShifthold == 1 ? 16 : 1;
return null;
case 11:
dsw.numbers[5] -= aShifthold == 1 ? 16 : 1;
return null;
case 12:
dsw.numbers[0] += aShifthold == 1 ? 512 : 64;
return null;
case 13:
dsw.numbers[1] += aShifthold == 1 ? 512 : 64;
return null;
case 14:
dsw.numbers[2] += aShifthold == 1 ? 512 : 64;
return null;
case 15:
dsw.numbers[3] += aShifthold == 1 ? 512 : 64;
return null;
case 16:
dsw.numbers[4] += aShifthold == 1 ? 512 : 64;
return null;
case 17:
dsw.numbers[5] += aShifthold == 1 ? 512 : 64;
return null;
case 18:
dsw.numbers[0] += aShifthold == 1 ? 16 : 1;
return null;
case 19:
dsw.numbers[1] += aShifthold == 1 ? 16 : 1;
return null;
case 20:
dsw.numbers[2] += aShifthold == 1 ? 16 : 1;
return null;
case 21:
dsw.numbers[3] += aShifthold == 1 ? 16 : 1;
return null;
case 22:
dsw.numbers[4] += aShifthold == 1 ? 16 : 1;
return null;
case 23:
dsw.numbers[5] += aShifthold == 1 ? 16 : 1;
return null;
case 24:
if (dsw.getBaseMetaTileEntity().isServerSide()) {
dsw.printStructure(aPlayer);
}
return null;
case 25:
dsw.transpose = !dsw.transpose;
return null;
case 26:
dsw.showHighlightBox = !dsw.showHighlightBox;
return null;
}
}
return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) {
return;
}
GT_MetaTileEntity_AdvDebugStructureWriter dsw =
(GT_MetaTileEntity_AdvDebugStructureWriter) mTileEntity.getMetaTileEntity();
if (numbers != null) {
System.arraycopy(dsw.numbers, 0, numbers, 0, dsw.numbers.length);
}
transpose = dsw.transpose;
showHighlightBox = dsw.showHighlightBox;
for (Object crafter : crafters) {
ICrafting var1 = (ICrafting) crafter;
if (numbers != null) {
var1.sendProgressBarUpdate(this, 100, numbers[0]);
var1.sendProgressBarUpdate(this, 101, numbers[1]);
var1.sendProgressBarUpdate(this, 102, numbers[2]);
var1.sendProgressBarUpdate(this, 103, numbers[3]);
var1.sendProgressBarUpdate(this, 104, numbers[4]);
var1.sendProgressBarUpdate(this, 105, numbers[5]);
var1.sendProgressBarUpdate(this, 106, transpose ? 1 : 0);
var1.sendProgressBarUpdate(this, 107, showHighlightBox ? 1 : 0);
}
}
}
@Override
@SideOnly(Side.CLIENT)
public void updateProgressBar(int par1, int par2) {
super.updateProgressBar(par1, par2);
if (par1 == 106) {
transpose = par2 > 0;
} else if (par1 == 107) {
showHighlightBox = par2 > 0;
} else {
if (numbers != null && par1 >= 100 && par1 <= 105) {
numbers[par1 - 100] = (short) par2;
}
}
}
}
|