Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.7.2] Netty Packet doesn't decode on server side


dark2222
 Share

Recommended Posts

i'm having a problem with the new netty system where i can send a packet in singleplayer without any problems but when i try on a local server (using ip: localhost) it seams that the client sends and encode the packet but it never run the decode or handleServerSide code's

the packet i'm trying to send

package com.dark2222.vampiremod.core.PacketHandler.packets;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IChatComponent;

import com.dark2222.vampiremod.core.VampireMain;
import com.dark2222.vampiremod.core.BloodCore.BloodCore;
import com.dark2222.vampiremod.core.BloodCore.TickHandler;
import com.dark2222.vampiremod.core.PacketHandler.AbstractPacket;

import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.common.network.ByteBufUtils;
public class FoodPack extends AbstractPacket{
int i;

public FoodPack() {}

public FoodPack(int i){
	this.i = i;
}

@Override
public void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
	buffer.writeInt(i);
}

@Override
public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer) {
	i = buffer.readInt();
}

@Override
public void handleClientSide(EntityPlayer player) {
		System.out.print("Running Client ");
		BloodCore props = BloodCore.get(player);

}

@Override
public void handleServerSide(EntityPlayer player) 
{	
		System.out.print("Running server ");
		BloodCore props = BloodCore.get(player);
}

}

my packetpipeline class is just "copy-paste" from the tutorial as is the abstractPacket class

 

i register the packages in the packetpipeline

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.