Jump to content

Recommended Posts

Posted

Hello!
I'm trying to set up a GUI with buttons, and to communicate button changes, I'm using a SimpleChannel. This works flawlessly on client, however, on server, I experience a crash on the server related to missing classes. I assume this is due to referencing a class only present in Client, however I do not know where I do this.

 

Class for handling packets.

https://github.com/HaydenBelanger/assembly_line_machines/blob/development/src/main/java/me/haydenb/assemblylinemachines/packets/HashPacketImpl.java

 

Method for sending the packet to the channel.
https://github.com/HaydenBelanger/assembly_line_machines/blob/development/src/main/java/me/haydenb/assemblylinemachines/block/energy/BlockBasicBatteryCell.java#L327-L341

 

Registering the channels.
https://github.com/HaydenBelanger/assembly_line_machines/blob/development/src/main/java/me/haydenb/assemblylinemachines/registry/Registry.java#L290-L294

 

java.lang.NoSuchMethodError: net.minecraft.network.PacketBuffer.readString()Ljava/lang/String;
	at me.haydenb.assemblylinemachines.packets.HashPacketImpl$DecoderConsumer.apply(HashPacketImpl.java:83) ~[main/:?] {re:classloading}
	at me.haydenb.assemblylinemachines.packets.HashPacketImpl$DecoderConsumer.apply(HashPacketImpl.java:1) ~[main/:?] {re:classloading}
	at net.minecraftforge.fml.network.simple.IndexedMessageCodec.lambda$tryDecode$0(IndexedMessageCodec.java:116) ~[forge-1.15.2-31.1.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading}
	at java.util.Optional.map(Optional.java:215) ~[?:1.8.0_181] {}
	at net.minecraftforge.fml.network.simple.IndexedMessageCodec.tryDecode(IndexedMessageCodec.java:116) ~[forge-1.15.2-31.1.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading}
	at net.minecraftforge.fml.network.simple.IndexedMessageCodec.consume(IndexedMessageCodec.java:157) ~[forge-1.15.2-31.1.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading}
	at net.minecraftforge.fml.network.simple.SimpleChannel.networkEventListener(SimpleChannel.java:79) ~[forge-1.15.2-31.1.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading}
	at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:212) ~[eventbus-2.0.0-milestone.1-service.jar:?] {}
	at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:204) ~[eventbus-2.0.0-milestone.1-service.jar:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258) ~[eventbus-2.0.0-milestone.1-service.jar:?] {}
	at net.minecraftforge.fml.network.NetworkInstance.dispatch(NetworkInstance.java:84) ~[?:?] {re:classloading}
	at net.minecraftforge.fml.network.NetworkHooks.lambda$onCustomPayload$0(NetworkHooks.java:74) ~[?:?] {re:classloading}
	at java.util.Optional.map(Optional.java:215) ~[?:1.8.0_181] {}
	at net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(NetworkHooks.java:74) ~[?:?] {re:classloading}
	at net.minecraft.network.play.ServerPlayNetHandler.processCustomPayload(ServerPlayNetHandler.java:1366) ~[?:?] {re:classloading}
	at net.minecraft.network.play.client.CCustomPayloadPacket.processPacket(CCustomPayloadPacket.java:51) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.network.play.client.CCustomPayloadPacket.processPacket(CCustomPayloadPacket.java:12) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.network.PacketThreadUtil.lambda$checkThreadAndEnqueue$0(PacketThreadUtil.java:19) ~[?:?] {re:classloading}
	at net.minecraft.util.concurrent.TickDelayedTask.run(TickDelayedTask.java:20) ~[?:?] {re:classloading}
	at net.minecraft.util.concurrent.ThreadTaskExecutor.run(ThreadTaskExecutor.java:140) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.util.concurrent.RecursiveEventLoop.run(RecursiveEventLoop.java:22) ~[?:?] {re:classloading}
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:757) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:141) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.util.concurrent.ThreadTaskExecutor.driveOne(ThreadTaskExecutor.java:110) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.server.MinecraftServer.driveOneInternal(MinecraftServer.java:740) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.server.MinecraftServer.driveOne(MinecraftServer.java:734) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.util.concurrent.ThreadTaskExecutor.driveUntil(ThreadTaskExecutor.java:123) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.server.MinecraftServer.runScheduledTasks(MinecraftServer.java:720) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:664) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}

I would love a point in the right direction as I don't see what could be the problem with this.

...

Posted
3 minutes ago, poopoodice said:

 is client only method marked as @OnlyIn(Dist.CLIENT). use

readString(int maxLength)


readString(int maxLength)

instead

So is maxLength the length of the String being packet-ified?

...

Posted
1 minute ago, Haydenman2 said:

So is maxLength the length of the String being packet-ified?

It says maxLength means the string read from the packet can not be longer than it, readString() passed in 32767.

   /**
    * Reads a string from this buffer. Expected parameter is maximum allowed string length. Will throw IOException if
    * string length exceeds this value!
    */

Quote from the comment 

  • Like 1
Posted
1 minute ago, poopoodice said:

It says maxLength means the string read from the packet can not be longer than it, readString() passed in 32767.


   /**
    * Reads a string from this buffer. Expected parameter is maximum allowed string length. Will throw IOException if
    * string length exceeds this value!
    */

Quote from the comment 

Considering readString() legitimately passes to readString(32767), that is a very... peculiar sided restriction. Thank you very much for helping me figure it out!

...

Posted
On 6/7/2020 at 3:15 AM, diesieben07 said:

It's not peculiar if you understand how the dist-only methods come to be. They are most likely optimized away by Mojang's obfuscator (or some other step in their build process), not removed by hand.

If a method is not used on the server, it is not included.

That makes a lot of sense, actually.

...

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.