Fix crash when loading Redstone Controller/Emitter from NBT

This commit is contained in:
Shadowfacts 2021-03-10 18:08:57 -05:00
parent c2f1f606f2
commit 8b1705f0a0
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
2 changed files with 3 additions and 3 deletions

View File

@ -28,7 +28,7 @@ class RedstoneControllerBlockEntity: DeviceBlockEntity(PhyBlockEntities.REDSTONE
} }
fun redstoneStateChanged() { fun redstoneStateChanged() {
if (world!!.isClient) return if (world == null || world!!.isClient) return
val oldPowered = redstonePowered val oldPowered = redstonePowered
redstonePowered = cachedState[RedstoneControllerBlock.POWERED] redstonePowered = cachedState[RedstoneControllerBlock.POWERED]

View File

@ -67,7 +67,7 @@ class RedstoneEmitterBlockEntity: DeviceBlockEntity(PhyBlockEntities.REDSTONE_EM
} }
private fun recalculateRedstone() { private fun recalculateRedstone() {
if (world!!.isClient) return if (world == null || world!!.isClient) return
if (stackToMonitor.isEmpty) { if (stackToMonitor.isEmpty) {
cachedEmittedPower = 0 cachedEmittedPower = 0