Jump to content

PacketHandler problems?


TLHPoE
 Share

Recommended Posts

I keep getting this error

 

 

 

2013-09-06 19:09:19 [iNFO] [sTDOUT] java.lang.RuntimeException: Channel name is invalid

2013-09-06 19:09:19 [iNFO] [sTDOUT] at cpw.mods.fml.common.network.NetworkRegistry.registerChannel(NetworkRegistry.java:104)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at cpw.mods.fml.common.network.NetworkRegistry.registerChannel(NetworkRegistry.java:114)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at cpw.mods.fml.common.network.NetworkModHandler.tryCreatingPacketHandler(NetworkModHandler.java:202)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at cpw.mods.fml.common.network.NetworkModHandler.configureNetworkMod(NetworkModHandler.java:130)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at cpw.mods.fml.common.network.NetworkModHandler.<init>(NetworkModHandler.java:99)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at cpw.mods.fml.common.network.FMLNetworkHandler.registerNetworkMod(FMLNetworkHandler.java:262)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:513)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at java.lang.reflect.Method.invoke(Unknown Source)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at com.google.common.eventbus.EventBus.post(EventBus.java:267)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:194)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:174)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at java.lang.reflect.Method.invoke(Unknown Source)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at com.google.common.eventbus.EventBus.post(EventBus.java:267)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:105)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at cpw.mods.fml.common.Loader.loadMods(Loader.java:510)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:182)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at net.minecraft.client.Minecraft.startGame(Minecraft.java:470)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:796)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at net.minecraft.client.main.Main.main(Main.java:93)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at java.lang.reflect.Method.invoke(Unknown Source)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at net.minecraft.launchwrapper.Launch.launch(Launch.java:57)

2013-09-06 19:09:19 [iNFO] [sTDOUT] at net.minecraft.launchwrapper.Launch.main(Launch.java:18)

 

 

 

 

 

 

My PacketHandler

 

 

 

package terramagna.handlers;

 

import java.io.ByteArrayInputStream;

import java.io.DataInputStream;

import java.io.IOException;

 

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.network.INetworkManager;

import net.minecraft.network.packet.Packet250CustomPayload;

import cpw.mods.fml.common.network.IPacketHandler;

import cpw.mods.fml.common.network.Player;

 

public class PacketHandlerC implements IPacketHandler

{

     

        public PacketHandlerC() {}

     

        @Override

        public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player)

        {

             

                packet.channel = "terramagnachannel";

             

                if(packet.channel.equals("terramagnachannel"))

                {

                     

                        handleExtendedProperties(packet, player);

                     

                }

             

        }

     

        private void handleExtendedProperties(Packet250CustomPayload packet, Player player)

        {

                DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data));

 

                PlayerStatsHandler props = ((PlayerStatsHandler)((EntityPlayer) player).getExtendedProperties(PlayerStatsHandler.EXT_PROP_NAME));

             

                try {

                        props.setGold(inputStream.readInt());

                        props.setBagSize(inputStream.readInt());

                } catch (IOException e) {

                        e.printStackTrace();

                        return;

                }

        }

     

}

 

 

 

My NetworkMod

 

@NetworkMod(clientSideRequired = true, serverSideRequired = false, channels = {"terramagnachannel"}, packetHandler = terramagna.handlers.PacketHandlerC.class)

Kain

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 Terms of Use.