Redrawals

- Fixed schematic rendering offset by a tick
- Fixed item vaults not marking themselves as needed to be saved
- Fixed steam engines not rotating with their shaft when not animating
This commit is contained in:
simibubi 2025-02-11 14:28:11 +01:00
parent 0c21da9899
commit e67d8da904
4 changed files with 18 additions and 19 deletions

View file

@ -26,6 +26,7 @@ public class SteamEngineVisual extends AbstractBlockEntityVisual<SteamEngineBloc
protected final TransformedInstance connector;
private Float lastAngle = Float.NaN;
private Axis lastAxis = null;
public SteamEngineVisual(VisualizationContext context, SteamEngineBlockEntity blockEntity, float partialTick) {
super(context, blockEntity, partialTick);
@ -47,11 +48,18 @@ public class SteamEngineVisual extends AbstractBlockEntityVisual<SteamEngineBloc
private void animate() {
Float angle = blockEntity.getTargetAngle();
Axis axis = Axis.Y;
if (Objects.equals(angle, lastAngle)) {
PoweredShaftBlockEntity shaft = blockEntity.getShaft();
if (shaft != null)
axis = KineticBlockEntityRenderer.getRotationAxisOf(shaft);
if (Objects.equals(angle, lastAngle) && lastAxis == axis) {
return;
}
lastAngle = angle;
lastAxis = axis;
if (angle == null) {
piston.setVisible(false);
@ -66,11 +74,6 @@ public class SteamEngineVisual extends AbstractBlockEntityVisual<SteamEngineBloc
Direction facing = SteamEngineBlock.getFacing(blockState);
Axis facingAxis = facing.getAxis();
Axis axis = Axis.Y;
PoweredShaftBlockEntity shaft = blockEntity.getShaft();
if (shaft != null)
axis = KineticBlockEntityRenderer.getRotationAxisOf(shaft);
boolean roll90 = facingAxis.isHorizontal() && axis == Axis.Y || facingAxis.isVertical() && axis == Axis.Z;
float sine = Mth.sin(angle);

View file

@ -47,6 +47,7 @@ public class ItemVaultBlockEntity extends SmartBlockEntity implements IMultiBloc
protected void onContentsChanged(int slot) {
super.onContentsChanged(slot);
updateComparators();
level.blockEntityChanged(worldPosition);
}
};

View file

@ -98,8 +98,6 @@ public class SchematicHandler implements IGuiOverlay {
if (activeSchematicItem != null && transformation != null)
transformation.tick();
renderers.forEach(SchematicRenderer::tick);
LocalPlayer player = mc.player;
ItemStack stack = findBlueprintInHand(player);
if (stack == null) {

View file

@ -53,20 +53,17 @@ public class SchematicRenderer {
changed = true;
}
public void tick() {
if (!active)
return;
Minecraft mc = Minecraft.getInstance();
if (mc.level == null || mc.player == null || !changed)
return;
redraw();
changed = false;
}
public void render(PoseStack ms, SuperRenderTypeBuffer buffers) {
if (!active)
return;
Minecraft mc = Minecraft.getInstance();
if (mc.level == null || mc.player == null)
return;
if (changed)
redraw();
changed = false;
bufferCache.forEach((layer, buffer) -> {
buffer.renderInto(ms, buffers.getBuffer(layer));
});