add VoxelShape::equals

* This should fix some lighting bugs, because light properties are not determinant as expected
This commit is contained in:
Bixilon 2022-09-16 14:37:28 +02:00
parent 91b306ce8a
commit 3a21bbfa2f
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -140,6 +140,21 @@ class VoxelShape(private val aabbs: MutableList<AABB> = mutableListOf()) : Itera
return shouldDrawLine(start.toVec3d, end.toVec3d)
}
override fun toString(): String {
return aabbs.toString()
}
override fun hashCode(): Int {
return aabbs.hashCode()
}
override fun equals(other: Any?): Boolean {
if (other === this) return true
if (other !is VoxelShape) return false
if (other.hashCode() != hashCode()) return false
return aabbs == other.aabbs
}
companion object {
val EMPTY = VoxelShape()
val FULL = VoxelShape(mutableListOf(AABB.BLOCK))