models: also generate parent models

This commit is contained in:
Bixilon 2021-02-23 17:00:03 +01:00
parent 1e4a377812
commit 6a4132f5b0
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -11,9 +11,17 @@ object ModelsGenerator : Generator(
override fun generate() {
for (model in MODELS_TO_GENERATE) {
val resourceLocation = ResourceLocation(model)
data.add(resourceLocation.toString(), Util.readJsonMinecraftResource("assets/${resourceLocation.namespace}/models/${resourceLocation.path}.json"))
loadModel(resourceLocation)
}
}
private fun loadModel(resourceLocation: ResourceLocation) {
val modelJson = Util.readJsonMinecraftResource("assets/${resourceLocation.namespace}/models/${resourceLocation.path}.json")
modelJson["parent"]?.let {
loadModel(ResourceLocation(it.asString))
}
data.add(resourceLocation.toString(), Util.readJsonMinecraftResource("assets/${resourceLocation.namespace}/models/${resourceLocation.path}.json"))
}
}