From 91dbb3e587335cf3dd7a0da83e25726f27eb862d Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Fri, 5 Jan 2024 22:13:22 +0700 Subject: [PATCH] Fix microwave oven render not account for rotation and yRotationNorth being wrong --- .../client/render/blockentity/PoweredSmokerRenderer.kt | 5 +++++ .../kotlin/ru/dbotthepony/mc/otm/core/math/EuclidMath.kt | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/PoweredSmokerRenderer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/PoweredSmokerRenderer.kt index 5790041a7..228fd4b52 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/PoweredSmokerRenderer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/PoweredSmokerRenderer.kt @@ -8,6 +8,8 @@ import net.minecraft.world.item.ItemDisplayContext import ru.dbotthepony.mc.otm.block.entity.tech.AbstractPoweredFurnaceBlockEntity import ru.dbotthepony.mc.otm.core.math.normalizeAngle import ru.dbotthepony.mc.otm.core.math.rotateY +import ru.dbotthepony.mc.otm.core.math.yRotationNorth +import ru.dbotthepony.mc.otm.core.math.yRotationSouth class PoweredSmokerRenderer(private val context: BlockEntityRendererProvider.Context) : BlockEntityRenderer> { override fun render(tile: AbstractPoweredFurnaceBlockEntity<*, *>, partialTick: Float, pose: PoseStack, buffers: MultiBufferSource, packedLight: Int, packedOverlay: Int) { @@ -19,6 +21,9 @@ class PoweredSmokerRenderer(private val context: BlockEntityRendererProvider.Con slot.visualRotation = normalizeAngle(slot.visualRotation + diff / 400_000_000f) pose.pushPose() + pose.translate(0.5f, 0.5f, 0.5f) + pose.rotateY(tile.blockRotation.front.yRotationNorth()) + pose.translate(-0.5f, -0.5f, -0.5f) pose.translate(0.625f, 0.5f, 0.5f) pose.scale(0.25f, 0.25f, 0.25f) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/core/math/EuclidMath.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/core/math/EuclidMath.kt index 2f3602cd2..15c0ac5fe 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/core/math/EuclidMath.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/core/math/EuclidMath.kt @@ -679,8 +679,8 @@ fun Direction.yRotationNorth(): Float { return when (this) { Direction.DOWN, Direction.UP, Direction.NORTH -> 0f Direction.SOUTH -> PIf - Direction.WEST -> -PIf / 2f - Direction.EAST -> PIf / 2f + Direction.WEST -> PIf / 2f + Direction.EAST -> -PIf / 2f } } @@ -688,8 +688,8 @@ fun Direction.yRotationSouth(): Float { return when (this) { Direction.DOWN, Direction.UP, Direction.SOUTH -> 0f Direction.NORTH -> PIf - Direction.WEST -> PIf / 2f - Direction.EAST -> -PIf / 2f + Direction.WEST -> -PIf / 2f + Direction.EAST -> PIf / 2f } }