Fix blackhole and grav stabilizer render getting cutoff

This commit is contained in:
DBotThePony 2022-01-20 11:23:28 +07:00
parent 1b4cf9498a
commit 784c57d9eb
Signed by: DBot
GPG Key ID: DCC23B5715498507
3 changed files with 12 additions and 0 deletions

View File

@ -8,11 +8,13 @@ import net.minecraft.world.entity.player.Player
import net.minecraft.world.level.Level
import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.phys.AABB
import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.Registry
import ru.dbotthepony.mc.otm.block.BlockMatteryRotatable
import ru.dbotthepony.mc.otm.block.entity.blackhole.BlockEntityBlackHole
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
import ru.dbotthepony.mc.otm.core.minus
import ru.dbotthepony.mc.otm.core.plus
import ru.dbotthepony.mc.otm.core.times
@ -62,7 +64,12 @@ class BlockEntityGravitationStabilizer(p_155229_: BlockPos, p_155230_: BlockStat
blackHole?.stabilizerDetached(this)
}
override fun getRenderBoundingBox(): AABB {
return AABB(blockPos.offset(-RANGE, -RANGE, -RANGE), blockPos.offset(RANGE, RANGE, RANGE))
}
companion object {
private val minBBox = BlockPos(1, 1, 1)
const val RANGE = 64
private val NAME = TranslatableComponent("block.overdrive_that_matters.gravitation_stabilizer")
}

View File

@ -75,6 +75,10 @@ class BlockEntityBlackHole(p_155229_: BlockPos, p_155230_: BlockState) : BlockEn
affectedBoundsAABB = AABB.of(affectedBounds)
}
override fun getRenderBoundingBox(): AABB {
return AABB(blockPos.offset(-BlockEntityGravitationStabilizer.RANGE, -BlockEntityGravitationStabilizer.RANGE, -BlockEntityGravitationStabilizer.RANGE), blockPos.offset(BlockEntityGravitationStabilizer.RANGE, BlockEntityGravitationStabilizer.RANGE, BlockEntityGravitationStabilizer.RANGE))
}
var gravitationStrength = 1.0
private set

View File

@ -84,6 +84,7 @@ class GravitationStabilizerRenderer(private val context: BlockEntityRendererProv
}
override fun shouldRenderOffScreen(p_112306_: BlockEntityGravitationStabilizer) = true
override fun getViewDistance() = 96
companion object {
private val OUTER_COLOR = RGBAColor(140, 140, 255, 110)