Starchasers / OCGlasses

mod for minecraft and addon for Open Computers
zlib License
31 stars 17 forks source link

java.lang.IllegalArgumentException: Payload may not be larger than 32767 bytes #92

Open Azim opened 4 years ago

Azim commented 4 years ago

Describe the bug World crash. Moving here from https://github.com/MightyPirates/OpenComputers/issues/3261

In which environment did the Bug appear? Singleplayer

To Reproduce Steps to reproduce the behavior:

  1. Get the app on your laptop with geolyzer installed https://pastebin.com/GXHN4JvS
  2. Run the app deep in cave (modded mc - a lot of diff. ores)
  3. Dont forget to make sure glasses are linked
  4. See error

Expected behavior World not corrupting, instead throw an error or something

Screenshots / Code Snippet If applicable, add the code you used and screenshots of how your setup looks like https://pastebin.com/GXHN4JvS

Minecraft:

ben-mkiv commented 4 years ago

thanks for reporting it, i'll look into that later.

But i can fix your world if you send me your player file (it's located in your minecraft directory at saves/YOUR_WORLDS_NAME/playerdata/YOUR_PLAYER_SSID.dat)

you can also reach me on the discord channel https://discord.gg/gSGSJF or add me Ben#6650

Azim commented 4 years ago

Thanks, i've already fixed my save at the moment of making that bug report :D

I can send you the world backup + mods if you want more specific environment though

ben-mkiv commented 4 years ago

actually, more or less for my own information if i ever get to this again, the problem is that Widgets are stored within the NBT data of the Tablet which gets synced by OpenComputers to the Client, and for some reason the Client sends back all the data to the server which causes the error..

tldr: dont use too many OpenGlasses widgets on OC tablets for now

brisingraerowing commented 3 years ago

As a workaround, you can install Random Patches, which increases the packet size limit.

agausmann commented 3 years ago

Here's a potential solution: Store and maintain the widget data separately (e.g. the way that OpenComputers stores disk/memory state, which is in their own files in a subdirectory of the world save), and send updates to clients' widget data using simple channels. I can take a stab at implementing this, if you are interested.

ben-mkiv commented 3 years ago

so i wrote a two page essay on this and then closed my browser by accident sigh

the updates already use simple network channels, it's just the widget list on the host component which causes the issue

https://github.com/Starchasers/OCGlasses/blob/OG2-MC1.12.2/src/main/java/com/bymarcin/openglasses/component/WidgetList.java writeToNBT/readFromNBT have to be changed to save/load from disk

filename should include UUID of the host component, which could be passed as argument to the writeToNBT/readFromNBT methods

and the calls of writeToNBT/readFromNBT have to be changed to not alter the hosts NBT in https://github.com/Starchasers/OCGlasses/blob/OG2-MC1.12.2/src/main/java/com/bymarcin/openglasses/component/OpenGlassesHostComponent.java

That should do the job, if you want you can make an PR, otherwise i might do it within the next days.

Only thing left to figure out is how item deletion gets handled by trash can mods and such, as this would invalidate the UUID and the storage file could be removed, (same for the newUniqueKey() lua-method which can be called by the player)