mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 03:44:54 -04:00
multipart models: AND condition
This fixes a block model loading crash in 1.19.3
This commit is contained in:
parent
29d1074c45
commit
84a6b4d1a9
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Minosoft
|
* Minosoft
|
||||||
* Copyright (C) 2021 Moritz Zwerger
|
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
@ -113,6 +113,15 @@ class MultipartRootModel(
|
|||||||
}
|
}
|
||||||
return@let
|
return@let
|
||||||
}
|
}
|
||||||
|
val and = it["AND"]
|
||||||
|
if (and is List<*>) {
|
||||||
|
val andCondition: MutableMap<BlockProperties, Set<Any>> = mutableMapOf()
|
||||||
|
for (andData in and) {
|
||||||
|
andCondition += getCondition(andData.unsafeCast())
|
||||||
|
}
|
||||||
|
condition += andCondition
|
||||||
|
return@let
|
||||||
|
}
|
||||||
condition += getCondition(it)
|
condition += getCondition(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Minosoft
|
* Minosoft
|
||||||
* Copyright (C) 2021 Moritz Zwerger
|
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
@ -23,14 +23,10 @@ interface RootModel {
|
|||||||
fun getModelForState(blockState: BlockState): UnbakedModel
|
fun getModelForState(blockState: BlockState): UnbakedModel
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
operator fun invoke(modeLoader: ModelLoader, data: Map<String, Any>): RootModel? {
|
operator fun invoke(modeLoader: ModelLoader, data: Map<String, Any>): RootModel {
|
||||||
val variants = data["variants"]
|
data["variants"]?.let { return SimpleRootModel(modeLoader, it.unsafeCast()) }
|
||||||
val multipart = data["multipart"]
|
data["multipart"]?.let { return MultipartRootModel(modeLoader, it.unsafeCast()) }
|
||||||
return when {
|
TODO("Don't know what type of block state model to choose: $data")
|
||||||
variants != null -> SimpleRootModel(modeLoader, variants.unsafeCast())
|
|
||||||
multipart != null -> MultipartRootModel(modeLoader, multipart.unsafeCast())
|
|
||||||
else -> TODO("Don't know what type of block state model to choose: $data")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user