ReplayMod / ReplayStudio

Library for handling Minecraft Replay Files (.mcpr files)
GNU Lesser General Public License v3.0
44 stars 14 forks source link

Use Mincraft protocol version instead of file format version #9

Closed Gerrygames closed 4 years ago

Gerrygames commented 5 years ago

Using the Minecraft protocol version to identify which version a replay was recorded in, would be way more definite than using a "random" file format version. Why is the file format version random? The Replay Mod isn't the only software using the mcpr file format. So it's possible that some different software is recording replays in versions which the Replay Mod doesn't exist for (yet). For example my replay recording software for Spigot servers supports all versions from 1.8-1.13.2. The file format version I am writing to the mcpr files recorded in 1.13.x is just a guess. 1.13 uses the file format version 10, 1.13.1 uses 11 and 1.13.2 uses 12. But the Replay Mod will (most likely) not be released for 1.13 nor 1.13.1 and the file format version used in the Replay Mod 1.13.2 will (most likely) be 10. I think you get why this is random/not definite. Using the Minecraft protocol version on the other hand would be definite and much easier to handle. I am using the Minecraft protocol version in my replay recorder and server/player. The field in the json data is an int named protocol. It would be nice if this could be named the same way if this request would be accepted. Reading replay files with the old specification wouldn't be an issue, just use the old file format version if the protocol field isn't present. I don't know how much would have to be changed for this, but I think this would improve the file format.

Johni0702 commented 5 years ago

IIRC initially the file format version was intended to mark hard breaks in compatibility between the way the replay was encoded (e.g. in version 0 the recording player entity gets lots of special treatment during replay whereas in version 1 that has been changed to already happen during recording). Since a different protocol version was a hard break in compatibility as well (at least before support for ViaVersion was added), I just went with the easiest solution and incremented the file format version on every protocol version change.

I do agree that storing the protocol version itself would have been the sane solution and I'm totally in favor of changing the current scheme. Here's the plan:

Would this work for you?

Gerrygames commented 5 years ago

I think the protocol key should be prioritized over the file format version. If the protocol key is given it should always be correct. So in case I messed something up with the file format version in one Minecraft version, the RM should still be able to handle it. Otherwise everything sounds perfect to me. Thank you very much for accepting my suggestion :)