fabric icon indicating copy to clipboard operation
fabric copied to clipboard

Add per-AttachmentType sync size limits & Allow modifying large payload max size

Open DennisOchulor opened this issue 2 months ago • 2 comments

This PR changes the att sync payload to be splittable and allows mods to set sync size limits per AttachementType.

  1. The att sync payload max size is set to Integer.MAX_VALUE. This might be too high but I set it to that as a start.
  2. Initial syncs still manually split packets if needed, just in case multiple really large attachments go over the max payload size, however unlikely that is.
  3. The new default sync limit is 1 MiB, up from just 32502 bytes.
  4. The encoded attachement data is now truncated to the actual readable number of bytes, but unfortunately this requires copying the array, so I'm not really sure if this is the way to go.

Relates to #4669

DennisOchulor avatar Nov 11 '25 15:11 DennisOchulor

I assume number 3 would be something like PayloadTypeRegistry.modifyLargePayloadMaxSize(id,size)? Though depending on mod load order, mods registering large attachments may cause modifyLargePayloadMaxSize() to be called before the att sync packet is even registered.

DennisOchulor avatar Nov 12 '25 22:11 DennisOchulor

I've implemented @Earthcomputer's suggestions, the changes to the networking API are in a separate commit to help with reviewing. Though maybe a separate PR should be made?

DennisOchulor avatar Nov 13 '25 14:11 DennisOchulor