diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/clock/CuckooClockRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/clock/CuckooClockRenderer.java index 443c00b11..935baf026 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/clock/CuckooClockRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/clock/CuckooClockRenderer.java @@ -14,7 +14,6 @@ import com.simibubi.create.foundation.utility.AngleHelper; import net.minecraft.block.BlockState; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.util.Direction; import net.minecraft.util.math.MathHelper; @@ -34,7 +33,6 @@ public class CuckooClockRenderer extends KineticTileEntityRenderer { CuckooClockTileEntity clock = (CuckooClockTileEntity) te; BlockState blockState = te.getBlockState(); - int packedLightmapCoords = WorldRenderer.getLightColor(te.getLevel(), blockState, te.getBlockPos()); Direction direction = blockState.getValue(CuckooClockBlock.HORIZONTAL_FACING); IVertexBuilder vb = buffer.getBuffer(RenderType.solid()); @@ -44,9 +42,9 @@ public class CuckooClockRenderer extends KineticTileEntityRenderer { SuperByteBuffer minuteHand = PartialBufferer.get(AllBlockPartials.CUCKOO_MINUTE_HAND, blockState); float hourAngle = clock.hourHand.get(partialTicks); float minuteAngle = clock.minuteHand.get(partialTicks); - rotateHand(hourHand, hourAngle, direction).light(packedLightmapCoords) + rotateHand(hourHand, hourAngle, direction).light(light) .renderInto(ms, vb); - rotateHand(minuteHand, minuteAngle, direction).light(packedLightmapCoords) + rotateHand(minuteHand, minuteAngle, direction).light(light) .renderInto(ms, vb); // Doors @@ -72,9 +70,9 @@ public class CuckooClockRenderer extends KineticTileEntityRenderer { } } - rotateDoor(leftDoor, angle, true, direction).light(packedLightmapCoords) + rotateDoor(leftDoor, angle, true, direction).light(light) .renderInto(ms, vb); - rotateDoor(rightDoor, angle, false, direction).light(packedLightmapCoords) + rotateDoor(rightDoor, angle, false, direction).light(light) .renderInto(ms, vb); // Figure @@ -85,7 +83,7 @@ public class CuckooClockRenderer extends KineticTileEntityRenderer { PartialBufferer.get(partialModel, blockState); figure.rotateCentered(Direction.UP, AngleHelper.rad(AngleHelper.horizontalAngle(direction.getCounterClockWise()))); figure.translate(offset, 0, 0); - figure.light(packedLightmapCoords) + figure.light(light) .renderInto(ms, vb); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterRenderer.java index 82858218e..d589cd999 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterRenderer.java @@ -22,7 +22,6 @@ import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.item.ItemStack; @@ -169,41 +168,39 @@ public class MechanicalCrafterRenderer extends SafeTileEntityRenderer { @@ -117,16 +115,17 @@ public class DeployerRenderer extends SafeTileEntityRenderer } BlockState blockState = te.getBlockState(); - BlockPos pos = te.getBlockPos(); Vector3d offset = getHandOffset(te, partialTicks, blockState); SuperByteBuffer pole = PartialBufferer.get(AllBlockPartials.DEPLOYER_POLE, blockState); SuperByteBuffer hand = PartialBufferer.get(te.getHandPose(), blockState); - transform(te.getLevel(), pole.translate(offset.x, offset.y, offset.z), blockState, pos, true).renderInto(ms, - vb); - transform(te.getLevel(), hand.translate(offset.x, offset.y, offset.z), blockState, pos, false).renderInto(ms, - vb); + transform(pole.translate(offset.x, offset.y, offset.z), blockState, true) + .light(light) + .renderInto(ms, vb); + transform(hand.translate(offset.x, offset.y, offset.z), blockState, false) + .light(light) + .renderInto(ms, vb); } protected Vector3d getHandOffset(DeployerTileEntity te, float partialTicks, BlockState blockState) { @@ -138,8 +137,7 @@ public class DeployerRenderer extends SafeTileEntityRenderer return KineticTileEntityRenderer.shaft(KineticTileEntityRenderer.getRotationAxisOf(te)); } - private static SuperByteBuffer transform(World world, SuperByteBuffer buffer, BlockState deployerState, - BlockPos pos, boolean axisDirectionMatters) { + private static SuperByteBuffer transform(SuperByteBuffer buffer, BlockState deployerState, boolean axisDirectionMatters) { Direction facing = deployerState.getValue(FACING); float zRotLast = @@ -151,7 +149,6 @@ public class DeployerRenderer extends SafeTileEntityRenderer buffer.rotateCentered(Direction.SOUTH, (float) ((zRot) / 180 * Math.PI)); buffer.rotateCentered(Direction.UP, (float) ((yRot) / 180 * Math.PI)); buffer.rotateCentered(Direction.SOUTH, (float) ((zRotLast) / 180 * Math.PI)); - buffer.light(WorldRenderer.getLightColor(world, deployerState, pos)); return buffer; } @@ -159,9 +156,7 @@ public class DeployerRenderer extends SafeTileEntityRenderer ContraptionMatrices matrices, IRenderTypeBuffer buffer) { IVertexBuilder builder = buffer.getBuffer(RenderType.solid()); BlockState blockState = context.state; - BlockPos pos = BlockPos.ZERO; Mode mode = NBTHelper.readEnum(context.tileData, "Mode", Mode.class); - World world = context.world; PartialModel handPose = getHandPose(mode); SuperByteBuffer pole = PartialBufferer.get(AllBlockPartials.DEPLOYER_POLE, blockState); @@ -187,8 +182,8 @@ public class DeployerRenderer extends SafeTileEntityRenderer pole.transform(m); hand.transform(m); - pole = transform(world, pole, blockState, pos, true); - hand = transform(world, hand, blockState, pos, false); + pole = transform(pole, blockState, true); + hand = transform(hand, blockState, false); pole.light(matrices.getWorld(), ContraptionRenderDispatcher.getContraptionWorldLight(context, renderWorld)) .renderInto(matrices.getViewProjection(), builder); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineRenderer.java index 0d09715ae..a91ba53d3 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineRenderer.java @@ -10,7 +10,6 @@ import com.simibubi.create.foundation.utility.AngleHelper; import net.minecraft.block.Block; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.util.Direction; @@ -38,7 +37,7 @@ public class EngineRenderer extends SafeTileEntityRe PartialBufferer.get(frame, te.getBlockState()) .rotateCentered(Direction.UP, angle) .translate(0, 0, -1) - .light(WorldRenderer.getLightColor(te.getLevel(), te.getBlockState(), te.getBlockPos())) + .light(light) .renderInto(ms, buffer.getBuffer(RenderType.solid())); } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerRenderer.java index 6da31b2e5..61873ce38 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerRenderer.java @@ -13,10 +13,8 @@ import com.simibubi.create.foundation.utility.AnimationTickHolder; import net.minecraft.block.BlockState; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.util.Direction; -import net.minecraft.util.math.BlockPos; public class MechanicalMixerRenderer extends KineticTileEntityRenderer { @@ -37,14 +35,12 @@ public class MechanicalMixerRenderer extends KineticTileEntityRenderer { BlockState blockState = te.getBlockState(); MechanicalMixerTileEntity mixer = (MechanicalMixerTileEntity) te; - BlockPos pos = te.getBlockPos(); IVertexBuilder vb = buffer.getBuffer(RenderType.solid()); SuperByteBuffer superBuffer = PartialBufferer.get(AllBlockPartials.SHAFTLESS_COGWHEEL, blockState); standardKineticRotationTransform(superBuffer, te, light).renderInto(ms, vb); - int packedLightmapCoords = WorldRenderer.getLightColor(te.getLevel(), blockState, pos); float renderedHeadOffset = mixer.getRenderedHeadOffset(partialTicks); float speed = mixer.getRenderedHeadRotationSpeed(partialTicks); float time = AnimationTickHolder.getRenderTime(te.getLevel()); @@ -52,13 +48,13 @@ public class MechanicalMixerRenderer extends KineticTileEntityRenderer { SuperByteBuffer poleRender = PartialBufferer.get(AllBlockPartials.MECHANICAL_MIXER_POLE, blockState); poleRender.translate(0, -renderedHeadOffset, 0) - .light(packedLightmapCoords) + .light(light) .renderInto(ms, vb); SuperByteBuffer headRender = PartialBufferer.get(AllBlockPartials.MECHANICAL_MIXER_HEAD, blockState); headRender.rotateCentered(Direction.UP, angle) .translate(0, -renderedHeadOffset, 0) - .light(packedLightmapCoords) + .light(light) .renderInto(ms, vb); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/press/MechanicalPressRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/press/MechanicalPressRenderer.java index 731294f2c..a310c7c1d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/press/MechanicalPressRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/press/MechanicalPressRenderer.java @@ -13,9 +13,7 @@ import com.simibubi.create.foundation.render.SuperByteBuffer; import net.minecraft.block.BlockState; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; -import net.minecraft.util.math.BlockPos; public class MechanicalPressRenderer extends KineticTileEntityRenderer { @@ -35,14 +33,12 @@ public class MechanicalPressRenderer extends KineticTileEntityRenderer { if (Backend.getInstance().canUseInstancing(te.getLevel())) return; - BlockPos pos = te.getBlockPos(); BlockState blockState = te.getBlockState(); - int packedLightmapCoords = WorldRenderer.getLightColor(te.getLevel(), blockState, pos); float renderedHeadOffset = ((MechanicalPressTileEntity) te).getRenderedHeadOffset(partialTicks); SuperByteBuffer headRender = PartialBufferer.getFacing(AllBlockPartials.MECHANICAL_PRESS_HEAD, blockState, blockState.getValue(HORIZONTAL_FACING)); headRender.translate(0, -renderedHeadOffset, 0) - .light(packedLightmapCoords) + .light(light) .renderInto(ms, buffer.getBuffer(RenderType.solid())); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionRenderInfo.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionRenderInfo.java index 6bc36792d..2b628393e 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionRenderInfo.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionRenderInfo.java @@ -13,7 +13,7 @@ public class ContraptionRenderInfo { public final Contraption contraption; public final PlacementSimulationWorld renderWorld; - private ContraptionMatrices matrices = new ContraptionMatrices(); + private final ContraptionMatrices matrices = new ContraptionMatrices(); private boolean visible; public ContraptionRenderInfo(Contraption contraption, PlacementSimulationWorld renderWorld) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeRenderer.java index 182c75728..ebd9bfad8 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeRenderer.java @@ -15,7 +15,6 @@ import com.simibubi.create.foundation.utility.Iterate; import net.minecraft.block.BlockState; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.util.Direction; import net.minecraft.util.math.MathHelper; @@ -43,9 +42,9 @@ public class GaugeRenderer extends KineticTileEntityRenderer { if (Backend.getInstance().canUseInstancing(te.getLevel())) return; super.renderSafe(te, partialTicks, ms, buffer, light, overlay); + BlockState gaugeState = te.getBlockState(); GaugeTileEntity gaugeTE = (GaugeTileEntity) te; - int lightCoords = WorldRenderer.getLightColor(te.getLevel(), gaugeState, te.getBlockPos()); PartialModel partialModel = (type == Type.SPEED ? AllBlockPartials.GAUGE_HEAD_SPEED : AllBlockPartials.GAUGE_HEAD_STRESS); SuperByteBuffer headBuffer = @@ -64,12 +63,11 @@ public class GaugeRenderer extends KineticTileEntityRenderer { rotateBufferTowards(dialBuffer, facing).translate(0, dialPivot, dialPivot) .rotate(Direction.EAST, (float) (Math.PI / 2 * -progress)) .translate(0, -dialPivot, -dialPivot) - .light(lightCoords) + .light(light) .renderInto(ms, vb); - rotateBufferTowards(headBuffer, facing).light(lightCoords) + rotateBufferTowards(headBuffer, facing).light(light) .renderInto(ms, vb); } - } @Override diff --git a/src/main/java/com/simibubi/create/content/curiosities/bell/BellRenderer.java b/src/main/java/com/simibubi/create/content/curiosities/bell/BellRenderer.java index 37d12a927..c32fce701 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/bell/BellRenderer.java +++ b/src/main/java/com/simibubi/create/content/curiosities/bell/BellRenderer.java @@ -1,7 +1,6 @@ package com.simibubi.create.content.curiosities.bell; import com.mojang.blaze3d.matrix.MatrixStack; -import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.foundation.render.PartialBufferer; import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer; @@ -11,7 +10,6 @@ import net.minecraft.block.BellBlock; import net.minecraft.block.BlockState; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.state.properties.BellAttachment; import net.minecraft.util.Direction; @@ -39,9 +37,8 @@ public class BellRenderer extends SafeTileEnt rY += 90; bell.rotateCentered(Direction.UP, AngleHelper.rad(rY)); - IVertexBuilder vb = buffer.getBuffer(RenderType.cutout()); - int lightCoords = WorldRenderer.getLightColor(te.getLevel(), state, te.getBlockPos()); - bell.light(lightCoords).renderInto(ms, vb); + bell.light(light) + .renderInto(ms, buffer.getBuffer(RenderType.cutout())); } public static float getSwingAngle(float time) { diff --git a/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverRenderer.java b/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverRenderer.java index 01e3d5d05..24e387780 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverRenderer.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverRenderer.java @@ -13,7 +13,6 @@ import com.simibubi.create.foundation.utility.ColorHelper; import net.minecraft.block.BlockState; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.state.properties.AttachFace; import net.minecraft.util.Direction; @@ -31,7 +30,6 @@ public class AnalogLeverRenderer extends SafeTileEntityRenderer