52 lines
1.3 KiB
Java
52 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 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)
|
|
{
|
|
e.printStackTrace();
|
|
}
|
|
catch (InstantiationException e)
|
|
{
|
|
e.printStackTrace();
|
|
}
|
|
catch (IllegalAccessException e)
|
|
{
|
|
e.printStackTrace();
|
|
}
|
|
catch (IllegalArgumentException e)
|
|
{
|
|
e.printStackTrace();
|
|
}
|
|
catch (InvocationTargetException e)
|
|
{
|
|
e.printStackTrace();
|
|
}
|
|
|
|
}
|
|
}
|