maruohon / tellme

Small informational mod for Minecraft
22 stars 10 forks source link

Suggestion: Add a dump-json option #7

Closed lendrick closed 6 years ago

lendrick commented 6 years ago

Pretty self-explanatory. JSON is a lot easier to parse than CSV. :)

maruohon commented 6 years ago

I'm curious, where do you need to parse the dumps such that JSON is an easier option? Thus far I've only heard people wanting to import the dumps into a spreadsheet, where CSV works best.

If I'm going to add the JSON output format, what kind of structure should it have? Would it be something like this?

{
    "title": [ "col 1", "col 2", "col 3" ],
    "data":
    [
        [ "foo", "bar", "baz" ],
        [ "cat", "dog", "penguin" ]
    ]
}
lendrick commented 6 years ago

I was thinking something like this:

{
  "Minecraft": {
     "minecraft:acacia_door": {
        "BlockID" : 196,
        "Subtypes": false,
        "ItemID": null,
         etc
     },
     "minecraft:cobblestone": {
         ...
     }
  }, 
  "Chisel": {
      ....
  },
   ...
}

Hopefully my indentation isn't too wonky. Essentially, a tree structure with mods at the top, then the blocks in each mod, and then each block with key/value pairs for the rest of the data.

The reason I'm looking for this is that I'm planning to write a web-based palette generation helper for Lost Cities, and parsing JSON in Javascript is a non-issue. People will need to be able to paste in their own block lists for it to be useful, though.

maruohon commented 6 years ago

Ah okay... This dump variant will then need entirely its own dump code to make such a data structure. Would it be enough to only implement it for the block registry then? For your use case I assume that would be enough? It would probably be a fair amount of work to add this completely separate dump style for everything...

maruohon commented 6 years ago

Here is an example of the current output format: https://pastebin.com/uXxrqSEE

lendrick commented 6 years ago

Yes, that's exactly what I was looking for. Thanks!!