Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.10.2]Suggestions on how to rework this to reduce packet size


The_Fireplace
 Share

Recommended Posts

So, I send a packet that contains one NBTTagCompound containing a lot of data(Mostly inventories within a tile entity). Unfortunately, it seems to be too large, since I get the following crash upon sending.

http://paste.ubuntu.com/24062837/

My question to you is, how do you suggest I redesign the system to reduce the packet size?

My current way of doing things involves sending the packet to the client just before the GUI opens. This packet contains all of the entity's data, including inventory, which the client needs or else it will crash upon opening the GUI.

The creation of the NBT Tag Compound

The packet

 

If anyone knows of a way to reduce packet size or simply split this in to as many smaller packets as needed, it would be greatly appreciated.

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Link to comment
Share on other sites

I would suggest looking at the code for writing a NBTTagCompound to a ByteBuf and find the limitation or you could just send multiple packets for each inventory.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

This exception is caused by a client-to-server message (which Forge limits to a single CPacketCustomPayload, i.e. 32,767 bytes), not a server-to-client message.(which Forge splits into a a maximum of 255 SPacketCustomPayloads, i.e. 267,366,480 bytes).

 

Do you need to send all of that data to the server at once? Can you send individual parts that have changed, possibly through the Container?

 

You shouldn't be storing mutable game data in a field of your @Mod class (Caterpillar#mainContainers), since it's shared between logical sides in single player. You should be using World Capabilities or World Saved Data (if storing the data directly in the TileEntity isn't an option).

 

Iterating through a server's World's to find a block at a specific position is very unreliable, what happens when two dimensions have a drill at the same position?

Edited by Choonster

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

10 hours ago, Choonster said:

This exception is caused by a client-to-server message (which Forge limits to a single CPacketCustomPayload, i.e. 32,767 bytes), not a server-to-client message.(which Forge splits into a a maximum of 255 SPacketCustomPayloads, i.e. 267,366,480 bytes).

 

Do you need to send all of that data to the server at once? Can you send individual parts that have changed, possibly through the Container?

 

You shouldn't be storing mutable game data in a field of your @Mod class (Caterpillar#mainContainers), since it's shared between logical sides in single player. You should be using World Capabilities or World Saved Data (if storing the data directly in the TileEntity isn't an option).

 

Iterating through a server's World's to find a block at a specific position is very unreliable, what happens when two dimensions have a drill at the same position?

Ah, I see. Thanks for the explanation, it should be somewhat easy to fix now, since the client shouldn't have any reason in this mod to need to send that much data to the server.

 

Thanks for the suggestions, I will work on them today. You've pointed out several problems and ways to fix them that I wouldn't have caught. As for the why of all of that bad design, that was the original author's doing, and I have been working on fixing it for a while now.

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

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



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Really old Minecraft versions are no longer supported on this forum. Please update to a modern version of Minecraft to receive support.
    • Forge's custom networking is built on the custom payload packet. You can either use a SimpleChannel (which uses a byte-indexed codec, so you have to handle that on the bukkit side, too) or you can use an EventChannel, which just gives you access to the raw payload packet data. There isn't anything special you need to do to make the two talk to each other. It just works, because both use the same network packet.
    • [16:08:43] [main/ERROR] [LaunchWrapper]: Unable to launch java.lang.reflect.InvocationTargetException: null at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_292] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_292] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_292] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_292] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_292] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_292] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_292] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_292] at net.minecraftforge.fml.relauncher.ServerLaunchWrapper.run(ServerLaunchWrapper.java:70) [forge.jar:?] at net.minecraftforge.fml.relauncher.ServerLaunchWrapper.main(ServerLaunchWrapper.java:34) [forge.jar:?] Caused by: java.lang.VerifyError: Operand stack overflow Exception Details: Location: net/minecraft/entity/EntityLivingBase.func_70088_a()V @7: aload_0 Reason: Exceeded max stack size. Current Frame: bci: @7 flags: { } locals: { 'net/minecraft/entity/EntityLivingBase' } stack: { 'net/minecraftforge/fml/common/eventhandler/EventBus', uninitialized 3, uninitialized 3 } Bytecode: 0x0000000: b201 09bb 010b 592a b701 0cb6 0112 572a 0x0000010: b401 16b2 0118 03b8 011e b601 242a b401 0x0000020: 16b2 0126 03b8 012b b601 242a b401 16b2 0x0000030: 012d 03b8 0132 b601 242a b401 16b2 0134 0x0000040: 03b8 012b b601 242a b401 16b2 0136 0cb8 0x0000050: 013b b601 24b1 at java.lang.Class.getDeclaredConstructors0(Native Method) ~[?:1.8.0_292] at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671) ~[?:1.8.0_292] at java.lang.Class.getConstructor0(Class.java:3075) ~[?:1.8.0_292] at java.lang.Class.getConstructor(Class.java:1825) ~[?:1.8.0_292] at net.minecraft.entity.EntityList.func_191303_a(EntityList.java:410) ~[vi.class:?] at net.minecraft.entity.EntityList.func_151514_a(EntityList.java:280) ~[vi.class:?] at net.minecraft.init.Bootstrap.func_151354_b(Bootstrap.java:505) ~[ni.class:?] at net.minecraft.server.MinecraftServer.main(MinecraftServer.java:1470) ~[MinecraftServer.class:?] ... 12 more
    • 1.7 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.