From b10b1c0da4086adc21cc8e3dc2d5cf6274cd591b Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Fri, 7 Feb 2025 21:11:07 +0700 Subject: [PATCH] Failsafe when blackhole block entity gets removed --- .../otm/block/entity/blackhole/BlackHoleGeneratorBlockEntity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/blackhole/BlackHoleGeneratorBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/blackhole/BlackHoleGeneratorBlockEntity.kt index 58f6b4222..3318c44a4 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/blackhole/BlackHoleGeneratorBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/blackhole/BlackHoleGeneratorBlockEntity.kt @@ -162,7 +162,7 @@ class BlackHoleGeneratorBlockEntity(blockPos: BlockPos, blockState: BlockState) if (!multiblock.update(level, blockRotation.front)) { this.lastRange = findBlackHoleRange() } else { - val blackHole = multiblock.blockEntities(BLACK_HOLE).first() + val blackHole = multiblock.blockEntities(BLACK_HOLE).firstOrNull() ?: return val matterExtracted = matter.extractMatter(if (mode == Mode.TARGET_MASS && blackHole.mass != targetMass) minOf(injectionRate, (blackHole.mass - targetMass).absoluteValue) else injectionRate, true) if (!matterExtracted.isPositive) return