Giter Site home page Giter Site logo

bate / mcmap Goto Github PK

View Code? Open in Web Editor NEW

This project forked from spoutn1k/mcmap

0.0 1.0 0.0 3.47 MB

Pixel-art map visualizer for Minecraft. Maps are drawn from an isometric perspective.

License: GNU General Public License v3.0

C++ 99.37% Shell 0.06% Makefile 0.18% HTML 0.07% Objective-C 0.01% C 0.31%

mcmap's Introduction

mcmap - Isometric map visualizer

Original project by Simon Rettberg. All the credit goes to him for the idea and vision.

mcmap is a tool allowing you to create isometric renders of your Minecraft save file.

sample

This project is under heavy development, but compatible with newer versions of Minecraft.

Usage

Basic invocation

mcmap <options> path/to/<your save>

The standard save path is different between OSes:

  • On Linux, it is $HOME/.minecraft/saves;
  • On macOS, under ~/Library/Application\ Support/minecraft/saves;
  • On Windows, the standard path is %AppData%\.minecraft\saves. However as only Ubuntu on Windows is supported, the path to access the save folder is the following: /mnt/c/<Your user>/AppData/Roaming/.minecraft/saves.

Windows

Native Windows is currently unsupported, but the program works using Ubuntu on windows to get a linux terminal and launch it from there, as on a linux platform.

Most of the code uses std::filesystem to access files and from my understanding should be cross-platform. I have no experience nor interest in making a Windows GUI, but it should be pretty straightforward, as it has been done before. If anyone has the sources to that old viewer, sharing them to update them would be greatly appreciated.

Options

Name Description
-from X Z sets the coordinates of the block to start rendering at
-to X Z sets the coordinates of the block to end rendering at
-min/max VAL minimum/maximum Y index (height) of blocks to render
-file NAME sets the output filename to 'NAME'; default is ./output.png
-colors NAME sets the custom color file to 'NAME'
-nw -ne -se -sw controls which direction will point to the top corner; North-West is default
-marker x z color draw a marker at x z of color color in red,green,blue or white; can be used up to 256 times
-nowater do not render water
-nobeacons do not render beacon beams
-shading toggle shading (brightens blocks depending on height)
-nether render the nether
-end render the end
-dim[ension] [namespace:]id render a dimension by namespaced ID
-splits number of sub-terrains to render; if threading is available, every sub-terrain is rendered in a thread
-padding padding around the final image, in pixels (default: 5)
-h[elp] display an option summary
-v[erbose] toggle debug mode
-dumpcolors dump a json with all defined colors

Note: Currently you need both -from and -to to define bounds.

Tips

When passing only a level, mcmap will try to guess the size of the existing terrain, but the Minecraft storage format does not make is easy. The best results are achieved using -from x z -to X Z to define an area to render.

If rendering large areas, working in threaded mode can greatly speed up the process. Try using -splits with the number of cores your CPU has for the best performance.

Color file format

mcmap supports changing the colors of blocks. To do so, prepare a custom color file, and pass it as an argument using the -colors argument. The accepted format is a json file, with a specific structure. The root contains a list of block IDs to modify, with the namespace prefix, such as namespace:block.

Simple block

To define a color for a simple, regular block, provide an entry with the following format:

"namespace:block": [RED, GREEN, BLUE, ALPHA]

All the fields must be integer values between 0 and 255.

Examples:

{
    "minecraft:dirt":   [134, 96, 67, 255],
    "minecraft:stone":  [128, 128, 128, 255],
    ...
}

Complex block

Some blocks are better looking when drawn in a specific way. To specify that a block has to be drawn differently, you have to provide a json structure with the fields:

"namespace:block": {
    "type":     <BlockType>,
    "color":    [RED, GREEN, BLUE, ALPHA],
    "accent":   [RED, GREEN, BLUE, ALPHA] (Optional)
}

The available available block types are:

Name Appearance Accent support
Full Default. Full-block. No
Hide Do not render the block entirely. No
Clear This block is optimized for transparent block in large quantities, such as glass and water. The top of the block is not rendered, making for a smooth surface when blending blocks together. No
Thin Will color only the top of the block underneath. Used for snow, rails, pressure plates. No
Slab Half block. No
Stair Renders a stair block. No
Rod A slimmer block, used for fences and walls. No
Wire Small dot on the floor, used for tripwire and redstone. No
Head Smaller block, also used for pots, pickles, and mushrooms. No
Plant Used in a variety of cases, renders a leaf-like block. No
UnderwaterPlant Same as Plant, but the air is water-colored. Used for sea-grass and kelp. No
Fire Fire-like. Used for fire. No
Beam Internal block type, used for markers and beacon beams. No
Torch Three pixels in a vertical line, with the top pixel rendered with the accent color. Yes
Ore Block with veins of color. The vein is rendered with the accent color. Yes
Grown Blocks that have a different layer on top. Grass, nylium, etc. The top layer is rendered with the accent color. Yes
Log Directionnal block, to render logs/pillars as close as possible. The center of the pillar is rendered with the accent color. Used for logs, pillars, basalt. Yes

NOTE: Waterlogged blocks will be rendered within water instead of air by default according to their blockstates. However, sea-grass and kelp are hardcoded to be underwater and their blockstates won't reflect this, so they have to be defined as UnderwaterPlants.

Examples:

{
    "minecraft:dirt":   [134, 96, 67, 255],
    "minecraft:grass_block": {
        "type":     "Grown",
        "color":    [134, 96, 67, 255],
        "accent":   [102, 142, 62, 255]
    },
    "minecraft:snow": {
        "type":     "Thin",
        "color":    [245, 246, 245, 254]
    }
}

Compilation

mcmap depends on the PNG and zlib libraries. Development was made using gcc version 10, and can be compiled with gcc 8 or later or clang 10 or later.

Linux

Getting the libraries depends on your distribution:

  • Ubuntu: apt update && apt install git make g++ libpng-dev;
  • Archlinux: pacman -S --needed git gcc make libpng.

Then get the code and compile:

git clone http://github.com/spoutn1k/mcmap
cd mcmap && make -j

macOS

In an Apple environment, you need to install brew to get the libraries. You also need a developer toolkit recent enough, with the version of g++ --version superior to 10.

brew install libpng libomp
git clone http://github.com/spoutn1k/mcmap
cd mcmap
OS=MACOS make

Windows

Download and set up Ubuntu on windows then the steps are the same as Linux/Ubuntu.

Troubleshooting

Compilation fails

Check g++ --version. Supported versions are at least 8.0.0. If your version is not up to date, install a more recent one using your package manager. You will have access to the new version using g++-Y with Y being the version number. Compile using CXX=g++-Y make.

Compilation fails complaining about OMP something

Try compiling with OPENMP=NOTHXM8 make. This disables the underlying threading code, so you won't be able to use the splits option.

mcmap's People

Contributors

spoutn1k avatar zahl avatar wrim avatar orphu avatar flarn2006 avatar cvsync avatar flps42 avatar andrewminer avatar buscher avatar mroderick avatar kmpm avatar bxvcd-732 avatar baptr avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.