workaround light for non opaque blocks

This commit is contained in:
Bixilon 2022-09-27 08:37:39 +02:00
parent 1d134f3bb2
commit ca7973017d
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
2 changed files with 3 additions and 2 deletions

View File

@ -125,10 +125,10 @@ data class BlockState(
val outlineShape = data["outline_shape"]?.asShape() ?: VoxelShape.EMPTY
val lightProperties = if (outlineShape == VoxelShape.EMPTY) {
val lightProperties = if (outlineShape == VoxelShape.EMPTY || data["is_opaque"]?.toBoolean() == false) {
TransparentProperty
} else if (outlineShape == VoxelShape.FULL) {
if (data["is_opaque"]?.toBoolean() != false) SolidProperty else TransparentProperty
SolidProperty
} else {
DirectedProperty.of(outlineShape)
}

View File

@ -58,6 +58,7 @@ class DirectedProperty(private val directions: BooleanArray) : LightProperties {
return isSideCovered(`in`) && isSideCovered(out) // ToDo: That could go wrong
}
@Deprecated("Absolutely trash")
fun VoxelShape.isSideCovered(side: Directions): Boolean {
// ToDo: This whole calculation is technically wrong, it could be that 2 different sides of 2 blocks are "free". That means that light can still not pass the blocks, but
// this algorithm does not cover it. Let's see it as performance hack