From d1dccffc67db8535d90faaefe2001cbd61104379 Mon Sep 17 00:00:00 2001 From: JozsefA Date: Tue, 12 Jan 2021 12:12:44 -0800 Subject: [PATCH] fix fan shaft lighting --- .../components/fan/EncasedFanRenderer.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanRenderer.java index cd624dcfe..62ca3e645 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanRenderer.java @@ -41,7 +41,24 @@ public class EncasedFanRenderer extends KineticTileEntityRenderer { InstanceBuffer fanInner = AllBlockPartials.ENCASED_FAN_INNER.renderOnDirectionalSouthRotating(ctx, te.getBlockState(), direction.getOpposite()); - renderRotatingBuffer(ctx, shaftHalf); + shaftHalf.setupInstance(data -> { + final BlockPos pos = te.getPos(); + Direction.Axis axis = ((IRotate) te.getBlockState() + .getBlock()).getRotationAxis(te.getBlockState()); + data.setRotationalSpeed(te.getSpeed()) + .setRotationOffset(getRotationOffsetForPosition(te, pos, axis)) + .setRotationAxis(Direction.getFacingFromAxis(Direction.AxisDirection.POSITIVE, axis).getUnitVector()) + .setTileEntity(te); + + if (ctx.checkWorldLight()) { + BlockPos behind = te.getPos().offset(direction.getOpposite()); + int blockLight = te.getWorld().getLightLevel(LightType.BLOCK, behind); + int skyLight = te.getWorld().getLightLevel(LightType.SKY, behind); + + data.setBlockLight(blockLight) + .setSkyLight(skyLight); + } + }); fanInner.setupInstance(data -> { final BlockPos pos = te.getPos(); Direction.Axis axis = ((IRotate) te.getBlockState()