fabric
fabric copied to clipboard
Add per-AttachmentType sync size limits & Allow modifying large payload max size
This PR changes the att sync payload to be splittable and allows mods to set sync size limits per AttachementType.
- 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.
- 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.
- The new default sync limit is 1 MiB, up from just 32502 bytes.
- 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
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.
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?