diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryBlockEntity.kt index 1714205fe..3bbc3582d 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryBlockEntity.kt @@ -287,8 +287,10 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc ?.chunkSource ?.getChunkNow(SectionPos.blockToSectionCoord(targetPos.x), SectionPos.blockToSectionCoord(targetPos.z)) + val subref = subscriptions[capability] as SubRef + if (chunk == null) { - subscriptions[capability]!!.unset() + subref.unset() level?.once { updateTracked(capability) } return } @@ -296,19 +298,17 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc val entity = chunk.getBlockEntity(targetPos) if (entity == null) { - subscriptions[capability]!!.unset() + subref.unset() return } val new = entity.getCapability(capability, dir.opposite) if (!new.isPresent) { - subscriptions[capability]!!.unset() + subref.unset() return } - val subref = subscriptions[capability] as SubRef - if (subref.value !== new) { if (knownLOs.add(new)) { val ref = WeakReference(this)