try {
DataInputStream packetData = new DataInputStream( new ByteArrayInputStream( packet.data ) );
action = packetData.readByte();
if( action == 0x01 ) {
EntityPlayer player = (EntityPlayer) packetSender;
byte guiID = packetData.readByte();
short meta = packetData.readShort();
int x = packetData.readInt();
int y = packetData.readInt();
int z = packetData.readInt();
player.openGui( XActMod.instance, (meta << 8) | guiID, player.worldObj, x, y, z );
return;
}
if( action == 0x02 ) {
InteractiveCraftingContainer container = (InteractiveCraftingContainer) ((EntityPlayer) packetSender).openContainer;
int stacks = packetData.readByte();
int offSet = packetData.readByte();
for( int i = 0; i < stacks; i++ ) {
ItemStack item = getItemStack( packetData );
container.setStack( offSet++, item );
}
return;
}
// Gui sending an ItemStack to Container.
if( action == 0x03 ) {
int slotID = packetData.readByte();
InteractiveCraftingContainer container = (InteractiveCraftingContainer) ((EntityPlayer) packetSender).openContainer;
// clear the grid before placing the stacks.
if( slotID == -1 ) {
container.setStack( -1, null );
return;
}
// place a recipe on the slot.
ItemStack stack = getItemStack( packetData );
container.setStack( slotID, stack );
return;
}
// GuiPlan requesting a recipe (server side)
if( action == 0x04 ) {
// must open the recipe gui.
EntityPlayer player = (EntityPlayer) packetSender;
player.openGui( XActMod.instance, 5, player.worldObj, 0, 0, 0 );
return;
}
// ContainerRecipe notifying GuiRecipe that the recipe has changed (client side)
if( action == 0x05 ) {