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/1bc97353f1f901987d00 to your computer and use it in GitHub Desktop.
Save WillR27/1bc97353f1f901987d00 to your computer and use it in GitHub Desktop.
package com.blocklings.network;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufInputStream;
import java.io.IOException;
import net.minecraft.entity.player.EntityPlayerMP;
import com.blocklings.main.Blocklings;
import cpw.mods.fml.relauncher.Side;
public class ProcessPacketServerSide {
public ProcessPacketServerSide() {
}
public static void processPacketOnServer(ByteBuf parBB, Side parSide, EntityPlayerMP parPlayer) throws IOException {
if (parSide == Side.SERVER)
{
System.out.println("Received Packet on Server Side from Player = " + parPlayer.getEntityId());
ByteBufInputStream bbis = new ByteBufInputStream(parBB);
int packetTypeID = bbis.readInt();
System.out.println("Packet type ID = " + packetTypeID);
switch (packetTypeID) {
case Blocklings.PACKET_TYPE_C2S_TEST: {
int testVal = bbis.readInt();
break;
}
}
bbis.close();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment