piegamesde / BlockMap

An out-of-game map renderer and viewer for Minecraft 1.13–1.18 worlds [unmaintained]
MIT License
91 stars 22 forks source link
mapviewer minecraft

BlockMap – A Minecraft 1.18 world viewer

Build Status

Features:

Gallery

Four rendered region files, each with one with a different color map Four rendered region files, each one with a different shader Screenshot from the GUI Screenshot showing different Minecraft structures as pins on the map Gif of the GUI zooming out in a large world

Requirements:

Download / Installation:

Download the latest version from the Release page.

AUR package

Arch Linux users can install BlockMap directly from the AUR.

Other distros

BlockMap hasn't been packaged for other distros yet (looking for maintainers).

Use it (GUI):

The GUI version should just run by (double)clicking it. Otherwise run it through:

java -jar BlockMap-gui-2.4.1.jar

to start. If you installed BlockMap through a package manager, search for it in your launcher or menu.

GUI controls:

Use it (CLI):

If you want to use BlockMap through the command line without,

# For general usage help
java -jar BlockMap-cli-2.4.1.jar help
# For help about rendering worlds to a folder
java -jar BlockMap-cli-2.4.1.jar help render

will get you started. On Linux even with colors!

If your world has been created before the Minecraft 1.13 release, please optimize it. To do this, start Minecraft, select your world, go to "Edit" and then "Optimize World".

Server usage:

This feature is not stabilized yet. Backwards-incompatible changes may occur even on minor releases. Any feedback welcome.

The new server mode is based around the following concept:

Old server usage:

The "old" way of doing server support: a simple shell script that calls the CLI.

The bash script server.sh is an example of how this could be used in a server environment. Simply set the paths at the top of the file and call this script regularly on the server. It has a few different render settings pre-configured, but they are easy to adapt to your needs.

Use it (Library):

If you have trouble getting the library as dependency into your build system, please open up an issue. We generally recommend using JitPack.

The main action happens in the RegionRenderer class. It takes some RenderSettings (color map, height bounds, etc.) and renders whole RegionFiles at once. The result will be a Region object, which contains not only the pixel data but also extensive metadata about the structure of the world. The RegionFolder class helps you manage rendering whole worlds, especially with regards to keeping a rendered world up to date and other caching problems. Example usage:

MinecraftDimension dimension = MinecraftDimension.OVERWOLRD;
RenderSettings settings = new RenderSettings();
RegionRenderer renderer = new RegionRenderer(settings);
Path input; // <-- must point to a Minecraft world folder
Path inputRegion = input.resolve(dimension.getRegionPath());
Path output; // <-- must point to an empty folder

/* Actual rendering 
 *
 * We could simply start loading `RegionFile`s per hand and feeding them into the `renderer`, but the `RegionFolder`s will help us
 * with most of the dirty work. A `CachedRegionFolder` will be used to actually (and automatically) save the images on disk.
 */
WorldRegionFolder world = WorldRegionFolder.load(inputRegion, renderer, dimension == MinecraftDimension.NETHER);
CachedRegionFolder cached = CachedRegionFolder.create(world, false, output);
for (Vector2ic pos : world.listRegions()) {
    cached.render(pos);
}

For more detailed examples (including all the possible settings and a "merge everything into a huge PNG" mode), look at the CLI code (CommandLineMain.java).

Build it:

Due to technical, legal and performance reasons, some resources required to run and test BlockMap are not included in this repository, but generated locally. The Gradle task regenerate will download all required files (you only need an internet connection the first time and after a clean) and generate and compile a bunch of stuff. Without this, nothing will work. On a freshly cloned repository, use initEclipse or initIdea to transform the repository into a project you can simply open in your favorite IDE. (Warning: The eclipse and idea tasks have to be called each time some dependencies changed. Furthermore, they link to some folders in the build directory. This means that they won't work as intended until regenerate has been called.)

All screenshots from above are generated automatically through the Gradle task generateScreenshots. This way, they are always up to date with the latest version. Be aware that this task needs to generate a fairly large Minecraft world first and then render it, which takes both time and space and will cause Gradle to slow down a lot.

Run it:

To run from code:

./gradlew regenerate
# For the CLI
./gradlew :BlockMap-cli:run
# For the GUI
./gradlew :BlockMap-gui:run

If you want to create a release jar and run it, use ./gradlew :BlockMap-gui:runShadow and ./gradlew :BlockMap-cli:runShadow.

Update and Release BlockMap:

./gradlew regenerate
./gradlew generateScreenshots # Optional
./gradlew release

Update to newer Minecraft version

  1. Update to the currently latest minor version, according to the instructions below, before going on with the next major update.
  2. Update and start Minecraft. Create a new debug world. Copy it to ./BlockMap-internal/src/test/resources. Delete the playerdata, stats and advancements folders in it.
  3. Copy the current block color instructions in ./BlockMap-internal/src/main/resources/ to match the new Minecraft version.
  4. Copy the current ChunkRenderer in de.piegames.blockmap.renderer (in BlockMap-core) to match the new Minecraft version.
  5. Commit as Minecraft $VERSION: Update preparation
  6. Run ./gradlew checkMinecraftVersions and update de.piegames.blockmap.MinecraftVersion accordingly.
  7. Update the Minecraft version of ChunkRenderer_$VERSION in the constructor
  8. Update de.piegames.blockmap.renderer.RegionRenderer to use the new ChunkRenderer
  9. Run ./gradlew regenerate and make it work
  10. Run all the tests (./gradlew test) and make them work
    • If Minecraft changed something on the save format, the ChunkRenderer will fail
    • If Minecraft added new blocks, the color map needs to be updated. The failing tests will tell which blocks are missing. Additional information can be retrieved from the default resource pack.
    • If Minecraft added or changed biomes, manual checking and updating is required
  11. Generate a Minecraft vanilla world and test the GUI
  12. Implement any new features of the update (e.g. new data that can be shown as GUI pin)
    • Don't forget ./BlockMap-internal/src/main/resources/biome-color-instructions.json
  13. Regenerate the screenshots
    • Optimize the BlockMapWorld in Minecraft
    • ./gradlew clean && ./gradlew regenerate && ./gradlew generateScreenshots
  14. Update version references in README.md (and elsewhere)
  15. Release it 🎉

Troubleshooting

Mod support

Currently, no Minecraft mods are supported, but the rendering engine is built in an extensible way. Mod support will only be implemented on request.

TODO