Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes: - After working with the C++ code yesterday, and working on MCRegionJS some more, I decided this codebase could use some help too. In favor of using loops to iterate over `x` data instead of slicing the data into multiple chunks, I am moving away from the `chunkify()` function! While it did work very well, it wasn't really necessary because it added an extra step in that didn't need to be there. Rather than splitting the data into individual chunks to read separately, you can just iterate over the full data in `x` steps manually, then get the output relative to that location. Very nice! I started adding that over in MCRegionJS first, but got a bit overwhelmed with all of the features over there, so I decided to remove `chunkify()` from this one first, since it isn't as complex, and it depends on MCRegion's source of `chunkify()` itself. So, now I can go fully remove it from over in MCRegionJS too! - The exported functions are now part of a class, as static methods. I started using this pattern over in MCRegionJS also, and it's also really nice to describe the data with. Woah! Don't look now, but I think that's Object-Oriented programming? :O (PLEASE, SEND HELP! I'M STARTING TO LIKE IT XD) - I think the main reason this class-based setup works well for this kind of data management is because I want to be able to read/write (eventually) the data as a whole, but also provide an API to allow other people to use the library's logic to work with the data too. So, I don't only want to be able to read the data, but also provide people with a way to read the header for `x` file, or just get the chunks for `x` region, things like that. I can't predict all of the different things you might want to do with the data, so why not just give the tools to you? That sounds really cool to me! And, I think I'll eventually make other things with those tools too, a bit futher down the line. Like, say if you wanted to replace all of the Stone blocks in your world to Diorite (no, don't do that.), you could just open up the save with `x` API, iterate over all of the Regions, iterate over all of their Chunks, then iterate over all of the blocks and just replace `x` value with `y` value. Simple as that! I guess I want the data to just be there, without the need to figure out how to get it. It should just be plain accessible :) - Incremented the version number up a step, since this is a significant change for sure (yay).
- Loading branch information