toss Posted August 26, 2014 Share Posted August 26, 2014 Hey guys, i just followed the tutorial based on Packet handling with netty, but i'm having a problem. I copy / pasted PacketPipeline / AbstactPacket (and modified it properly i guess) So i created a Packet to send an int to the player when it joins the game: package fr.toss.network.packet; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import net.minecraft.entity.player.EntityPlayer; public class PacketLogIn extends AbstractPacket { public int id; public PacketLogIn(int p_id) { this.id = p_id; } @Override public void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer) { buffer.writeInt(this.id); } @Override public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer) { this.id = buffer.readInt(); } @Override public void handleClientSide(EntityPlayer player) { System.out.println("Client"); } @Override public void handleServerSide(EntityPlayer player) { System.out.println("Server"); } } + The join event: @SubscribeEvent public void onPlayerLog(PlayerEvent.PlayerLoggedInEvent event) { System.out.println("PLAYER LOG"); Main.packetPipeline.sendToServer(new PacketLogIn(1)); } Main class: @EventHandler public void initialise(FMLPostInitializationEvent evt) { packetPipeline.initialise(); } @EventHandler public void postInitialise(FMLPostInitializationEvent evt) { packetPipeline.postInitialise(); packetPipeline.registerPacket(PacketLogIn.class); } So when a player join the game, the only message appearing in the console is: "PLAYER LOG" Which mean nor handleClientSide() or handleServerSide() is called... Thanks you Quote Link to comment Share on other sites More sharing options...
toss Posted August 26, 2014 Author Share Posted August 26, 2014 Yes i want to send a server int value to the client when it joins the game Sorry I just see this tutorial... i typed "minecraft forge packet handling" on Google and didn't use brain Thx for your answer Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.