Remove legacy TER light code

- TERs now pass in the light, so no need to recalculate it
- Make ContraptionRenderInfo.matrices final
This commit is contained in:
PepperBell 2021-08-05 22:35:24 -07:00
parent 333ef9ecbb
commit b19d92f6c2
10 changed files with 35 additions and 61 deletions

View file

@ -14,7 +14,6 @@ import com.simibubi.create.foundation.utility.AngleHelper;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
@ -34,7 +33,6 @@ public class CuckooClockRenderer extends KineticTileEntityRenderer {
CuckooClockTileEntity clock = (CuckooClockTileEntity) te; CuckooClockTileEntity clock = (CuckooClockTileEntity) te;
BlockState blockState = te.getBlockState(); BlockState blockState = te.getBlockState();
int packedLightmapCoords = WorldRenderer.getLightColor(te.getLevel(), blockState, te.getBlockPos());
Direction direction = blockState.getValue(CuckooClockBlock.HORIZONTAL_FACING); Direction direction = blockState.getValue(CuckooClockBlock.HORIZONTAL_FACING);
IVertexBuilder vb = buffer.getBuffer(RenderType.solid()); IVertexBuilder vb = buffer.getBuffer(RenderType.solid());
@ -44,9 +42,9 @@ public class CuckooClockRenderer extends KineticTileEntityRenderer {
SuperByteBuffer minuteHand = PartialBufferer.get(AllBlockPartials.CUCKOO_MINUTE_HAND, blockState); SuperByteBuffer minuteHand = PartialBufferer.get(AllBlockPartials.CUCKOO_MINUTE_HAND, blockState);
float hourAngle = clock.hourHand.get(partialTicks); float hourAngle = clock.hourHand.get(partialTicks);
float minuteAngle = clock.minuteHand.get(partialTicks); float minuteAngle = clock.minuteHand.get(partialTicks);
rotateHand(hourHand, hourAngle, direction).light(packedLightmapCoords) rotateHand(hourHand, hourAngle, direction).light(light)
.renderInto(ms, vb); .renderInto(ms, vb);
rotateHand(minuteHand, minuteAngle, direction).light(packedLightmapCoords) rotateHand(minuteHand, minuteAngle, direction).light(light)
.renderInto(ms, vb); .renderInto(ms, vb);
// Doors // 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); .renderInto(ms, vb);
rotateDoor(rightDoor, angle, false, direction).light(packedLightmapCoords) rotateDoor(rightDoor, angle, false, direction).light(light)
.renderInto(ms, vb); .renderInto(ms, vb);
// Figure // Figure
@ -85,7 +83,7 @@ public class CuckooClockRenderer extends KineticTileEntityRenderer {
PartialBufferer.get(partialModel, blockState); PartialBufferer.get(partialModel, blockState);
figure.rotateCentered(Direction.UP, AngleHelper.rad(AngleHelper.horizontalAngle(direction.getCounterClockWise()))); figure.rotateCentered(Direction.UP, AngleHelper.rad(AngleHelper.horizontalAngle(direction.getCounterClockWise())));
figure.translate(offset, 0, 0); figure.translate(offset, 0, 0);
figure.light(packedLightmapCoords) figure.light(light)
.renderInto(ms, vb); .renderInto(ms, vb);
} }

View file

@ -22,7 +22,6 @@ import net.minecraft.block.BlockState;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderType; 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.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -169,41 +168,39 @@ public class MechanicalCrafterRenderer extends SafeTileEntityRenderer<Mechanical
if ((te.covered || te.phase != Phase.IDLE) && te.phase != Phase.CRAFTING && te.phase != Phase.INSERTING) { if ((te.covered || te.phase != Phase.IDLE) && te.phase != Phase.CRAFTING && te.phase != Phase.INSERTING) {
SuperByteBuffer lidBuffer = SuperByteBuffer lidBuffer =
renderAndTransform(te, AllBlockPartials.MECHANICAL_CRAFTER_LID, blockState, pos); renderAndTransform(AllBlockPartials.MECHANICAL_CRAFTER_LID, blockState);
lidBuffer.renderInto(ms, vb); lidBuffer.light(light).renderInto(ms, vb);
} }
if (MechanicalCrafterBlock.isValidTarget(te.getLevel(), pos.relative(targetDirection), blockState)) { if (MechanicalCrafterBlock.isValidTarget(te.getLevel(), pos.relative(targetDirection), blockState)) {
SuperByteBuffer beltBuffer = SuperByteBuffer beltBuffer =
renderAndTransform(te, AllBlockPartials.MECHANICAL_CRAFTER_BELT, blockState, pos); renderAndTransform(AllBlockPartials.MECHANICAL_CRAFTER_BELT, blockState);
SuperByteBuffer beltFrameBuffer = SuperByteBuffer beltFrameBuffer =
renderAndTransform(te, AllBlockPartials.MECHANICAL_CRAFTER_BELT_FRAME, blockState, pos); renderAndTransform(AllBlockPartials.MECHANICAL_CRAFTER_BELT_FRAME, blockState);
if (te.phase == Phase.EXPORTING) { if (te.phase == Phase.EXPORTING) {
int textureIndex = (int) ((te.getCountDownSpeed() / 128f * AnimationTickHolder.getTicks())); int textureIndex = (int) ((te.getCountDownSpeed() / 128f * AnimationTickHolder.getTicks()));
beltBuffer.shiftUVtoSheet(AllSpriteShifts.CRAFTER_THINGIES, (textureIndex % 4) / 4f, 0, 1); beltBuffer.shiftUVtoSheet(AllSpriteShifts.CRAFTER_THINGIES, (textureIndex % 4) / 4f, 0, 1);
} }
beltBuffer.renderInto(ms, vb); beltBuffer.light(light).renderInto(ms, vb);
beltFrameBuffer.renderInto(ms, vb); beltFrameBuffer.light(light).renderInto(ms, vb);
} else { } else {
SuperByteBuffer arrowBuffer = SuperByteBuffer arrowBuffer =
renderAndTransform(te, AllBlockPartials.MECHANICAL_CRAFTER_ARROW, blockState, pos); renderAndTransform(AllBlockPartials.MECHANICAL_CRAFTER_ARROW, blockState);
arrowBuffer.renderInto(ms, vb); arrowBuffer.light(light).renderInto(ms, vb);
} }
} }
private SuperByteBuffer renderAndTransform(MechanicalCrafterTileEntity te, PartialModel renderBlock, private SuperByteBuffer renderAndTransform(PartialModel renderBlock, BlockState crafterState) {
BlockState crafterState, BlockPos pos) {
SuperByteBuffer buffer = PartialBufferer.get(renderBlock, crafterState); SuperByteBuffer buffer = PartialBufferer.get(renderBlock, crafterState);
float xRot = crafterState.getValue(MechanicalCrafterBlock.POINTING) float xRot = crafterState.getValue(MechanicalCrafterBlock.POINTING)
.getXRotation(); .getXRotation();
float yRot = AngleHelper.horizontalAngle(crafterState.getValue(HORIZONTAL_FACING)); float yRot = AngleHelper.horizontalAngle(crafterState.getValue(HORIZONTAL_FACING));
buffer.rotateCentered(Direction.UP, (float) ((yRot + 90) / 180 * Math.PI)); buffer.rotateCentered(Direction.UP, (float) ((yRot + 90) / 180 * Math.PI));
buffer.rotateCentered(Direction.EAST, (float) ((xRot) / 180 * Math.PI)); buffer.rotateCentered(Direction.EAST, (float) ((xRot) / 180 * Math.PI));
buffer.light(WorldRenderer.getLightColor(te.getLevel(), crafterState, pos));
return buffer; return buffer;
} }

View file

@ -29,7 +29,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.RenderType; 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.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.item.BlockItem; import net.minecraft.item.BlockItem;
@ -39,7 +38,6 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.math.vector.Vector3f; import net.minecraft.util.math.vector.Vector3f;
import net.minecraft.world.World;
public class DeployerRenderer extends SafeTileEntityRenderer<DeployerTileEntity> { public class DeployerRenderer extends SafeTileEntityRenderer<DeployerTileEntity> {
@ -117,16 +115,17 @@ public class DeployerRenderer extends SafeTileEntityRenderer<DeployerTileEntity>
} }
BlockState blockState = te.getBlockState(); BlockState blockState = te.getBlockState();
BlockPos pos = te.getBlockPos();
Vector3d offset = getHandOffset(te, partialTicks, blockState); Vector3d offset = getHandOffset(te, partialTicks, blockState);
SuperByteBuffer pole = PartialBufferer.get(AllBlockPartials.DEPLOYER_POLE, blockState); SuperByteBuffer pole = PartialBufferer.get(AllBlockPartials.DEPLOYER_POLE, blockState);
SuperByteBuffer hand = PartialBufferer.get(te.getHandPose(), blockState); SuperByteBuffer hand = PartialBufferer.get(te.getHandPose(), blockState);
transform(te.getLevel(), pole.translate(offset.x, offset.y, offset.z), blockState, pos, true).renderInto(ms, transform(pole.translate(offset.x, offset.y, offset.z), blockState, true)
vb); .light(light)
transform(te.getLevel(), hand.translate(offset.x, offset.y, offset.z), blockState, pos, false).renderInto(ms, .renderInto(ms, vb);
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) { protected Vector3d getHandOffset(DeployerTileEntity te, float partialTicks, BlockState blockState) {
@ -138,8 +137,7 @@ public class DeployerRenderer extends SafeTileEntityRenderer<DeployerTileEntity>
return KineticTileEntityRenderer.shaft(KineticTileEntityRenderer.getRotationAxisOf(te)); return KineticTileEntityRenderer.shaft(KineticTileEntityRenderer.getRotationAxisOf(te));
} }
private static SuperByteBuffer transform(World world, SuperByteBuffer buffer, BlockState deployerState, private static SuperByteBuffer transform(SuperByteBuffer buffer, BlockState deployerState, boolean axisDirectionMatters) {
BlockPos pos, boolean axisDirectionMatters) {
Direction facing = deployerState.getValue(FACING); Direction facing = deployerState.getValue(FACING);
float zRotLast = float zRotLast =
@ -151,7 +149,6 @@ public class DeployerRenderer extends SafeTileEntityRenderer<DeployerTileEntity>
buffer.rotateCentered(Direction.SOUTH, (float) ((zRot) / 180 * Math.PI)); buffer.rotateCentered(Direction.SOUTH, (float) ((zRot) / 180 * Math.PI));
buffer.rotateCentered(Direction.UP, (float) ((yRot) / 180 * Math.PI)); buffer.rotateCentered(Direction.UP, (float) ((yRot) / 180 * Math.PI));
buffer.rotateCentered(Direction.SOUTH, (float) ((zRotLast) / 180 * Math.PI)); buffer.rotateCentered(Direction.SOUTH, (float) ((zRotLast) / 180 * Math.PI));
buffer.light(WorldRenderer.getLightColor(world, deployerState, pos));
return buffer; return buffer;
} }
@ -159,9 +156,7 @@ public class DeployerRenderer extends SafeTileEntityRenderer<DeployerTileEntity>
ContraptionMatrices matrices, IRenderTypeBuffer buffer) { ContraptionMatrices matrices, IRenderTypeBuffer buffer) {
IVertexBuilder builder = buffer.getBuffer(RenderType.solid()); IVertexBuilder builder = buffer.getBuffer(RenderType.solid());
BlockState blockState = context.state; BlockState blockState = context.state;
BlockPos pos = BlockPos.ZERO;
Mode mode = NBTHelper.readEnum(context.tileData, "Mode", Mode.class); Mode mode = NBTHelper.readEnum(context.tileData, "Mode", Mode.class);
World world = context.world;
PartialModel handPose = getHandPose(mode); PartialModel handPose = getHandPose(mode);
SuperByteBuffer pole = PartialBufferer.get(AllBlockPartials.DEPLOYER_POLE, blockState); SuperByteBuffer pole = PartialBufferer.get(AllBlockPartials.DEPLOYER_POLE, blockState);
@ -187,8 +182,8 @@ public class DeployerRenderer extends SafeTileEntityRenderer<DeployerTileEntity>
pole.transform(m); pole.transform(m);
hand.transform(m); hand.transform(m);
pole = transform(world, pole, blockState, pos, true); pole = transform(pole, blockState, true);
hand = transform(world, hand, blockState, pos, false); hand = transform(hand, blockState, false);
pole.light(matrices.getWorld(), ContraptionRenderDispatcher.getContraptionWorldLight(context, renderWorld)) pole.light(matrices.getWorld(), ContraptionRenderDispatcher.getContraptionWorldLight(context, renderWorld))
.renderInto(matrices.getViewProjection(), builder); .renderInto(matrices.getViewProjection(), builder);

View file

@ -10,7 +10,6 @@ import com.simibubi.create.foundation.utility.AngleHelper;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
@ -38,7 +37,7 @@ public class EngineRenderer<T extends EngineTileEntity> extends SafeTileEntityRe
PartialBufferer.get(frame, te.getBlockState()) PartialBufferer.get(frame, te.getBlockState())
.rotateCentered(Direction.UP, angle) .rotateCentered(Direction.UP, angle)
.translate(0, 0, -1) .translate(0, 0, -1)
.light(WorldRenderer.getLightColor(te.getLevel(), te.getBlockState(), te.getBlockPos())) .light(light)
.renderInto(ms, buffer.getBuffer(RenderType.solid())); .renderInto(ms, buffer.getBuffer(RenderType.solid()));
} }
} }

View file

@ -13,10 +13,8 @@ import com.simibubi.create.foundation.utility.AnimationTickHolder;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
public class MechanicalMixerRenderer extends KineticTileEntityRenderer { public class MechanicalMixerRenderer extends KineticTileEntityRenderer {
@ -37,14 +35,12 @@ public class MechanicalMixerRenderer extends KineticTileEntityRenderer {
BlockState blockState = te.getBlockState(); BlockState blockState = te.getBlockState();
MechanicalMixerTileEntity mixer = (MechanicalMixerTileEntity) te; MechanicalMixerTileEntity mixer = (MechanicalMixerTileEntity) te;
BlockPos pos = te.getBlockPos();
IVertexBuilder vb = buffer.getBuffer(RenderType.solid()); IVertexBuilder vb = buffer.getBuffer(RenderType.solid());
SuperByteBuffer superBuffer = PartialBufferer.get(AllBlockPartials.SHAFTLESS_COGWHEEL, blockState); SuperByteBuffer superBuffer = PartialBufferer.get(AllBlockPartials.SHAFTLESS_COGWHEEL, blockState);
standardKineticRotationTransform(superBuffer, te, light).renderInto(ms, vb); standardKineticRotationTransform(superBuffer, te, light).renderInto(ms, vb);
int packedLightmapCoords = WorldRenderer.getLightColor(te.getLevel(), blockState, pos);
float renderedHeadOffset = mixer.getRenderedHeadOffset(partialTicks); float renderedHeadOffset = mixer.getRenderedHeadOffset(partialTicks);
float speed = mixer.getRenderedHeadRotationSpeed(partialTicks); float speed = mixer.getRenderedHeadRotationSpeed(partialTicks);
float time = AnimationTickHolder.getRenderTime(te.getLevel()); float time = AnimationTickHolder.getRenderTime(te.getLevel());
@ -52,13 +48,13 @@ public class MechanicalMixerRenderer extends KineticTileEntityRenderer {
SuperByteBuffer poleRender = PartialBufferer.get(AllBlockPartials.MECHANICAL_MIXER_POLE, blockState); SuperByteBuffer poleRender = PartialBufferer.get(AllBlockPartials.MECHANICAL_MIXER_POLE, blockState);
poleRender.translate(0, -renderedHeadOffset, 0) poleRender.translate(0, -renderedHeadOffset, 0)
.light(packedLightmapCoords) .light(light)
.renderInto(ms, vb); .renderInto(ms, vb);
SuperByteBuffer headRender = PartialBufferer.get(AllBlockPartials.MECHANICAL_MIXER_HEAD, blockState); SuperByteBuffer headRender = PartialBufferer.get(AllBlockPartials.MECHANICAL_MIXER_HEAD, blockState);
headRender.rotateCentered(Direction.UP, angle) headRender.rotateCentered(Direction.UP, angle)
.translate(0, -renderedHeadOffset, 0) .translate(0, -renderedHeadOffset, 0)
.light(packedLightmapCoords) .light(light)
.renderInto(ms, vb); .renderInto(ms, vb);
} }

View file

@ -13,9 +13,7 @@ import com.simibubi.create.foundation.render.SuperByteBuffer;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.util.math.BlockPos;
public class MechanicalPressRenderer extends KineticTileEntityRenderer { public class MechanicalPressRenderer extends KineticTileEntityRenderer {
@ -35,14 +33,12 @@ public class MechanicalPressRenderer extends KineticTileEntityRenderer {
if (Backend.getInstance().canUseInstancing(te.getLevel())) return; if (Backend.getInstance().canUseInstancing(te.getLevel())) return;
BlockPos pos = te.getBlockPos();
BlockState blockState = te.getBlockState(); BlockState blockState = te.getBlockState();
int packedLightmapCoords = WorldRenderer.getLightColor(te.getLevel(), blockState, pos);
float renderedHeadOffset = ((MechanicalPressTileEntity) te).getRenderedHeadOffset(partialTicks); float renderedHeadOffset = ((MechanicalPressTileEntity) te).getRenderedHeadOffset(partialTicks);
SuperByteBuffer headRender = PartialBufferer.getFacing(AllBlockPartials.MECHANICAL_PRESS_HEAD, blockState, blockState.getValue(HORIZONTAL_FACING)); SuperByteBuffer headRender = PartialBufferer.getFacing(AllBlockPartials.MECHANICAL_PRESS_HEAD, blockState, blockState.getValue(HORIZONTAL_FACING));
headRender.translate(0, -renderedHeadOffset, 0) headRender.translate(0, -renderedHeadOffset, 0)
.light(packedLightmapCoords) .light(light)
.renderInto(ms, buffer.getBuffer(RenderType.solid())); .renderInto(ms, buffer.getBuffer(RenderType.solid()));
} }

View file

@ -13,7 +13,7 @@ public class ContraptionRenderInfo {
public final Contraption contraption; public final Contraption contraption;
public final PlacementSimulationWorld renderWorld; public final PlacementSimulationWorld renderWorld;
private ContraptionMatrices matrices = new ContraptionMatrices(); private final ContraptionMatrices matrices = new ContraptionMatrices();
private boolean visible; private boolean visible;
public ContraptionRenderInfo(Contraption contraption, PlacementSimulationWorld renderWorld) { public ContraptionRenderInfo(Contraption contraption, PlacementSimulationWorld renderWorld) {

View file

@ -15,7 +15,6 @@ import com.simibubi.create.foundation.utility.Iterate;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
@ -43,9 +42,9 @@ public class GaugeRenderer extends KineticTileEntityRenderer {
if (Backend.getInstance().canUseInstancing(te.getLevel())) return; if (Backend.getInstance().canUseInstancing(te.getLevel())) return;
super.renderSafe(te, partialTicks, ms, buffer, light, overlay); super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
BlockState gaugeState = te.getBlockState(); BlockState gaugeState = te.getBlockState();
GaugeTileEntity gaugeTE = (GaugeTileEntity) te; 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); PartialModel partialModel = (type == Type.SPEED ? AllBlockPartials.GAUGE_HEAD_SPEED : AllBlockPartials.GAUGE_HEAD_STRESS);
SuperByteBuffer headBuffer = SuperByteBuffer headBuffer =
@ -64,12 +63,11 @@ public class GaugeRenderer extends KineticTileEntityRenderer {
rotateBufferTowards(dialBuffer, facing).translate(0, dialPivot, dialPivot) rotateBufferTowards(dialBuffer, facing).translate(0, dialPivot, dialPivot)
.rotate(Direction.EAST, (float) (Math.PI / 2 * -progress)) .rotate(Direction.EAST, (float) (Math.PI / 2 * -progress))
.translate(0, -dialPivot, -dialPivot) .translate(0, -dialPivot, -dialPivot)
.light(lightCoords) .light(light)
.renderInto(ms, vb); .renderInto(ms, vb);
rotateBufferTowards(headBuffer, facing).light(lightCoords) rotateBufferTowards(headBuffer, facing).light(light)
.renderInto(ms, vb); .renderInto(ms, vb);
} }
} }
@Override @Override

View file

@ -1,7 +1,6 @@
package com.simibubi.create.content.curiosities.bell; package com.simibubi.create.content.curiosities.bell;
import com.mojang.blaze3d.matrix.MatrixStack; 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.PartialBufferer;
import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.render.SuperByteBuffer;
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer; 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.block.BlockState;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.state.properties.BellAttachment; import net.minecraft.state.properties.BellAttachment;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
@ -39,9 +37,8 @@ public class BellRenderer<TE extends AbstractBellTileEntity> extends SafeTileEnt
rY += 90; rY += 90;
bell.rotateCentered(Direction.UP, AngleHelper.rad(rY)); bell.rotateCentered(Direction.UP, AngleHelper.rad(rY));
IVertexBuilder vb = buffer.getBuffer(RenderType.cutout()); bell.light(light)
int lightCoords = WorldRenderer.getLightColor(te.getLevel(), state, te.getBlockPos()); .renderInto(ms, buffer.getBuffer(RenderType.cutout()));
bell.light(lightCoords).renderInto(ms, vb);
} }
public static float getSwingAngle(float time) { public static float getSwingAngle(float time) {

View file

@ -13,7 +13,6 @@ import com.simibubi.create.foundation.utility.ColorHelper;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.state.properties.AttachFace; import net.minecraft.state.properties.AttachFace;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
@ -31,7 +30,6 @@ public class AnalogLeverRenderer extends SafeTileEntityRenderer<AnalogLeverTileE
if (Backend.getInstance().canUseInstancing(te.getLevel())) return; if (Backend.getInstance().canUseInstancing(te.getLevel())) return;
BlockState leverState = te.getBlockState(); BlockState leverState = te.getBlockState();
int lightCoords = WorldRenderer.getLightColor(te.getLevel(), leverState, te.getBlockPos());
float state = te.clientState.get(partialTicks); float state = te.clientState.get(partialTicks);
IVertexBuilder vb = buffer.getBuffer(RenderType.solid()); IVertexBuilder vb = buffer.getBuffer(RenderType.solid());
@ -42,13 +40,13 @@ public class AnalogLeverRenderer extends SafeTileEntityRenderer<AnalogLeverTileE
transform(handle, leverState).translate(1 / 2f, 1 / 16f, 1 / 2f) transform(handle, leverState).translate(1 / 2f, 1 / 16f, 1 / 2f)
.rotate(Direction.EAST, angle) .rotate(Direction.EAST, angle)
.translate(-1 / 2f, -1 / 16f, -1 / 2f); .translate(-1 / 2f, -1 / 16f, -1 / 2f);
handle.light(lightCoords) handle.light(light)
.renderInto(ms, vb); .renderInto(ms, vb);
// Indicator // Indicator
int color = ColorHelper.mixColors(0x2C0300, 0xCD0000, state / 15f); int color = ColorHelper.mixColors(0x2C0300, 0xCD0000, state / 15f);
SuperByteBuffer indicator = transform(PartialBufferer.get(AllBlockPartials.ANALOG_LEVER_INDICATOR, leverState), leverState); SuperByteBuffer indicator = transform(PartialBufferer.get(AllBlockPartials.ANALOG_LEVER_INDICATOR, leverState), leverState);
indicator.light(lightCoords) indicator.light(light)
.color(color) .color(color)
.renderInto(ms, vb); .renderInto(ms, vb);
} }