diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/blackhole/BlockEntityBlackHole.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/blackhole/BlockEntityBlackHole.kt index d52038380..4679c98e6 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/blackhole/BlockEntityBlackHole.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/blackhole/BlockEntityBlackHole.kt @@ -13,6 +13,7 @@ import net.minecraft.world.entity.LivingEntity import net.minecraft.world.entity.item.ItemEntity import net.minecraft.world.entity.player.Player import net.minecraft.world.level.Explosion +import net.minecraft.world.level.Level import net.minecraft.world.level.block.Block import net.minecraft.world.level.block.Blocks import net.minecraft.world.level.block.entity.BlockEntity @@ -45,7 +46,7 @@ class BlockEntityBlackHole(p_155229_: BlockPos, p_155230_: BlockState) : BlockEn var massForDiv = mass - when (if (level?.isClientSide == true) stabilizerClientCount else stabilizers.size) { + when (if (level?.isClientSide == false) stabilizers.size else stabilizerClientCount) { 1 -> {massForDiv /= 4} 2 -> {massForDiv /= 16} 3 -> {massForDiv /= 64} @@ -85,6 +86,13 @@ class BlockEntityBlackHole(p_155229_: BlockPos, p_155230_: BlockState) : BlockEn private var suppressUpdates = true var spin_direction = false + private var sleepTicks = 4 + + override fun setLevel(p_155231_: Level) { + super.setLevel(p_155231_) + sleepTicks = 4 + } + private val stabilizers = ArrayList() private var stabilizerClientCount = 0 @@ -225,6 +233,8 @@ class BlockEntityBlackHole(p_155229_: BlockPos, p_155230_: BlockState) : BlockEn } fun clientTick() { + sleepTicks-- + if (sleepTicks > 0) return val ply = Minecraft.getInstance().player!! val center = Vec3.atCenterOf(blockPos) @@ -240,7 +250,9 @@ class BlockEntityBlackHole(p_155229_: BlockPos, p_155230_: BlockState) : BlockEn } fun tick() { - val level = level as ServerLevel + sleepTicks-- + if (sleepTicks > 0) return + val level = level as? ServerLevel ?: return suppressUpdates = false val center = Vec3.atCenterOf(blockPos)