From c45f5f60294e3ccf38c73261b0624ab06b008476 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Tue, 9 Jan 2024 18:23:38 +0700 Subject: [PATCH] send help --- .../mc/otm/block/entity/MatteryBlockEntity.kt | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) 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 28fa66950..2febc6b60 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 @@ -342,7 +342,7 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc optional.invalidate() if (SERVER_IS_LIVE) - level?.once { setChanged() } + level?.once { if (!this@MatteryBlockEntity.isRemoved) setChanged() } } } @@ -354,7 +354,7 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc optional = LazyOptional.of { capability } if (SERVER_IS_LIVE) - level?.once { setChanged() } + level?.once { if (!this@MatteryBlockEntity.isRemoved) setChanged() } } } } @@ -365,7 +365,7 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc optional.invalidate() if (SERVER_IS_LIVE) - level?.once { setChanged() } + level?.once { if (!this@MatteryBlockEntity.isRemoved) setChanged() } } } @@ -377,7 +377,7 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc optional = LazyOptional.of { capability } if (SERVER_IS_LIVE) - level?.once { setChanged() } + level?.once { if (!this@MatteryBlockEntity.isRemoved) setChanged() } } } } @@ -491,8 +491,10 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc if (isRemoved) markSynchronizerClean() if (level?.isClientSide == false && (_subCache == null || (_subCache ?: throw ConcurrentModificationException()).players.isNotEmpty())) { - ru.dbotthepony.mc.otm.onceServer { - synchronizeToPlayers(true) + onceServer { + if (!isRemoved) { + synchronizeToPlayers(true) + } } } else { markSynchronizerClean() @@ -527,8 +529,10 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc } } else { level.once { - for (side in _sides.values) { - side.updateTracked() + if (!isRemoved) { + for (side in _sides.values) { + side.updateTracked() + } } } } @@ -675,7 +679,9 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc if (!blockEntities.add(blockEntity)) return onceServer { - blockEntity.synchronizeToPlayers(false) + if (!blockEntity.isRemoved && blockEntity in blockEntities) { + blockEntity.synchronizeToPlayers(false) + } } if (blockEntity.synchronizer.hasObservers && blockEntity.tickList.ticks == 0) {