2014-02-09 02:34:52 +01:00
|
|
|
package appeng.core.sync.network;
|
|
|
|
|
|
|
|
import io.netty.buffer.ByteBuf;
|
2013-12-27 23:59:59 +01:00
|
|
|
|
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
|
|
2014-01-05 09:39:48 +01:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2014-02-07 21:37:22 +01:00
|
|
|
import appeng.core.AELog;
|
2014-02-09 02:34:52 +01:00
|
|
|
import appeng.core.sync.AppEngPacket;
|
|
|
|
import appeng.core.sync.AppEngPacketHandlerBase;
|
|
|
|
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
2013-12-27 23:59:59 +01:00
|
|
|
|
|
|
|
public final class AppEngServerPacketHandler extends AppEngPacketHandlerBase implements IPacketHandler
|
|
|
|
{
|
|
|
|
|
|
|
|
@Override
|
2014-02-09 02:34:52 +01:00
|
|
|
public void onPacketData(INetworkInfo manager, FMLProxyPacket packet, EntityPlayer player)
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
2014-02-09 02:34:52 +01:00
|
|
|
ByteBuf stream = packet.payload();
|
2013-12-27 23:59:59 +01:00
|
|
|
int packetType = -1;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
packetType = stream.readInt();
|
|
|
|
AppEngPacket pack = PacketTypes.getPacket( packetType ).parsePacket( stream );
|
2014-01-05 09:39:48 +01:00
|
|
|
pack.serverPacketData( manager, pack, (EntityPlayer) player );
|
|
|
|
}
|
|
|
|
catch (InstantiationException e)
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
2014-02-07 21:37:22 +01:00
|
|
|
AELog.error( e );
|
2014-01-05 09:39:48 +01:00
|
|
|
}
|
|
|
|
catch (IllegalAccessException e)
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
2014-02-07 21:37:22 +01:00
|
|
|
AELog.error( e );
|
2014-01-05 09:39:48 +01:00
|
|
|
}
|
|
|
|
catch (IllegalArgumentException e)
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
2014-02-07 21:37:22 +01:00
|
|
|
AELog.error( e );
|
2014-01-05 09:39:48 +01:00
|
|
|
}
|
|
|
|
catch (InvocationTargetException e)
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
2014-02-07 21:37:22 +01:00
|
|
|
AELog.error( e );
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|