SPGoding / resource-pack-converter

(WIP) A npm package that provides method to convert Minecraft: Java Edition resource packs from a version to another version.
MIT License
2 stars 1 forks source link

Change PathAdapter logic. #15

Closed SPGoding closed 5 years ago

SPGoding commented 5 years ago

We have changed PathAdapter before in #7, but that's incompleted. Since models were introduced in JE1.8 and blockstates were introduced in JE1.9, the namespaced IDs of textures are not fixed anymore.

In JE1.8, models determine the namespaced IDs of textures. In JE1.9, blockstates determine the namespaced IDs of block models.

So when wiring the conversion of JE1.8 into JE1.9, what we should do is not to change textures locations, but to change the locations of models accordingly. Only if the model is omitted in the resource pack, we should apply the changes of models in vanilla resource pack to the textures.

So, don't split texture minecraft:items/clock hardcodely, but to split textures defined in model minecraft:item/clock. To implement this, we need an object like this:

{
    "models": {
        "minecraft:item/clock": {
            "parent": "builtin/clock",
            "textures": {
                "...": "....."
            }
        },
       "...": {}
    }
}

And we merge the model definitions in input resource pack (identified with "RPC$isReplaced": true) with the object. At last we find out the specific model, check if the parent is set to builtin/clock, get the namespaced ID of clock texture, split textures (and models if RPC$isReplaced).

SPGoding commented 5 years ago

Duplicated with #16.