model builder: wip baking, serialize or condition

This commit is contained in:
Bixilon 2023-03-30 13:46:16 +02:00
parent 4a469a9394
commit 34857d0878
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
2 changed files with 25 additions and 2 deletions

View File

@ -14,6 +14,7 @@
package de.bixilon.minosoft.gui.rendering.models.block.state.builder package de.bixilon.minosoft.gui.rendering.models.block.state.builder
import de.bixilon.minosoft.gui.rendering.models.block.state.apply.BlockStateApply import de.bixilon.minosoft.gui.rendering.models.block.state.apply.BlockStateApply
import de.bixilon.minosoft.gui.rendering.models.block.state.baked.BakedModel
import de.bixilon.minosoft.gui.rendering.models.block.state.render.BlockRender import de.bixilon.minosoft.gui.rendering.models.block.state.render.BlockRender
import de.bixilon.minosoft.gui.rendering.system.base.texture.TextureManager import de.bixilon.minosoft.gui.rendering.system.base.texture.TextureManager
@ -22,6 +23,20 @@ class BuilderApply(
) : BlockStateApply { ) : BlockStateApply {
override fun bake(textures: TextureManager): BlockRender? { override fun bake(textures: TextureManager): BlockRender? {
TODO("Not yet implemented") val static: MutableList<BakedModel> = mutableListOf()
val dynamic: MutableList<BlockRender> = mutableListOf()
for (apply in this.applies) {
val baked = apply.bake(textures) ?: continue
if (baked is BakedModel) {
static += baked
} else {
dynamic += baked
}
}
if (static.isEmpty() && dynamic.isEmpty()) return null
TODO("Can not combine them yet")
} }
} }

View File

@ -31,7 +31,15 @@ class OrCondition(
const val KEY = "OR" const val KEY = "OR"
fun deserialize(data: List<JsonObject>): OrCondition? { fun deserialize(data: List<JsonObject>): OrCondition? {
TODO() val conditions: MutableSet<BuilderCondition> = mutableSetOf()
for (entry in data) {
conditions += AndCondition.deserialize(entry) ?: continue
}
if (conditions.isEmpty()) return null
return OrCondition(conditions)
} }
} }
} }