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) {
|
constructor(data: JsonElement) {
|
||||||
when (data) {
|
when (data) {
|
||||||
null -> return
|
|
||||||
is JsonObject -> {
|
is JsonObject -> {
|
||||||
addToProperties(data.asJsonObject)
|
addToProperties(data.asJsonObject)
|
||||||
}
|
}
|
||||||
@ -39,6 +38,8 @@ open class BlockCondition {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constructor()
|
||||||
|
|
||||||
private fun addToProperties(data: JsonObject) {
|
private fun addToProperties(data: JsonObject) {
|
||||||
val current: MutableList<MutableSet<BlockProperties>> = mutableListOf()
|
val current: MutableList<MutableSet<BlockProperties>> = mutableListOf()
|
||||||
for ((propertyName, propertyJsonValue) in data.entrySet()) {
|
for ((propertyName, propertyJsonValue) in data.entrySet()) {
|
||||||
@ -86,28 +87,17 @@ open class BlockCondition {
|
|||||||
blockProperties.add(current)
|
blockProperties.add(current)
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor()
|
|
||||||
|
|
||||||
open fun contains(testProperties: MutableSet<BlockProperties>, testRotation: BlockRotations): Boolean {
|
open fun contains(testProperties: MutableSet<BlockProperties>, testRotation: BlockRotations): Boolean {
|
||||||
if (rotation != BlockRotations.NONE && rotation != testRotation) {
|
if (rotation != BlockRotations.NONE && rotation != testRotation) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
for (propertiesSubSet in blockProperties) {
|
outerLoop@ for (propertiesSubSet in blockProperties) {
|
||||||
var propertiesGood = true
|
|
||||||
for (properties in propertiesSubSet) {
|
for (properties in propertiesSubSet) {
|
||||||
for (property in properties) {
|
if (testProperties.intersect(properties).isEmpty()) {
|
||||||
if (! testProperties.contains(property)) {
|
continue@outerLoop
|
||||||
propertiesGood = false
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (! propertiesGood) {
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (propertiesGood) {
|
return true
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,8 @@ import com.google.common.collect.HashBiMap
|
|||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import de.bixilon.minosoft.data.Axes
|
import de.bixilon.minosoft.data.Axes
|
||||||
import de.bixilon.minosoft.data.Directions
|
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.text.RGBColor
|
||||||
import de.bixilon.minosoft.data.world.BlockPosition
|
import de.bixilon.minosoft.data.world.BlockPosition
|
||||||
import de.bixilon.minosoft.data.world.light.LightAccessor
|
import de.bixilon.minosoft.data.world.light.LightAccessor
|
||||||
|
Loading…
x
Reference in New Issue
Block a user