From 096daeac75b6d625b7fc7ac7cadd6032e69fd553 Mon Sep 17 00:00:00 2001 From: Adrian Siekierka Date: Wed, 31 Aug 2022 21:57:32 +0200 Subject: [PATCH] fix thread race condition in chunk render workers, closes #2902 --- .../li/cil/oc/common/tileentity/traits/Rotatable.scala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/scala/li/cil/oc/common/tileentity/traits/Rotatable.scala b/src/main/scala/li/cil/oc/common/tileentity/traits/Rotatable.scala index 9a223605d..2474b7704 100644 --- a/src/main/scala/li/cil/oc/common/tileentity/traits/Rotatable.scala +++ b/src/main/scala/li/cil/oc/common/tileentity/traits/Rotatable.scala @@ -24,8 +24,8 @@ trait Rotatable extends RotationAware with internal.Rotatable { // Accessors // ----------------------------------------------------------------------- // - def pitch = if (getWorld != null && getWorld.isBlockLoaded(getPos)) getBlockType match { - case rotatable if getWorld.getBlockState(getPos).getProperties.containsKey(PropertyRotatable.Pitch) => getWorld.getBlockState(getPos).getValue(PropertyRotatable.Pitch) + def pitch = if (getWorld != null && getWorld.isBlockLoaded(getPos)) getWorld.getBlockState(getPos) match { + case rotatable if rotatable.getProperties.containsKey(PropertyRotatable.Pitch) => rotatable.getValue(PropertyRotatable.Pitch) case _ => EnumFacing.NORTH } else null @@ -35,9 +35,9 @@ trait Rotatable extends RotationAware with internal.Rotatable { case _ => EnumFacing.NORTH }, yaw) - def yaw = if (getWorld != null && getWorld.isBlockLoaded(getPos)) getBlockType match { - case rotatable if getWorld.getBlockState(getPos).getProperties.containsKey(PropertyRotatable.Yaw) => getWorld.getBlockState(getPos).getValue(PropertyRotatable.Yaw) - case rotatable if getWorld.getBlockState(getPos).getProperties.containsKey(PropertyRotatable.Facing) => getWorld.getBlockState(getPos).getValue(PropertyRotatable.Facing) + def yaw = if (getWorld != null && getWorld.isBlockLoaded(getPos)) getWorld.getBlockState(getPos) match { + case rotatable if rotatable.getProperties.containsKey(PropertyRotatable.Yaw) => rotatable.getValue(PropertyRotatable.Yaw) + case rotatable if rotatable.getProperties.containsKey(PropertyRotatable.Facing) => rotatable.getValue(PropertyRotatable.Facing) case _ => EnumFacing.SOUTH } else null