From 9cd5bad152d293e27b71ca368712bdf5ad1327a3 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Wed, 19 Jul 2023 18:43:26 +0700 Subject: [PATCH] If we are ticking normally, don't use global tick handler to send blockentity changes to players --- .../dbotthepony/mc/otm/block/entity/MatteryBlockEntity.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 800e50c18..f3fb2360e 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 @@ -113,8 +113,12 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc */ protected val savetablesLevel = Savetables() + private var tickedOnce = false + open fun tick() { tickList.tick() + tickedOnce = true + synchronizeToPlayers(false) } /** @@ -528,7 +532,7 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc } val synchronizer = FieldSynchronizer { - if (isSynchronizing) + if (isSynchronizing || tickedOnce) return@FieldSynchronizer if (!isRemoved && level?.isClientSide == false && (_subCache == null || (_subCache ?: throw ConcurrentModificationException()).players.isNotEmpty())) {