Open rom1504 opened 9 years ago
Interesting data but it doesn't make the link between block/item id and block state, for example :
That means it's needed to extract that information from the wiki in a first step.
Might be interesting : flower_pot.json
{
"variants": {
"contents=empty": { "model": "flower_pot" },
"contents=rose": { "model": "flower_pot_rose" },
"contents=blue_orchid": { "model": "flower_pot_orchid" },
"contents=allium": { "model": "flower_pot_allium" },
"contents=houstonia": { "model": "flower_pot_houstonia" },
"contents=red_tulip": { "model": "flower_pot_tulip_red" },
"contents=orange_tulip": { "model": "flower_pot_tulip_orange" },
"contents=white_tulip": { "model": "flower_pot_tulip_white" },
"contents=pink_tulip": { "model": "flower_pot_tulip_pink" },
"contents=oxeye_daisy": { "model": "flower_pot_daisy" },
"contents=dandelion": { "model": "flower_pot_dandelion" },
"contents=oak_sapling": { "model": "flower_pot_oak" },
"contents=spruce_sapling": { "model": "flower_pot_spruce" },
"contents=birch_sapling": { "model": "flower_pot_birch" },
"contents=jungle_sapling": { "model": "flower_pot_jungle" },
"contents=acacia_sapling": { "model": "flower_pot_acacia" },
"contents=dark_oak_sapling": { "model": "flower_pot_dark_oak" },
"contents=mushroom_red": { "model": "flower_pot_mushroom_red" },
"contents=mushroom_brown": { "model": "flower_pot_mushroom_brown" },
"contents=dead_bush": { "model": "flower_pot_dead_bush" },
"contents=fern": { "model": "flower_pot_fern" },
"contents=cactus": { "model": "flower_pot_cactus" }
}
}
Any new ideas on this issue? I need a mapping from the 16-bit metadata to the model, i.e. the blockstate and its variant. Of course, this is not completely possible because not all block state is persisted in the metadata, it should be possible to get a close-enough mapping for many blocks.
Do you think we could use an automatic import from a data source? The wiki does not seem like the best source, it can be informal, e.g. for Fence Gate.
Thus I think these information need to be added manually, or does someone have a better idea?
Edit: I got an idea: Maybe we can just execute the getStateFromMeta
methods of all block classes with 0..15
as parameter. They should not depend on the game status, so it should be pretty easy to execute them from a script.
A bit more info: Block.registerBlocks
populates Block.BLOCK_STATE_IDS
with a mapping of block IDs, textual ids (probably a canonical minecraft:...
name, though there might be multiple for one ID as far as I understand) and Block
instances. So we can just loop over this map to get all the Block
instances with their ids, and then call getStateFromMeta
to map block state ids (block id + meta combined, as stored in the world and sent over network) to Block-IBlockState
combinations which in turn can be mapped to the blockstate entries in the JSON file via the BlockStateMapper
.
@Yogu I'm open to any way to extract that data, using the minecraft jar would definitely be a good way to do it. If you feel like doing it please go ahead, I'll accept a PR with the resulting data, and would be interested by the extractor code !
I made a small mod: forge-data-extractor that produces these files (whole list of files which is too large so the interesting file is not displayed).
What do you think would be helpful here? I think, the blockstate-ids.json
would fit nicely in the variants
part of blocks
, and the blockstates-without-models
could also be a good fit. However, we should first look into what these flags stand for, I just put in everything that was available.
related https://github.com/PrismarineJS/minecraft-jar-extractor/blob/master/image_names.js and https://github.com/rom1504/minecraft-assets
@Yogu yes it could be useful, I'm not sure exactly where to put that in mcdata
There are block state files available by doing this :
Example : birch_fence_gate.json :
Might be interesting for handling metadata/blockstate (and placing that kind of blocks)