Make black hole tick method sleep for 4 ticks on creation
This commit is contained in:
parent
67cd8dd03a
commit
c5f0a35619
@ -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<BlockEntityGravitationStabilizer>()
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user