Bedrock Edition Integration (and more)
This took me more than a year to finish. Due to the different nature of Bedrock(pun intended), I had to refactor huge parts of the code to make it work with PixelMap at all. Some designs I had chosen were too integrated into how JE worked, so I had to carefully move things around, add units testing, proper logging and better save folder detection.
Unit testing helped a lot, because I did not need any final version in order to see if I got things to work at all. While I were at it I added some unit testing for existing code, and accidentally stumbled upon a couple of bugs that may or may not be part of what users have discovered years ago. It was a bliss to find everything working through this feature. Unit testing is not “the tool of tools”, but just a tool to make it less possible for bugs to occur, and if more happens to pop up, one just need to throw it into the unit testing and make sure it works with the other tests.
For logging I used std::c*
like most novice C++ developers. However, I wanted something more robust and make it possible to make it automatically pick between printing to terminal or writing to file, as well as predictable flushing and message level. After looking around for a while, spdlog
felt natural and was very easy to integrate. I just had to do some adjustment when initializing it (which was not necessary), but after that was done it was very easy to use.
Save detection was just checking folders and files and see if it works. There is no magic that “just makes it work”. Though, I need to revisit later, because currently the code is a bit spread out.
Moving things around, or refactoring for short, was tedious, because it was done in rendering, processing pipeline, initialization and several utilities. It was worth it, but a bit dirty, so once again, I need to revisit that in the future as well.
Finally, the integration of Bedrock was very fun. Most of the work was already done, so it was just a matter of adding its own processing pipeline, make sure that everything was added, and then find out that Bedrock chunk section blocks was stored as XZY, and not YZX as Java was. It is pretty crude, using 10 times more RAM than JE, and lacks some features like lonely checking, is missing some chunk sections, and is very slow. LevelDB claims it should be fast, but it could be the underlying storage that makes it slower than it looks like.
Was this worth it? Well, I could brag about it being the first MC mapper that can parse both save formats, and I feel the result is pretty pleasing. I still have several tweaks to do, but at least I got myself the first image rendering.