Giter VIP home page Giter VIP logo

Comments (5)

0-zen avatar 0-zen commented on May 18, 2024 1

@LucasDower
Schematic already uses a format that is a bit similar to JSON: https://www.reddit.com/r/Minecraft/comments/k3rrce/is_there_a_way_to_convert_schematic_files_into/

Only repo I found while googling it is:
https://github.com/MicleBrick/Schematic2Json
Which isnt very serious...

Also there are other people asking that question:
https://www.reddit.com/r/MinecraftHelp/comments/tzv3z1/is_there_a_way_to_convert_minecraft_schematics/
But as you can see there are no answers.

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
If you need to have the structure formated in a JSON file for your specific needs, I suggest you fork this repo and create your own norm for that kind of format. This will also provide you with more freedom & knowledge when it comes to programming your parser (to read the JSON files you'll make).

from objtoschematic.

LucasDower avatar LucasDower commented on May 18, 2024

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?

from objtoschematic.

LucasDower avatar LucasDower commented on May 18, 2024

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.

from objtoschematic.

0-zen avatar 0-zen commented on May 18, 2024

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.

from objtoschematic.

LucasDower avatar LucasDower commented on May 18, 2024

Added 'Indexed JSON' and 'Uncompressed JSON' exporters.

from objtoschematic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.