Jump to content

[1.7.10] [SOLVED] Packets: Undefined message for descriminator 1 in channel


Recommended Posts

Posted

Hello all! Sorry to bother you again so soon, but I've spent quite a while going through the debugger and I'm about out of ideas. I'm still trying to get a feel for how packets are done in 1.7, and one of them is giving me an issue. Whenever I try to log in to a world, the game crashes due to a null pointer, saying "Undefined message for descriminator 1 in propsChannel", which is the channel I use to sync my extended player properties. I believe it is in the packet class itself, because that was the last thing I canged before I got the issue. However the crash report cuts out before pointing me to a line of my code, so it's possible that when I fixed something in my packet class it allowed for a new error elsewhere.

 

Thank you guys in advance. You are always incredibly helpful!

 

Here is my packet class.

 

public class propsPacket implements IMessage

{

 

public int id1,id2,id3,id4,maxMana, currentMana;

public boolean isMage, isHoly, isUnholy, iceTouch;

mageSpellList m= new mageSpellList();

unholySpellList n= new unholySpellList();

holySpellList p=new holySpellList();

 

public int[] mageIDs =new int[m.listOfSpells.length];

public int[] necroIDs =new int[n.listOfSpells.length];

public int[] holyIDs =new int[p.listOfSpells.length];

 

public propsPacket() { }

 

    public propsPacket(int maxM, int curM, int idA,int idB, int idC, int idD, boolean mage, boolean nec, boolean pal, boolean ice, int[] mID, int[] nID, int[] hID) {

     

    //mana amount

    this.maxMana=maxM;

    this.currentMana=curM;

   

    //active spell id's

    this.id1=idA;

        this.id2=idB;

        this.id3=idC;

        this.id4=idD;

       

       

        //class booleans

        this.isMage=mage;

        this.isUnholy=nec;

        this.isHoly=pal;

       

        //spell booleans

        this.iceTouch=ice;

       

        //spell id's

        this.mageIDs=mID;

        this.necroIDs=nID;

        this.holyIDs=hID;

       

       

    }

 

@Override

public void toBytes(ByteBuf buf) {

buf.writeInt(this.maxMana);

buf.writeInt(this.currentMana);

buf.writeInt(id1);

buf.writeInt(id2);

buf.writeInt(id3);

buf.writeInt(id4);

buf.writeBoolean(this.isMage);

buf.writeBoolean(this.isUnholy);

buf.writeBoolean(this.isHoly);

buf.writeBoolean(this.iceTouch);

 

for(int i=0; i<m.listOfSpells.length; i++)

{

buf.writeInt(this.mageIDs);

}

for(int i=0; i<n.listOfSpells.length; i++)

{

buf.writeInt(this.necroIDs);

}

for(int i=0; i<p.listOfSpells.length; i++)

{

buf.writeInt(this.holyIDs);

}

}

 

@Override

public void fromBytes(ByteBuf buf) {

this.maxMana=buf.readInt();

this.currentMana=buf.readInt();

this.id1=buf.readInt();

        this.id2=buf.readInt();

        this.id3=buf.readInt();

        this.id4=buf.readInt();

        //booleans

        this.isMage=buf.readBoolean();

        this.isUnholy=buf.readBoolean();

        this.isHoly=buf.readBoolean();

        this.iceTouch=buf.readBoolean();

        //arrays

        for(int i=0; i<m.listOfSpells.length; i++)

{

        this.mageIDs=buf.readInt();

}

for(int i=0; i<n.listOfSpells.length; i++)

{

this.necroIDs=buf.readInt();

}

for(int i=0; i<p.listOfSpells.length; i++)

{

this.holyIDs=buf.readInt();

}

       

 

}

 

}

 

 

handler:

 

public class propsPacketHandler implements IMessageHandler <propsPacket, IMessage>

{

@Override

public IMessage onMessage(propsPacket message, MessageContext ctx) {

handleExtendedProperties(message, ctx);

return null;

}

 

private void handleExtendedProperties(propsPacket message, MessageContext ctx)

{

 

EntityPlayer player=BaseClass.proxy.getPlayerEntity(ctx);

magicPlayer props = magicPlayer.get((EntityPlayer) player);

 

int idNum;

 

 

 

 

//sync mana

props.setMaxMana(message.maxMana);

props.setCurrentMana(message.currentMana);

 

//sync spell List

boolean hasLearned=false;

 

for(int i=0; i<props.mageList.listOfSpells.length; i++)

{

idNum= message.mageIDs;

 

hasLearned= props.mageList.checkIfSpellKnown(idNum);

 

if(!hasLearned)

{

 

spell s= props.mageList.getSpellFromID(idNum);

props.mageList.addSpellToList(s);

 

}

 

}

 

for(int i=0; i<props.necroList.listOfSpells.length; i++)

{

idNum= message.necroIDs;

 

hasLearned= props.necroList.checkIfSpellKnown(idNum);

 

if(!hasLearned)

{

 

spell s= props.necroList.getSpellFromID(idNum);

props.necroList.addSpellToList(s);

 

}

 

}

 

for(int i=0; i<props.holyList.listOfSpells.length; i++)

{

idNum= message.holyIDs;

 

hasLearned= props.holyList.checkIfSpellKnown(idNum);

 

if(!hasLearned)

{

 

spell s= props.holyList.getSpellFromID(idNum);

props.holyList.addSpellToList(s);

 

}

 

}

 

//sync active IDs

props.setActiveSpellID(message.id1, 1);

props.setActiveSpellID(message.id2, 2);

props.setActiveSpellID(message.id3, 3);

props.setActiveSpellID(message.id4, 4);

 

//sync isMage

 

props.isMage= message.isMage;

props.isUnholy= message.isUnholy;

props.isHoly=message.isHoly;

 

props.necroList.iceTouch= message.iceTouch;

 

 

 

 

}

 

 

 

 

Registration:

 

 

     

propsChannel= NetworkRegistry.INSTANCE.newSimpleChannel("propsChannel");

  propsChannel.registerMessage(propsPacketHandler.class, propsPacket.class, 1, Side.SERVER);

 

 

 

Here is the crash report:

 

 

io.netty.handler.codec.DecoderException: java.lang.NullPointerException: Undefined message for discriminator 1 in channel propsChannel

at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:99) ~[MessageToMessageDecoder.class:?]

at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:?]

at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:?]

at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:?]

at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?]

at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:247) [NetworkManager.class:?]

at net.minecraft.client.Minecraft.runTick(Minecraft.java:2151) [Minecraft.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1038) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:961) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_45]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_45]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:85) [start/:?]

at GradleStart.main(GradleStart.java:45) [start/:?]

Caused by: java.lang.NullPointerException: Undefined message for discriminator 1 in channel propsChannel

at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:73) ~[FMLIndexedMessageToMessageCodec.class:?]

at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:17) ~[FMLIndexedMessageToMessageCodec.class:?]

at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:?]

at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[MessageToMessageDecoder.class:?]

... 19 more

[19:14:10] [Client thread/ERROR] [FML]: SimpleChannelHandlerWrapper exception

io.netty.handler.codec.DecoderException: java.lang.NullPointerException: Undefined message for discriminator 1 in channel propsChannel

at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:99) ~[MessageToMessageDecoder.class:?]

at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:?]

at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:?]

at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:?]

at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?]

at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:247) [NetworkManager.class:?]

at net.minecraft.client.Minecraft.runTick(Minecraft.java:2151) [Minecraft.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1038) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:961) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_45]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_45]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:85) [start/:?]

at GradleStart.main(GradleStart.java:45) [start/:?]

Caused by: java.lang.NullPointerException: Undefined message for discriminator 1 in channel propsChannel

at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:73) ~[FMLIndexedMessageToMessageCodec.class:?]

at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:17) ~[FMLIndexedMessageToMessageCodec.class:?]

at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:?]

at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[MessageToMessageDecoder.class:?]

... 19 more

[19:14:10] [Client thread/ERROR] [FML]: There was a critical exception handling a packet on channel propsChannel

io.netty.handler.codec.DecoderException: java.lang.NullPointerException: Undefined message for discriminator 1 in channel propsChannel

at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:99) ~[MessageToMessageDecoder.class:?]

at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:?]

at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) ~[DefaultChannelPipeline.class:?]

at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) ~[EmbeddedChannel.class:?]

at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?]

at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:247) [NetworkManager.class:?]

at net.minecraft.client.Minecraft.runTick(Minecraft.java:2151) [Minecraft.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1038) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:961) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_45]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_45]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:85) [start/:?]

at GradleStart.main(GradleStart.java:45) [start/:?]

Caused by: java.lang.NullPointerException: Undefined message for discriminator 1 in channel propsChannel

at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:73) ~[FMLIndexedMessageToMessageCodec.class:?]

at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:17) ~[FMLIndexedMessageToMessageCodec.class:?]

at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:?]

at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[MessageToMessageDecoder.class:?]

... 19 more

 

 

 

Thank you again,

-Athire

Posted

I didn't look much but:

propsChannel.registerMessage(propsPacketHandler.class, propsPacket.class, 1, SIDE THAT HANDLES PACKET);

 

Should client be handler here?

 

If not, lemme look deeper (your IMessage and Handler are cool, only flaw is your coding style - Class names should start Capital)

 

Other:

1. Where are you calling registration?

2. How are your sendind packet, from where? (side)

3. Put prints in each method - at which one it stops (not called)?

4. Are your loops working? You are using size().

 

^^ This might get you somewhere. I've never had this error, so might be missing something.

1.7.10 is no longer supported by forge, you are on your own.

Posted

That should have been client, I changed it to server when trying to figure out what was going on. Unfortunately that's not the cause of this problem, I suspect it's somewhere in the toBytes() of fromBytes() methods. Thanks for the input though

Posted

Please show the updated error message with the correct registration code, because as Ernio pointed out that error message was almost certainly caused by

        propsChannel.registerMessage(propsPacketHandler.class, propsPacket.class, 1, Side.SERVER);

 

Your toBytes() and fromBytes() won't cause this error unless you accidentally overwrite the header byte by using the wrong ByteBuf method, and the discriminator byte is correct, so that's very unlikely to be the problem.

 

-TGG

Posted

Here is the new crash report, but it doesn't seem to have changed.

 

 

 

io.netty.handler.codec.DecoderException: java.lang.NullPointerException: Undefined message for discriminator 1 in channel propsChannel

at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:99) ~[MessageToMessageDecoder.class:?]

at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:?]

at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:?]

at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:?]

at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?]

at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:247) [NetworkManager.class:?]

at net.minecraft.client.Minecraft.runTick(Minecraft.java:2151) [Minecraft.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1038) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:961) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_45]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_45]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:85) [start/:?]

at GradleStart.main(GradleStart.java:45) [start/:?]

Caused by: java.lang.NullPointerException: Undefined message for discriminator 1 in channel propsChannel

at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:73) ~[FMLIndexedMessageToMessageCodec.class:?]

at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:17) ~[FMLIndexedMessageToMessageCodec.class:?]

at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:?]

at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[MessageToMessageDecoder.class:?]

... 19 more

[11:12:55] [Client thread/ERROR] [FML]: SimpleChannelHandlerWrapper exception

io.netty.handler.codec.DecoderException: java.lang.NullPointerException: Undefined message for discriminator 1 in channel propsChannel

at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:99) ~[MessageToMessageDecoder.class:?]

at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:?]

at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:?]

at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) [EmbeddedChannel.class:?]

at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?]

at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:247) [NetworkManager.class:?]

at net.minecraft.client.Minecraft.runTick(Minecraft.java:2151) [Minecraft.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1038) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:961) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_45]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_45]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:85) [start/:?]

at GradleStart.main(GradleStart.java:45) [start/:?]

Caused by: java.lang.NullPointerException: Undefined message for discriminator 1 in channel propsChannel

at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:73) ~[FMLIndexedMessageToMessageCodec.class:?]

at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:17) ~[FMLIndexedMessageToMessageCodec.class:?]

at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:?]

at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[MessageToMessageDecoder.class:?]

... 19 more

[11:12:55] [Client thread/ERROR] [FML]: There was a critical exception handling a packet on channel propsChannel

io.netty.handler.codec.DecoderException: java.lang.NullPointerException: Undefined message for discriminator 1 in channel propsChannel

at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:99) ~[MessageToMessageDecoder.class:?]

at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:?]

at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) ~[DefaultChannelHandlerContext.class:?]

at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) ~[DefaultChannelPipeline.class:?]

at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) ~[EmbeddedChannel.class:?]

at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?]

at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:247) [NetworkManager.class:?]

at net.minecraft.client.Minecraft.runTick(Minecraft.java:2151) [Minecraft.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1038) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:961) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_45]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_45]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:85) [start/:?]

at GradleStart.main(GradleStart.java:45) [start/:?]

Caused by: java.lang.NullPointerException: Undefined message for discriminator 1 in channel propsChannel

at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:73) ~[FMLIndexedMessageToMessageCodec.class:?]

at cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:17) ~[FMLIndexedMessageToMessageCodec.class:?]

at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:?]

at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[MessageToMessageDecoder.class:?]

... 19 more

 

 

 

Here is the new registration code:

 

 

  propsChannel= NetworkRegistry.INSTANCE.newSimpleChannel("propsChannel");

  propsChannel.registerMessage(propsPacketHandler.class, propsPacket.class, 1, Side.CLIENT);

 

 

 

Thanks again for helping me out!

Posted

I have it in my PreInit() method, along with item and block registrations which I know are working. A thought just occured to me, I'm registering multiple channels there, maybe I did something wrong there? Here is the full registration for all of my channels:

 

 

 

  @EventHandler

      public void preInit(FMLPreInitializationEvent event)

  {

     

  //Adding to registry

 

  //Packets

  spellChannel = NetworkRegistry.INSTANCE.newSimpleChannel("spellChannel");

  spellChannel.registerMessage(spellPacketHandler.class, spellPacket.class, 0, Side.SERVER);

  propsChannel= NetworkRegistry.INSTANCE.newSimpleChannel("propsChannel");

  propsChannel.registerMessage(propsPacketHandler.class, propsPacket.class, 1, Side.CLIENT);

  mobVelChannel= NetworkRegistry.INSTANCE.newSimpleChannel("mobVelChannel");

  mobVelChannel.registerMessage(mobVelPacketHandler.class, mobVelPacket.class, 2, Side.SERVER);

  clientOnlyChannel= NetworkRegistry.INSTANCE.newSimpleChannel("clientOnlyChannel");

  clientOnlyChannel.registerMessage(mobVelPacketHandler.class, mobVelPacket.class, 3, Side.SERVER);

  clientProjChannel= NetworkRegistry.INSTANCE.newSimpleChannel("propsChannel");

  clientProjChannel.registerMessage(clientProjPacketHandler.class, clientProjPacket.class, 4, Side.CLIENT);

  useAbilityChannel= NetworkRegistry.INSTANCE.newSimpleChannel("useAbilityChannel");

  useAbilityChannel.registerMessage(useAbilityPacketHandler.class, useAbilityPacket.class, 5, Side.SERVER);

 

 

 

 

Posted

I didn't realize I could do it all in one. The tutorials I was reading made it sound like I would need to register a different channel for each packet. I guess I would need one channel for packets recieved by the server and one for those recieved by the client? Do you think that could be my issue?

Posted

Ah, I see. Should I try moving everything to one channel to see if that clears this up? I'm a bit worried if I do that before figuring this out I could introduce more bugs.

Posted

I finally had a bit of time to test this out, and moving everything to one channel did the trick! Thank you guys so much! I will mark this as solved!

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.