b57804be06
Added Logging Option. Logging of Exceptions is now done via AELogger
53 lines
1.3 KiB
Java
53 lines
1.3 KiB
Java
package appeng.core.sync;
|
|
|
|
import java.io.ByteArrayInputStream;
|
|
import java.io.DataInputStream;
|
|
import java.io.IOException;
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
import net.minecraft.network.INetworkManager;
|
|
import net.minecraft.network.packet.Packet250CustomPayload;
|
|
import appeng.core.AELog;
|
|
import cpw.mods.fml.common.network.IPacketHandler;
|
|
import cpw.mods.fml.common.network.Player;
|
|
|
|
public final class AppEngServerPacketHandler extends AppEngPacketHandlerBase implements IPacketHandler
|
|
{
|
|
|
|
@Override
|
|
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player)
|
|
{
|
|
DataInputStream stream = new DataInputStream( new ByteArrayInputStream( packet.data ) );
|
|
// Determine packet type and coordinates of affected tile entity
|
|
int packetType = -1;
|
|
|
|
try
|
|
{
|
|
packetType = stream.readInt();
|
|
AppEngPacket pack = PacketTypes.getPacket( packetType ).parsePacket( stream );
|
|
pack.serverPacketData( manager, pack, (EntityPlayer) player );
|
|
}
|
|
catch (IOException e)
|
|
{
|
|
AELog.error( e );
|
|
}
|
|
catch (InstantiationException e)
|
|
{
|
|
AELog.error( e );
|
|
}
|
|
catch (IllegalAccessException e)
|
|
{
|
|
AELog.error( e );
|
|
}
|
|
catch (IllegalArgumentException e)
|
|
{
|
|
AELog.error( e );
|
|
}
|
|
catch (InvocationTargetException e)
|
|
{
|
|
AELog.error( e );
|
|
}
|
|
|
|
}
|
|
}
|