@@ -22,6 +22,7 @@ import io.github.rothes.esu.core.module.Feature
2222import io.github.rothes.esu.core.module.configuration.EmptyConfiguration
2323import io.github.rothes.esu.core.user.User
2424import io.github.rothes.esu.core.util.UnsafeUtils.usBooleanAccessor
25+ import io.github.rothes.esu.core.util.UnsafeUtils.usNullableObjAccessor
2526import io.github.rothes.esu.core.util.extension.math.floorI
2627import io.github.rothes.esu.core.util.extension.math.frac
2728import io.github.rothes.esu.core.util.extension.math.square
@@ -76,8 +77,8 @@ object RaytraceHandlerImpl: RaytraceHandler<RaytraceHandlerImpl.RaytraceConfig,
7677 private val playerVelocityGetter by Versioned (PlayerVelocityGetter ::class .java)
7778 private val entityHandleGetter by Versioned (EntityHandleGetter ::class .java)
7879
79- private val shapedOcclusion = BlockBehaviour .BlockStateBase ::class .java.getDeclaredField(" useShapeForLightOcclusion" ).usBooleanAccessor
8080 private val canOcclude = BlockBehaviour .BlockStateBase ::class .java.getDeclaredField(" canOcclude" ).usBooleanAccessor
81+ private val bsCache = BlockBehaviour .BlockStateBase ::class .java.getDeclaredField(" cache" ).usNullableObjAccessor
8182
8283 private var raytracer: RayTracer = StepRayTracer
8384 private var forceVisibleDistanceSquared = 0.0
@@ -430,7 +431,7 @@ object RaytraceHandlerImpl: RaytraceHandler<RaytraceHandlerImpl.RaytraceConfig,
430431
431432 if (section != null ) { // It can never be null, but we don't want the kotlin npe check!
432433 val blockState = section.get((currX and 15 ) or ((currZ and 15 ) shl 4 ) or ((currY and 15 ) shl (4 + 4 )))
433- if (! shapedOcclusion [blockState] && canOcclude [blockState])
434+ if (canOcclude [blockState] && bsCache [blockState] != null && blockState.isCollisionShapeFullBlock( null , null ) )
434435 return true
435436 }
436437 }
@@ -511,7 +512,7 @@ object RaytraceHandlerImpl: RaytraceHandler<RaytraceHandlerImpl.RaytraceConfig,
511512
512513 if (section != null ) {
513514 val blockState = section.get((currX and 15 ) or ((currZ and 15 ) shl 4 ) or ((currY and 15 ) shl (4 + 4 )))
514- if (! shapedOcclusion [blockState] && canOcclude [blockState])
515+ if (canOcclude [blockState] && bsCache [blockState] != null && blockState.isCollisionShapeFullBlock( null , null ) )
515516 return true
516517 }
517518
0 commit comments