fix thread race condition in chunk render workers, closes #2902

This commit is contained in:
Adrian Siekierka 2022-08-31 21:57:32 +02:00
parent 428bbe8592
commit 096daeac75

View File

@ -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