Jump to content

1.5.2 Packet Handler problem?


Reika
 Share

Recommended Posts

When others try to run my mod in 1.5.2 (which I am told should be possible for most 1.5.1 mods), they crash with this error:

 

 

2013-05-23 17:17:23 [iNFO] [sTDERR] Exception in thread "Minecraft main thread" java.lang.VerifyError: (class: Reika/RotaryCraft/PacketHandler, method: handleData signature: (Lnet/minecraft/network/packet/Packet250CustomPayload;)V) Incompatible object argument for function call

2013-05-23 17:17:23 [iNFO] [sTDERR] at java.lang.Class.getDeclaredConstructors0(Native Method)

2013-05-23 17:17:23 [iNFO] [sTDERR] at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)

2013-05-23 17:17:23 [iNFO] [sTDERR] at java.lang.Class.getConstructor0(Unknown Source)

2013-05-23 17:17:23 [iNFO] [sTDERR] at java.lang.Class.newInstance0(Unknown Source)

2013-05-23 17:17:23 [iNFO] [sTDERR] at java.lang.Class.newInstance(Unknown Source)

2013-05-23 17:17:23 [iNFO] [sTDERR] at cpw.mods.fml.common.network.NetworkModHandler.tryCreatingPacketHandler(NetworkModHandler.java:192)

2013-05-23 17:17:23 [iNFO] [sTDERR] at cpw.mods.fml.common.network.NetworkModHandler.configureNetworkMod(NetworkModHandler.java:130)

2013-05-23 17:17:23 [iNFO] [sTDERR] at cpw.mods.fml.common.network.NetworkModHandler.<init>(NetworkModHandler.java:99)

2013-05-23 17:17:23 [iNFO] [sTDERR] at cpw.mods.fml.common.network.FMLNetworkHandler.registerNetworkMod(FMLNetworkHandler.java:262)

2013-05-23 17:17:23 [iNFO] [sTDERR] at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:465)

2013-05-23 17:17:23 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

2013-05-23 17:17:23 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

2013-05-23 17:17:23 [iNFO] [sTDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

2013-05-23 17:17:23 [iNFO] [sTDERR] at java.lang.reflect.Method.invoke(Unknown Source)

2013-05-23 17:17:23 [iNFO] [sTDERR] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

2013-05-23 17:17:23 [iNFO] [sTDERR] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

2013-05-23 17:17:23 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)

2013-05-23 17:17:23 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

2013-05-23 17:17:23 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.post(EventBus.java:267)

2013-05-23 17:17:23 [iNFO] [sTDERR] at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:165)

2013-05-23 17:17:23 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

2013-05-23 17:17:23 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

2013-05-23 17:17:23 [iNFO] [sTDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

2013-05-23 17:17:23 [iNFO] [sTDERR] at java.lang.reflect.Method.invoke(Unknown Source)

2013-05-23 17:17:23 [iNFO] [sTDERR] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

2013-05-23 17:17:23 [iNFO] [sTDERR] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

2013-05-23 17:17:23 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)

2013-05-23 17:17:23 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

2013-05-23 17:17:23 [iNFO] [sTDERR] at com.google.common.eventbus.EventBus.post(EventBus.java:267)

2013-05-23 17:17:23 [iNFO] [sTDERR] at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:98)

2013-05-23 17:17:23 [iNFO] [sTDERR] at cpw.mods.fml.common.Loader.loadMods(Loader.java:503)

2013-05-23 17:17:23 [iNFO] [sTDERR] at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:160)

2013-05-23 17:17:23 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:411)

2013-05-23 17:17:23 [iNFO] [sTDERR] at net.minecraft.client.MinecraftAppletImpl.func_71384_a(SourceFile:56)

2013-05-23 17:17:23 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.run(Minecraft.java:733)

2013-05-23 17:17:23 [iNFO] [sTDERR] at java.lang.Thread.run(Unknown Source)

 

 

 

The opening lines imply I need a totally different Packet usage system. Has there been some fundamental change to the packet system in 1.5.2, such that old handlers are useless?

 

(Part of) my code:

@Override
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) {
	ep = (EntityPlayer) player;

	if (packet.channel.equals("RotaryCraftData")) {
		this.handleData(packet);
	}
}

private void handleData(Packet250CustomPayload packet) {
	DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data));
	int control;
	boolean drops;
	int len;
	int[] data;
	long longdata = 0;
	int x,y,z;
	boolean readinglong = false;
	//System.out.print(packet.length);
	try {
		control = inputStream.readInt();
		pack = EnumPackets.getEnum(control);
		len = pack.getNumberDataInts();
		data = new int[len];
		readinglong = pack.isLongPacket();
		if (!readinglong) {
			for (int i = 0; i < len; i++)
				data[i] = inputStream.readInt();
		}
		else
			longdata = inputStream.readLong();
		x = inputStream.readInt();
		y = inputStream.readInt();
		z = inputStream.readInt();
	} catch (IOException e) {
		e.printStackTrace();
		return;
	}

	World world = ModLoader.getMinecraftInstance().theWorld;
	Minecraft m = Minecraft.getMinecraft();
	WorldServer ws = m.getIntegratedServer().worldServerForDimension(m.thePlayer.dimension);
	switch (pack) {
                [Cases and actions]
                }
}

 

@Mod( modid = "RotaryCraft", name="RotaryCraft", version="beta")
@NetworkMod(clientSideRequired=true, serverSideRequired=false,
channels={"RotaryCraftData"}, packetHandler = PacketHandler.class)

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.