diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AbstractContraptionEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AbstractContraptionEntity.java index eff5279e6..9853a7371 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AbstractContraptionEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AbstractContraptionEntity.java @@ -831,7 +831,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit } @OnlyIn(Dist.CLIENT) - public abstract void doLocalTransforms(float partialTicks, PoseStack[] matrixStacks); + public abstract void applyLocalTransforms(PoseStack matrixStack, float partialTicks); public static class ContraptionRotationState { public static final ContraptionRotationState NONE = new ContraptionRotationState(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ControlledContraptionEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ControlledContraptionEntity.java index c00fa8cad..46d7b8ac8 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ControlledContraptionEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ControlledContraptionEntity.java @@ -226,15 +226,14 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity { @Override @OnlyIn(Dist.CLIENT) - public void doLocalTransforms(float partialTicks, PoseStack[] matrixStacks) { + public void applyLocalTransforms(PoseStack matrixStack, float partialTicks) { float angle = getAngle(partialTicks); Axis axis = getRotationAxis(); - for (PoseStack stack : matrixStacks) - TransformStack.cast(stack) - .nudge(getId()) - .centre() - .rotate(angle, axis) - .unCentre(); + TransformStack.cast(matrixStack) + .nudge(getId()) + .centre() + .rotate(angle, axis) + .unCentre(); } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/OrientedContraptionEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/OrientedContraptionEntity.java index 6738e4769..9abd65cf4 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/OrientedContraptionEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/OrientedContraptionEntity.java @@ -514,52 +514,48 @@ public class OrientedContraptionEntity extends AbstractContraptionEntity { @Override @OnlyIn(Dist.CLIENT) - public void doLocalTransforms(float partialTicks, PoseStack[] matrixStacks) { + public void applyLocalTransforms(PoseStack matrixStack, float partialTicks) { float angleInitialYaw = getInitialYaw(); float angleYaw = getViewYRot(partialTicks); float anglePitch = getViewXRot(partialTicks); - for (PoseStack stack : matrixStacks) - stack.translate(-.5f, 0, -.5f); + matrixStack.translate(-.5f, 0, -.5f); Entity ridingEntity = getVehicle(); if (ridingEntity instanceof AbstractMinecart) - repositionOnCart(partialTicks, matrixStacks, ridingEntity); + repositionOnCart(matrixStack, partialTicks, ridingEntity); else if (ridingEntity instanceof AbstractContraptionEntity) { if (ridingEntity.getVehicle() instanceof AbstractMinecart) - repositionOnCart(partialTicks, matrixStacks, ridingEntity.getVehicle()); + repositionOnCart(matrixStack, partialTicks, ridingEntity.getVehicle()); else - repositionOnContraption(partialTicks, matrixStacks, ridingEntity); + repositionOnContraption(matrixStack, partialTicks, ridingEntity); } - for (PoseStack stack : matrixStacks) - TransformStack.cast(stack) - .nudge(getId()) - .centre() - .rotateY(angleYaw) - .rotateZ(anglePitch) - .rotateY(angleInitialYaw) - .unCentre(); + TransformStack.cast(matrixStack) + .nudge(getId()) + .centre() + .rotateY(angleYaw) + .rotateZ(anglePitch) + .rotateY(angleInitialYaw) + .unCentre(); } @OnlyIn(Dist.CLIENT) - private void repositionOnContraption(float partialTicks, PoseStack[] matrixStacks, Entity ridingEntity) { + private void repositionOnContraption(PoseStack matrixStack, float partialTicks, Entity ridingEntity) { Vec3 pos = getContraptionOffset(partialTicks, ridingEntity); - for (PoseStack stack : matrixStacks) - stack.translate(pos.x, pos.y, pos.z); + matrixStack.translate(pos.x, pos.y, pos.z); } // Minecarts do not always render at their exact location, so the contraption // has to adjust aswell @OnlyIn(Dist.CLIENT) - private void repositionOnCart(float partialTicks, PoseStack[] matrixStacks, Entity ridingEntity) { + private void repositionOnCart(PoseStack matrixStack, float partialTicks, Entity ridingEntity) { Vec3 cartPos = getCartOffset(partialTicks, ridingEntity); if (cartPos == Vec3.ZERO) return; - for (PoseStack stack : matrixStacks) - stack.translate(cartPos.x, cartPos.y, cartPos.z); + matrixStack.translate(cartPos.x, cartPos.y, cartPos.z); } @OnlyIn(Dist.CLIENT) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraptionEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraptionEntity.java index f088e9236..845dc6caa 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraptionEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraptionEntity.java @@ -176,7 +176,7 @@ public class GantryContraptionEntity extends AbstractContraptionEntity { } @Override - public void doLocalTransforms(float partialTicks, PoseStack[] matrixStacks) { } + public void applyLocalTransforms(PoseStack matrixStack, float partialTicks) { } public void updateClientMotion() { float modifier = movementAxis.getAxisDirection() diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionMatrices.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionMatrices.java index a685a2553..1b6ab8520 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionMatrices.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionMatrices.java @@ -34,7 +34,7 @@ public class ContraptionMatrices { this.viewProjection.pushPose(); transform(this.viewProjection, viewProjection); model.pushPose(); - entity.doLocalTransforms(partialTicks, new PoseStack[] { model }); + entity.applyLocalTransforms(model, partialTicks); modelViewProjection.pushPose(); transform(modelViewProjection, viewProjection); diff --git a/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerRenderer.java index 8e9c113c8..8ee5ef9bb 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerRenderer.java @@ -33,52 +33,67 @@ public class BlazeBurnerRenderer extends SafeTileEntityRenderer 0.125f; - HeatLevel heatLevel = BlazeBurnerBlock.getHeatLevelOf(blockState); float time = AnimationTickHolder.getRenderTime(level); float renderTick = time + (hashCode % 13) * 16f; float offsetMult = heatLevel.isAtLeast(HeatLevel.FADING) ? 64 : 16; float offset = Mth.sin((float) ((renderTick / 16f) % (2 * Math.PI))) / offsetMult; float offset1 = Mth.sin((float) ((renderTick / 16f + Math.PI) % (2 * Math.PI))) / offsetMult; float offset2 = Mth.sin((float) ((renderTick / 16f + Math.PI / 2) % (2 * Math.PI))) / offsetMult; + float headY = offset - (animation * .75f); - VertexConsumer solid = buffer.getBuffer(RenderType.solid()); - VertexConsumer cutout = buffer.getBuffer(RenderType.cutoutMipped()); + VertexConsumer solid = bufferSource.getBuffer(RenderType.solid()); + VertexConsumer cutout = bufferSource.getBuffer(RenderType.cutoutMipped()); ms.pushPose(); - if (modelTransform == null && heatLevel.isAtLeast(HeatLevel.FADING) && blockAbove) { + if (canDrawFlame && blockAbove) { SpriteShiftEntry spriteShift = heatLevel == HeatLevel.SEETHING ? AllSpriteShifts.SUPER_BURNER_FLAME : AllSpriteShifts.BURNER_FLAME; @@ -102,68 +117,87 @@ public class BlazeBurnerRenderer extends SafeTileEntityRenderer implements BlockEntityRenderer { - @Override - public final void render(T te, float partialTicks, PoseStack ms, MultiBufferSource buffer, int light, + public final void render(T te, float partialTicks, PoseStack ms, MultiBufferSource bufferSource, int light, int overlay) { if (isInvalid(te)) return; - renderSafe(te, partialTicks, ms, buffer, light, overlay); + renderSafe(te, partialTicks, ms, bufferSource, light, overlay); } - protected abstract void renderSafe(T te, float partialTicks, PoseStack ms, MultiBufferSource buffer, int light, + protected abstract void renderSafe(T te, float partialTicks, PoseStack ms, MultiBufferSource bufferSource, int light, int overlay); public boolean isInvalid(T te) {