Skip to content

Xaero's minimap and worldmap implementation - #5

Merged
9 commits merged into
Teddy563:mainfrom
itzSelestia:map-implementation
Oct 18, 2026
Merged

9 commits merged into
Teddy563:mainfrom
itzSelestia:map-implementation

Conversation

@itzSelestia

Copy link
Copy Markdown
Contributor

Small context

When i first time saw this mod I immediately wondered if it had some kind of map, like Google Maps. So thats why i'm making this implementation.

Summary

In RealWorld worlds, Xaero's minimap and full-screen world map now show OpenStreetMap tiles instead of block colors. The world map cursor shows the place name ("Country, City") where it used to show the biome. Also i found 2 client bugs: out-of-memory crash when world map is open, and if you relog to the vanilla world after playing in RealWorld, RealWorld places carrying over into vanilla world.

Changes

Map display

  • OSM tiles on the minimap and world map.
    • New OsmTileCache downloads zoom-17 OSM tiles, saves them in realworldmc-tiles/ and draws them over Xaero's chunk textures.
    • Hooks: MinimapFBORendererMixin (minimap's own chunks), SupportXaeroWorldmapMixin (minimap using World Map data) and GuiMapMixin (full-screen world map).
    • Tiles only appear on chunks Xaero's World Map has recorded, so areas you've visited keep their tiles after a restart.
  • Shared cache. The minimap and world map use one cache: each tile is downloaded and saved once, and uploaded to the GPU once.
    • The cache always keeps 256 tiles. Above that, it only frees tiles that haven't been drawn for 2 seconds, up to 2048, so tiles on screen don't reload and flicker.
    • While a tile downloads, its area stays empty. Xaero's own texture only shows if a download fails.
  • Place name on the world map. The biome line under the cursor shows "Country, City", looked up with OSM Nominatim.
    • Requests are limited to 1 per second, and only the place under the cursor is looked up.
    • Names are cached per roughly 1 km square in realworldmc-cities.txt.
    • Vanilla worlds and other dimensions keep Xaero's normal biome text.

Fixes

  • Out-of-memory-crash when world map open: While Xaero's world map is open, the world isn't drawn, so the 3D photo tiles are never uploaded. MapRenderer kept downloading and parsing the same tiles every half second until the heap ran out. A tile now stays marked as loading until it has been uploaded.
  • RealWorld places carried over into vanilla worlds: The disconnect cleanup was queued with client.execute(...), and Minecraft.disconnect drops queued tasks. A vanilla world opened afterwards could show the previous world's photo buildings, OSM minimap and attribution. The cleanup now runs immediately on the client thread. This bug was found while testing through runClient, i'm not sure if runClient could have had any effect on this, as I hadn’t encountered this issue before.

Testing

Was tested through runClient and .mrpack after .\build-release.ps1 -MinecraftVersion 1.21.1

  • gradlew compileClientJava passes and the client starts with no mixin errors.
  • RealWorld world: the minimap and world map show OSM tiles. Visited areas still show after a restart.
  • World map stays open for several minutes without running out of memory.
  • Leaving a RealWorld world and opening a vanilla one: no photo mesh, no OSM tiles, no attribution.
  • World map cursor shows "Country, City" in a RealWorld world and the biome in a vanilla world.
  • build-release.ps1 -MinecraftVersion 1.21.1 builds a release JAR that works with Xaero's Minimap and World Map installed.

Attribution

Map tiles and place names © OpenStreetMap contributors. Requests send a RealWorldMC User-Agent, as OSM's usage policies require

…en if its max zoomed out

Fix memory overload while Xaero's World Map is open
3D tiles waiting for GPU upload were repeatedly downloaded because they were not marked as loading. Keep them marked until upload, and clear the marks when changing regions.
… map

Now it always keeps 256 tiles. Above that, it only frees tiles that havent been drawn for 2 seconds. Tiles on screen stay loaded, up to a hard limit of 2048 tiles.
@Teddy563

Copy link
Copy Markdown
Owner
image Had to do a few changes to it so it works in street view. Thank you!

@Teddy563 Teddy563 closed this Oct 18, 2026
@Teddy563 Teddy563 reopened this Oct 18, 2026
@Teddy563 Teddy563 closed this Oct 18, 2026
@Teddy563 Teddy563 reopened this Oct 18, 2026
@Teddy563 Teddy563 closed this pull request by merging all changes into Teddy563:main in 70eb239 Oct 18, 2026
@itzSelestia
itzSelestia deleted the map-implementation branch October 25, 2026 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants