From ffc56ada1a8eafa0e0b2fbf072e7e3fd1fbdcd32 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Sun, 2 Oct 2022 21:33:19 +0700 Subject: [PATCH] Fix attaching stabilizers not instantly updating black hole properties on client --- .../block/entity/blackhole/BlackHoleBlockEntity.kt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/blackhole/BlackHoleBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/blackhole/BlackHoleBlockEntity.kt index 72883726c..17d630b87 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/blackhole/BlackHoleBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/blackhole/BlackHoleBlockEntity.kt @@ -95,8 +95,18 @@ class BlackHoleBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : Synchro sleepTicks = 4 } + private fun updateMass() { + mass = mass + } + private val stabilizers = LinkedList() - private var stabilizerClientCount by synchronizer.int() + private var stabilizerClientCount by synchronizer.int(setter = setter@{ value, field, setByRemote -> + field.write(value) + + if (setByRemote) { + updateMass() + } + }) fun stabilizerAttached(stabilizer: GravitationStabilizerBlockEntity) { if (stabilizer in stabilizers)