If we are ticking normally, don't use global tick handler to send blockentity changes to players

This commit is contained in:
DBotThePony 2023-07-19 18:43:26 +07:00
parent 135dcb667d
commit 9cd5bad152
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -113,8 +113,12 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc
*/ */
protected val savetablesLevel = Savetables() protected val savetablesLevel = Savetables()
private var tickedOnce = false
open fun tick() { open fun tick() {
tickList.tick() tickList.tick()
tickedOnce = true
synchronizeToPlayers(false)
} }
/** /**
@ -528,7 +532,7 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc
} }
val synchronizer = FieldSynchronizer { val synchronizer = FieldSynchronizer {
if (isSynchronizing) if (isSynchronizing || tickedOnce)
return@FieldSynchronizer return@FieldSynchronizer
if (!isRemoved && level?.isClientSide == false && (_subCache == null || (_subCache ?: throw ConcurrentModificationException()).players.isNotEmpty())) { if (!isRemoved && level?.isClientSide == false && (_subCache == null || (_subCache ?: throw ConcurrentModificationException()).players.isNotEmpty())) {