{
try
{
EntityPlayer entityPlayer = (EntityPlayer) player;
ByteArrayDataInput in = ByteStreams.newDataInput(packet.data);
int packetId = in.readUnsignedByte(); // Assuming your packetId is between 0 (inclusive) and 256 (exclusive). If you need more you need to change this
AbstractPacket ecPacket = AbstractPacket.constructPacket(packetId);
ecPacket.read(in);
ecPacket.execute(entityPlayer, entityPlayer.worldObj.isRemote ? Side.CLIENT : Side.SERVER);
} catch (ProtocolException e)
{