From a52b60620872cfee9510027b425be1b55c093726 Mon Sep 17 00:00:00 2001 From: JozsefA Date: Tue, 5 Jan 2021 14:49:23 -0800 Subject: [PATCH] all belts render correctly --- .../contraptions/relays/belt/BeltRenderer.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltRenderer.java index da427d1b2..db1285a9a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltRenderer.java @@ -64,10 +64,11 @@ public class BeltRenderer extends SafeTileEntityRenderer { boolean start = part == BeltPart.START; boolean end = part == BeltPart.END; boolean sideways = beltSlope == BeltSlope.SIDEWAYS; + boolean vertical = beltSlope == BeltSlope.VERTICAL; boolean alongX = facing.getAxis() == Axis.X; boolean alongZ = facing.getAxis() == Axis.Z; - if (downward || beltSlope == BeltSlope.VERTICAL && axisDirection == AxisDirection.POSITIVE) { + if (downward || vertical && axisDirection == AxisDirection.POSITIVE) { boolean b = start; start = end; end = b; @@ -90,16 +91,17 @@ public class BeltRenderer extends SafeTileEntityRenderer { beltBuffer.setupInstance(data -> { float speed = te.getSpeed(); - if (((axisDirection == AxisDirection.NEGATIVE) ^ upward) ^ ((alongX && !diagonal) || (alongZ && diagonal))) + if (((axisDirection == AxisDirection.NEGATIVE) ^ upward) ^ + ((alongX && !diagonal) || (alongZ && diagonal)) ^ + vertical) speed = -speed; - float horizontalAngle = facing.getHorizontalAngle(); + float rotX = !diagonal && beltSlope != BeltSlope.HORIZONTAL ? 90 : 0; + float rotY = facing.getHorizontalAngle() + (upward ? 180 : 0) + (sideways ? 270 : 0); + float rotZ = sideways ? 90 : (vertical ? 180 : 0); + data.setPosition(te.getPos()) - .setRotation( - !diagonal && beltSlope != BeltSlope.HORIZONTAL ? 90 : 0, - horizontalAngle + (upward ? 180 : 0) + (sideways ? 270 : 0), - sideways ? 90 : 0 - ) + .setRotation(rotX, rotY, rotZ) .setPackedLight(light) .setRotationalSpeed(speed) .setScrollTexture(spriteShift)