Applied-Energistics-2-tiler.../core/sync/network/AppEngServerPacketHandler.java

47 lines
1.1 KiB
Java
Raw Normal View History

2014-02-09 02:34:52 +01:00
package appeng.core.sync.network;
import io.netty.buffer.ByteBuf;
import java.lang.reflect.InvocationTargetException;
import net.minecraft.entity.player.EntityPlayer;
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;
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)
{
2014-02-09 02:34:52 +01:00
ByteBuf stream = packet.payload();
int packetType = -1;
try
{
packetType = stream.readInt();
AppEngPacket pack = PacketTypes.getPacket( packetType ).parsePacket( stream );
pack.serverPacketData( manager, pack, (EntityPlayer) player );
}
catch (InstantiationException e)
{
AELog.error( e );
}
catch (IllegalAccessException e)
{
AELog.error( e );
}
catch (IllegalArgumentException e)
{
AELog.error( e );
}
catch (InvocationTargetException e)
{
AELog.error( e );
}
}
}