Dont get gravitation stabilizer get blocked by stuff

This commit is contained in:
DBotThePony 2022-01-14 20:45:53 +07:00
parent 23df86e2f6
commit f95d22ebff
Signed by: DBot
GPG Key ID: DCC23B5715498507
2 changed files with 16 additions and 6 deletions

View File

@ -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
}
}
}

View File

@ -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)) {