Skip to content

Commit 77f8034

Browse files
authored
Fix Xaeros culling regression (#101)
1 parent 74c32ff commit 77f8034

2 files changed

Lines changed: 15 additions & 10 deletions

File tree

src/main/java/com/sinthoras/visualprospecting/integration/model/render/OreVeinRenderStep.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,16 @@ public void preRender(double topX, double topY, float drawScale, double zoom) {
4343

4444
@Override
4545
public void draw(double topX, double topY, float drawScale, double zoom) {
46-
final Minecraft mc = Minecraft.getMinecraft();
47-
final double scale = isXaero && shouldScale ? getScaling(zoom) : 1.0;
48-
final double screenW = mc.displayWidth * scale;
49-
final double screenH = mc.displayHeight * scale;
50-
final double topMargin = (fontHeight + 5) * getFontScale() * scale;
51-
if (topX + width < 0 || topX > screenW || topY + height < -topMargin || topY > screenH) {
52-
return;
46+
// Xaero culling relies on Navigator's visible cache; add centered bounds if that cache grows costly.
47+
if (!isXaero) {
48+
final Minecraft mc = Minecraft.getMinecraft();
49+
final double scale = 1.0;
50+
final double screenW = mc.displayWidth * scale;
51+
final double screenH = mc.displayHeight * scale;
52+
final double topMargin = (fontHeight + 5) * getFontScale() * scale;
53+
if (topX + width < 0 || topX > screenW || topY + height < -topMargin || topY > screenH) {
54+
return;
55+
}
5356
}
5457

5558
if (zoom >= Config.minZoomLevelForOreLabel && !location.isDepleted()) {

src/main/java/com/sinthoras/visualprospecting/integration/model/render/UndergroundFluidRenderStep.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ public void draw(double topX, double topY, float drawScale, double zoom) {
2525
final Minecraft mc = Minecraft.getMinecraft();
2626
final double regionW = VP.undergroundFluidSizeChunkX * VP.chunkWidth * blockSize;
2727
final double regionH = VP.undergroundFluidSizeChunkZ * VP.chunkWidth * blockSize;
28-
if (topX + regionW < 0 || topY + regionH < 0 || topX > mc.displayWidth || topY > mc.displayHeight) {
28+
// Xaero culling relies on Navigator's visible cache; add centered bounds if that cache grows costly.
29+
if (!isXaero
30+
&& (topX + regionW < 0 || topY + regionH < 0 || topX > mc.displayWidth || topY > mc.displayHeight)) {
2931
return;
3032
}
3133

@@ -89,10 +91,10 @@ private void renderChunks(double x, double y) {
8991
final double cellH = getAdjustedHeight();
9092
for (int chunkX = 0; chunkX < VP.undergroundFluidSizeChunkX; chunkX++) {
9193
final double cellX = x + chunkX * cellW;
92-
if (cellX + cellW < 0 || cellX > screenW) continue;
94+
if (!isXaero && (cellX + cellW < 0 || cellX > screenW)) continue;
9395
for (int chunkZ = 0; chunkZ < VP.undergroundFluidSizeChunkZ; chunkZ++) {
9496
final double cellY = y + chunkZ * cellH;
95-
if (cellY + cellH < 0 || cellY > screenH) continue;
97+
if (!isXaero && (cellY + cellH < 0 || cellY > screenH)) continue;
9698
int amount = chunks[chunkX][chunkZ];
9799
if (amount <= 0) continue;
98100
int alpha = productionRange > 1 ? (int) ((amount - minProduction) / productionRange * 255) : 10;

0 commit comments

Comments
 (0)