Skip to content

Instantly share code, notes, and snippets.

@WillR27
Created July 4, 2014 21:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WillR27/92517b2ffd3ec80f421a to your computer and use it in GitHub Desktop.
Save WillR27/92517b2ffd3ec80f421a to your computer and use it in GitHub Desktop.
package com.blocklings.network;
import java.io.IOException;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.NetHandlerPlayServer;
import com.blocklings.main.Blocklings;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent;
public class ServerPacketHandler {
protected String channelName;
protected EntityPlayerMP thePlayer;
@SubscribeEvent
public void onServerPacket(ServerCustomPacketEvent event) throws IOException {
channelName = event.packet.channel();
NetHandlerPlayServer theNetHandlerPlayServer = (NetHandlerPlayServer) event.handler;
thePlayer = theNetHandlerPlayServer.playerEntity;
if (channelName.equals(Blocklings.networkChannelName)) {
ProcessPacketServerSide.processPacketOnServer(event.packet.payload(),event.packet.getTarget(), thePlayer);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment