fix: crash

This commit is contained in:
xtex 2023-08-10 11:45:21 +08:00
parent 296fe1efc2
commit d578db6fb2
Signed by: xtex
GPG Key ID: B918086ED8045B91

View File

@ -62,7 +62,7 @@ class ExchangeItem<E> : Behavior<E>(
owner.brain.eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE)
if (closeAt != null) {
// opened
val chest = level.getBlockEntity(target!!)!!
val chest = level.getBlockEntity(target!!) ?: return
if (chest is ChestBlockEntity) {
ChestBlockEntity.playSound(level, target!!, level.getBlockState(target!!), SoundEvents.CHEST_CLOSE)
}