Skip to content

Commit c551f60

Browse files
committed
Merged with upstream and ensured compatibility with JDK21
1 parent 0eaf0f3 commit c551f60

File tree

3 files changed

+45
-14
lines changed

3 files changed

+45
-14
lines changed

src/main/java/dev/xpple/seedmapper/config/Configs.java

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,24 +91,44 @@ private static Component getEspTimeoutComment() {
9191
}
9292

9393
@Config(comment = "getClearSeedMapCachesOnCloseComment")
94-
public static boolean ClearSeedMapCachesOnClose = true;
94+
public static boolean ClearSeedMapCachesOnClose = false;
9595

9696
private static Component getClearSeedMapCachesOnCloseComment() {
9797
return Component.translatable("config.clearSeedMapCachesOnClose.comment");
9898
}
9999

100-
@Config
100+
@Config(comment = "getBlockHighlightEspComment")
101101
public static EspStyle BlockHighlightESP = EspStyle.useCommandColorDefaults();
102102

103-
@Config
103+
private static Component getBlockHighlightEspComment() {
104+
return Component.translatable("config.blockHighlightEsp.comment");
105+
}
106+
107+
@Config(comment = "getOreVeinEspComment")
104108
public static EspStyle OreVeinESP = EspStyle.useCommandColorDefaults();
105109

106-
@Config
110+
private static Component getOreVeinEspComment() {
111+
return Component.translatable("config.oreVeinEsp.comment");
112+
}
113+
114+
@Config(comment = "getTerrainEspComment")
107115
public static EspStyle TerrainESP = EspStyle.useCommandColorDefaults();
108116

109-
@Config
117+
private static Component getTerrainEspComment() {
118+
return Component.translatable("config.terrainEsp.comment");
119+
}
120+
121+
@Config(comment = "getCanyonEspComment")
110122
public static EspStyle CanyonESP = EspStyle.useCommandColorDefaults();
111123

112-
@Config
124+
private static Component getCanyonEspComment() {
125+
return Component.translatable("config.canyonEsp.comment");
126+
}
127+
128+
@Config(comment = "getCaveEspComment")
113129
public static EspStyle CaveESP = EspStyle.useCommandColorDefaults();
130+
131+
private static Component getCaveEspComment() {
132+
return Component.translatable("config.caveEsp.comment");
133+
}
114134
}

src/main/java/dev/xpple/seedmapper/seedmap/SeedMapScreen.java

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,10 @@ public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partia
391391

392392
guiGraphics.nextStratum();
393393

394-
int horChunkRadius = Math.ceilDiv(this.seedMapWidth / 2, SCALED_CHUNK_SIZE * Configs.PixelsPerBiome);
395-
int verChunkRadius = Math.ceilDiv(this.seedMapHeight / 2, SCALED_CHUNK_SIZE * Configs.PixelsPerBiome);
394+
double pixelsPerBiome = Math.max(MIN_PIXELS_PER_BIOME, Configs.PixelsPerBiome);
395+
double chunkSizePixels = SCALED_CHUNK_SIZE * pixelsPerBiome;
396+
int horChunkRadius = (int) Math.ceil((this.seedMapWidth / 2.0D) / chunkSizePixels);
397+
int verChunkRadius = (int) Math.ceil((this.seedMapHeight / 2.0D) / chunkSizePixels);
396398

397399
// compute structures
398400
Configs.ToggledFeatures.stream()
@@ -532,7 +534,10 @@ public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partia
532534
MutableComponent coordinates = accent("x: %d, z: %d".formatted(QuartPos.toBlock(this.mouseQuart.x()), QuartPos.toBlock(this.mouseQuart.z())));
533535
OptionalInt optionalBiome = getBiome(this.mouseQuart);
534536
if (optionalBiome.isPresent()) {
535-
coordinates = coordinates.append(" [%s]".formatted(Cubiomes.biome2str(this.version, optionalBiome.getAsInt()).getString(0)));
537+
String biomeName = NativeAccess.readString(Cubiomes.biome2str(this.version, optionalBiome.getAsInt()));
538+
if (biomeName != null) {
539+
coordinates = coordinates.append(" [%s]".formatted(biomeName));
540+
}
536541
}
537542
if (this.displayCoordinatesCopiedTicks > 0) {
538543
coordinates = Component.translatable("seedMap.coordinatesCopied", coordinates);
@@ -545,11 +550,11 @@ public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partia
545550
private void drawTile(GuiGraphics guiGraphics, Tile tile) {
546551
TilePos tilePos = tile.pos();
547552
QuartPos2f relTileQuart = QuartPos2f.fromQuartPos(QuartPos2.fromTilePos(tilePos)).subtract(this.centerQuart);
548-
int tileSizePixels = TILE_SIZE_PIXELS.getAsInt();
549-
int minX = this.centerX + Mth.floor(Configs.PixelsPerBiome * relTileQuart.x());
550-
int minY = this.centerY + Mth.floor(Configs.PixelsPerBiome * relTileQuart.z());
551-
int maxX = minX + tileSizePixels;
552-
int maxY = minY + tileSizePixels;
553+
int tileSizePixels = tileSizePixels();
554+
double minXDouble = this.centerX + Configs.PixelsPerBiome * relTileQuart.x();
555+
double minYDouble = this.centerY + Configs.PixelsPerBiome * relTileQuart.z();
556+
double maxXDouble = minXDouble + tileSizePixels;
557+
double maxYDouble = minYDouble + tileSizePixels;
553558

554559
if (maxXDouble <= HORIZONTAL_PADDING || minXDouble >= HORIZONTAL_PADDING + this.seedMapWidth) {
555560
return;

src/main/resources/assets/seedmapper/lang/en_us.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@
9595

9696
"config.oreAirCheck.comment": "Whether or not SeedMapper should use in-game air checks to invalidate ore positions.",
9797
"config.devMode.comment": "Enables certain debug commands.",
98+
"config.clearSeedMapCachesOnClose.comment": "If enabled, closing the seed map frees all cached tiles and structures immediately instead of keeping them for faster re-open.",
99+
"config.blockHighlightEsp.comment": "Controls the ESP colors used for highlighted block clusters.",
100+
"config.oreVeinEsp.comment": "Controls the ESP colors used for ore vein highlights.",
101+
"config.terrainEsp.comment": "Controls the ESP colors used for terrain outlines.",
102+
"config.canyonEsp.comment": "Controls the ESP colors used for canyon/ravine outlines.",
103+
"config.caveEsp.comment": "Controls the ESP colors used for cave highlights.",
98104

99105
"key.seedMap": "Seed map",
100106

0 commit comments

Comments
 (0)