mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-14 09:56:37 -04:00
rendering: fix some last issues with blockConditions
This commit is contained in:
parent
c129c1adce
commit
46c9df3b54
@ -27,7 +27,6 @@ open class BlockCondition {
|
||||
|
||||
constructor(data: JsonElement) {
|
||||
when (data) {
|
||||
null -> return
|
||||
is JsonObject -> {
|
||||
addToProperties(data.asJsonObject)
|
||||
}
|
||||
@ -39,6 +38,8 @@ open class BlockCondition {
|
||||
}
|
||||
}
|
||||
|
||||
constructor()
|
||||
|
||||
private fun addToProperties(data: JsonObject) {
|
||||
val current: MutableList<MutableSet<BlockProperties>> = mutableListOf()
|
||||
for ((propertyName, propertyJsonValue) in data.entrySet()) {
|
||||
@ -86,29 +87,18 @@ open class BlockCondition {
|
||||
blockProperties.add(current)
|
||||
}
|
||||
|
||||
constructor()
|
||||
|
||||
open fun contains(testProperties: MutableSet<BlockProperties>, testRotation: BlockRotations): Boolean {
|
||||
if (rotation != BlockRotations.NONE && rotation != testRotation) {
|
||||
return false
|
||||
}
|
||||
for (propertiesSubSet in blockProperties) {
|
||||
var propertiesGood = true
|
||||
outerLoop@ for (propertiesSubSet in blockProperties) {
|
||||
for (properties in propertiesSubSet) {
|
||||
for (property in properties) {
|
||||
if (! testProperties.contains(property)) {
|
||||
propertiesGood = false
|
||||
break
|
||||
if (testProperties.intersect(properties).isEmpty()) {
|
||||
continue@outerLoop
|
||||
}
|
||||
}
|
||||
if (! propertiesGood) {
|
||||
break
|
||||
}
|
||||
}
|
||||
if (propertiesGood) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,8 @@ import com.google.common.collect.HashBiMap
|
||||
import com.google.gson.JsonObject
|
||||
import de.bixilon.minosoft.data.Axes
|
||||
import de.bixilon.minosoft.data.Directions
|
||||
import de.bixilon.minosoft.data.mappings.ResourceLocation
|
||||
import de.bixilon.minosoft.data.mappings.versions.VersionMapping
|
||||
import de.bixilon.minosoft.data.text.RGBColor
|
||||
import de.bixilon.minosoft.data.world.BlockPosition
|
||||
import de.bixilon.minosoft.data.world.light.LightAccessor
|
||||
|
Loading…
x
Reference in New Issue
Block a user