diff --git a/src/main/scala/li/cil/oc/common/block/Print.scala b/src/main/scala/li/cil/oc/common/block/Print.scala index 4b51f1ea7..11635ebb1 100644 --- a/src/main/scala/li/cil/oc/common/block/Print.scala +++ b/src/main/scala/li/cil/oc/common/block/Print.scala @@ -10,7 +10,6 @@ import li.cil.oc.common.tileentity import li.cil.oc.integration.util.NEI import li.cil.oc.util.ExtendedAABB import li.cil.oc.util.ExtendedAABB._ -import net.minecraft.block.Block import li.cil.oc.util.InventoryUtils import net.minecraft.block.properties.IProperty import net.minecraft.block.state.IBlockState @@ -87,16 +86,22 @@ class Print(protected implicit val tileTag: ClassTag[tileentity.Print]) extends override def isOpaqueCube = false - override def getLightValue(world: IBlockAccess, pos: BlockPos): Int = - world.getTileEntity(pos) match { - case print: tileentity.Print => print.data.lightLevel - case _ => super.getLightValue(world, pos) + override def getLightValue(blockAccess: IBlockAccess, pos: BlockPos): Int = + blockAccess match { + case world: World if world.isBlockLoaded(pos) => world.getTileEntity(pos) match { + case print: tileentity.Print => print.data.lightLevel + case _ => super.getLightValue(world, pos) + } + case _ => super.getLightOpacity(blockAccess, pos) } - override def getLightOpacity(world: IBlockAccess, pos: BlockPos): Int = - world.getTileEntity(pos) match { - case print: tileentity.Print if Settings.get.printsHaveOpacity => (print.data.opacity * 4).toInt - case _ => super.getLightOpacity(world, pos) + override def getLightOpacity(blockAccess: IBlockAccess, pos: BlockPos): Int = + blockAccess match { + case world: World if world.isBlockLoaded(pos) => world.getTileEntity(pos) match { + case print: tileentity.Print if Settings.get.printsHaveOpacity => (print.data.opacity * 4).toInt + case _ => super.getLightOpacity(world, pos) + } + case _ => super.getLightOpacity(blockAccess, pos) } override def isVisuallyOpaque = false