-
-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: Add JSON mode on exports. #102
Comments
Sure I can add a JSON exporter, is there a particular format you have in mind or just access to block names and their positions? |
@LucasDower Only repo I found while googling it is: Also there are other people asking that question: As of now it doesnt seem that JSON is used for storing minecraft structure nor that there is a norm for that kind of file. This means that there is no relevant norm (approved or used) that we could choose to implement. @Dkavila |
I imagine the main benefit of a JSON exporter is that it's the easiest to parse, any popular language has JSON libraries so if somebody wants to use the block data somewhere it's a lot easier to load a JSON file than try decipher any of the NBT-based exporters. Like @0-zen said, it's just about deciding the format. The main concern is that (1) JSON is text-based so encoding is slow, and (2) there's potentially tens of thousands of blocks and JSON is quite verbose so the file could be massive. We could export something simple like: [
{ "x": 0, "y": 0, "z": 0, "block": "minecraft:stone" },
{ "x": 1, "y": 8, "z": 7, "block": "minecraft:bedrock" },
{ "x": 2, "y": 1, "z": 4, "block": "minecraft:cobblestone" },
...
] which would be super implement and super simple for an external program to read but is not very suitable for massive builds. Alternatively we could go down a similar approach to the .gltf format is a JSON file with block data buffers stored as base64 encoded strings. |
I feel that if we use base64 for encoding, we are going to target people who already know how to program a bit. We might as well create our own binary format, which will be much more compact. Or we could inspire from binary PLY files, which have a structure that starts with a short ASCII header and then binary body. |
Added 'Indexed JSON' and 'Uncompressed JSON' exporters. |
It will be amazing for the community!!!
The text was updated successfully, but these errors were encountered: