In Minecraft: Java Edition, the region file format uses a 32-bit big-endian integer to store the timestamp data as UNIX® epoch seconds in the 8KiB file header in both Minecraft Region, and Minecraft Anvil file formats.
After January 19th, 2038 at 03:14:07 UTC, this integer will likely overflow into 0xFFFFFFFF, causing the number to go to the negative 32-bit signed integer limit of -2³¹.
This will either lead to crashes, unpredictable behaviour and alike.
Furthermore, this issue might be present in other parts of the codebase.
The proposed fix depends on how this number is used internally, if used internally, either increase the value from 32 bits to 64 bits, this requires bringing out a new file format and will break a lot of pre-existing code, I would personally advise against this.
Instead, consider either no-longer using this number. Or, using it as an “abstract” relative number from some abstract point in time, and treat it as such. The time bought with this approach may be doubled by using an unsigned 32-bit integer instead, if negative numbers aren’t used.
This is unlikely to require a new file format version, and can be properly communicated. For third-party parsers this is likely still a change, since now they must handle slightly different logic for file versions, if they were using this value. Otherwise, it won’t affect them.
A third approach is adding appropriate guards for this overflow behaviour, and perhaps having it be intended to be overflown, in which case you might need to manually provide this logic, if Java does not already provide such behaviour in a well-documented fashion. (I believe default behaviour is throw an exception)
Kind regards,
Quinn.
Thank you for your report!
We are tracking this issue in MC-177378, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote or provide any additional information to the main ticket, it would be appreciated.
If you haven’t already, please make use of the search feature to see whether an issue has already been reported.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki