@Override
public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player)
{
if ( player.openContainer instanceof ContainerCraftAmount )
{
ContainerCraftAmount cca = (ContainerCraftAmount) player.openContainer;
Object target = cca.getTarget();
if ( target instanceof IGridHost )
{
IGridHost gh = (IGridHost) target;
IGridNode gn = gh.getGridNode( ForgeDirection.UNKNOWN );
if ( gn == null )
return;
IGrid g = gn.getGrid();
if ( g == null || cca.whatToMake == null )
return;
Future<ICraftingJob> futureJob = null;
cca.whatToMake.setStackSize( amount );
try
{
ICraftingGrid cg = g.getCache( ICraftingGrid.class );
futureJob = cg.beginCraftingJob( cca.getWorld(), cca.getGrid(), cca.getActionSrc(), cca.whatToMake, null );
ContainerOpenContext context = cca.openContext;
if ( context != null )
{
TileEntity te = context.getTile();
Platform.openGUI( player, te, cca.openContext.side, GuiBridge.GUI_CRAFTING_CONFIRM );
if ( player.openContainer instanceof ContainerCraftConfirm )
{
ContainerCraftConfirm ccc = (ContainerCraftConfirm) player.openContainer;
ccc.autoStart = heldShift;
ccc.job = futureJob;
cca.detectAndSendChanges();
}
}
}
catch (Throwable e)