Skip to content

Commit b06ed6e

Browse files
committed
fix: ensure consistent scaling during wall rendering
SeedQueuePreviewProperties#buildChunks sets RenderSystem#ortho, but since it does it with double precision the result may be slightly off the width and height of SeedQueuePreview, causing flickering also ceiled width and height to avoid them being 0 when the scale is bigger than the simulated window size
1 parent 62d3c7b commit b06ed6e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/main/java/me/contaria/seedqueue/gui/wall/SeedQueuePreview.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ public SeedQueuePreview(SeedQueueWallScreen wall, SeedQueueEntry seedQueueEntry)
6464
this.seedQueueEntry.getSettingsCache() != null ? (int) this.seedQueueEntry.getSettingsCache().getValue("guiScale") : MinecraftClient.getInstance().options.guiScale,
6565
MinecraftClient.getInstance().options.forceUnicodeFont
6666
);
67-
this.width = SeedQueue.config.simulatedWindowSize.width() / scale;
68-
this.height = SeedQueue.config.simulatedWindowSize.height() / scale;
67+
this.width = (int) Math.ceil((double) SeedQueue.config.simulatedWindowSize.width() / scale);
68+
this.height = (int) Math.ceil((double) SeedQueue.config.simulatedWindowSize.height() / scale);
6969

7070
this.buttons = WorldPreviewProperties.createMenu(this.width, this.height, () -> {}, () -> {});
7171
this.showMenu = !Boolean.TRUE.equals(SpeedrunConfigAPI.getConfigValue("standardsettings", "autoF3Esc"));
@@ -133,6 +133,7 @@ private void renderPreview(MatrixStack matrices) {
133133
this.buildChunks();
134134
}
135135
}
136+
this.wall.setOrtho(this.width, this.height);
136137
frameBuffer.draw(this.width, this.height);
137138
}
138139

@@ -147,7 +148,6 @@ private void redrawPreview(MatrixStack matrices, SeedQueuePreviewFrameBuffer fra
147148

148149
this.client.getFramebuffer().beginWrite(false);
149150
this.wall.refreshViewport();
150-
this.wall.setOrtho(this.width, this.height);
151151
this.lastPreviewFrame = this.wall.frame;
152152
}
153153

0 commit comments

Comments
 (0)