diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityGravitationStabilizer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityGravitationStabilizer.kt index 504e70915..70604bfcc 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityGravitationStabilizer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityGravitationStabilizer.kt @@ -32,8 +32,20 @@ class BlockEntityGravitationStabilizer(p_155229_: BlockPos, p_155230_: BlockStat val state = chunk.getBlockState(pos) if (!state.isAir) { - findBlackHole = chunk.getBlockEntity(pos) as? BlockEntityBlackHole ?: break - break + val tile = chunk.getBlockEntity(pos) + + if (tile != null && tile !is BlockEntityBlackHole) { + break + } + + if (tile != null && tile is BlockEntityBlackHole) { + findBlackHole = tile + break + } + + if (state.isViewBlocking(level, pos)) { + break + } } } 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 98e879c36..7f5fd9634 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 @@ -24,11 +24,11 @@ import ru.dbotthepony.mc.otm.Registry import ru.dbotthepony.mc.otm.block.BlockBlackHole import ru.dbotthepony.mc.otm.block.entity.BlockEntityGravitationStabilizer import ru.dbotthepony.mc.otm.block.entity.blackhole.ExplosionQueue.Companion.queueForLevel -import ru.dbotthepony.mc.otm.core.* +import ru.dbotthepony.mc.otm.core.Fraction +import ru.dbotthepony.mc.otm.core.plus import ru.dbotthepony.mc.otm.matter.MatterRegistry import ru.dbotthepony.mc.otm.set import kotlin.math.roundToInt -import kotlin.math.sin import kotlin.math.sqrt class BlockEntityBlackHole(p_155229_: BlockPos, p_155230_: BlockState) : BlockEntity(Registry.BlockEntities.BLACK_HOLE, p_155229_, p_155230_) { @@ -239,8 +239,6 @@ class BlockEntityBlackHole(p_155229_: BlockPos, p_155230_: BlockState) : BlockEn val level = level as ServerLevel suppressUpdates = false - //mass = Fraction(20_000 * sin(System.currentTimeMillis().toDouble() / 1000.0) + 10_000) - val center = Vec3.atCenterOf(blockPos) for (living in level.getEntitiesOfClass(LivingEntity::class.java, affectedBoundsAABB)) {