Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/com/sinthoras/visualprospecting/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ private static class Defaults {
public static final int cacheGenerationLogUpdateMinTime = 5;
public static final boolean recacheVeins = false;
public static final int minDelayBetweenVeinRequests = 2000;
public static final int minZoomLevelForOreLabel = 2;
public static final int minZoomLevelForUndergroundFluidDetails = 3;
public static final int minZoomLevelForOreLabel = 1;
public static final int minZoomLevelForUndergroundFluidDetails = 2;
public static final int uploadBandwidthBytes = 2000000;
public static final int maxTransferCacheSizeMB = 50;
public static final boolean enableVoxelMapWaypointsByDefault = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.sinthoras.visualprospecting.integration.model.render;

final class OreLabelLayout {

private OreLabelLayout() {}

static double staggerOffset(double blockX, double zoomStep, double labelHeight) {
// Ore columns are three chunks wide. Floor keeps alternation continuous across X = 0
return zoomStep <= 1 && (((long) Math.floor(blockX / 48)) & 1) != 0 ? labelHeight + 1 : 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,26 @@ public void preRender(double topX, double topY, float drawScale, double zoom) {

@Override
public void draw(double topX, double topY, float drawScale, double zoom) {
final double labelScale = getLabelScale();
final double labelOffset = (fontHeight + 5) * (isXaero ? 1 : labelScale)
+ OreLabelLayout.staggerOffset(location.getBlockX(), getZoomStep(), (fontHeight + 2) * labelScale);
// Xaero culling relies on Navigator's visible cache; add centered bounds if that cache grows costly.
if (!isXaero) {
final Minecraft mc = Minecraft.getMinecraft();
final double scale = 1.0;
final double screenW = mc.displayWidth * scale;
final double screenH = mc.displayHeight * scale;
final double topMargin = (fontHeight + 5) * getLabelScale() * scale;
if (topX + width < 0 || topX > screenW || topY + height < -topMargin || topY > screenH) {
if (topX + width < 0 || topX > screenW || topY + height < 0 || topY - labelOffset > screenH) {
return;
}
}

if (zoom >= Config.minZoomLevelForOreLabel && !location.isDepleted()) {
final double labelScale = getLabelScale();
final int fontColor = location.drawSearchHighlight() ? 0xFFFFFF : 0x7F7F7F;
DrawUtils.drawLabel(
location.getName(),
topX + width / 2,
topY - (fontHeight + 5) * (isXaero ? 1 : labelScale),
topY - labelOffset,
fontColor,
0,
true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public void draw(double topX, double topY, float drawScale, double zoom) {
title = location.getFluid().getLocalizedName();
values = MessageFormat.format(
"{0}-{1} L/Op",
formatAmount(location.getMinProduction()),
formatAmount(maxAmountInField));
formatAmount(location.getMinProduction() >> 1),
formatAmount(maxAmountInField >> 1));
}

int textColor = 0xFFFFFFFF;
Expand Down Expand Up @@ -131,7 +131,7 @@ private void renderChunks(double x, double y) {

if (drawLabels) {
DrawUtils.drawLabel(
MessageFormat.format("{0} L/Op", formatAmount(amount)),
MessageFormat.format("{0} L/Op", formatAmount(amount >> 1)),
cellX + cellW / 2,
cellY + cellH / 2 + cellLabelOffsetY,
0xFFFFFFFF,
Expand Down