spoutn1k / mcmap

Pixel-art map visualizer for Minecraft. Maps are drawn from an isometric perspective.
GNU General Public License v3.0
312 stars 45 forks source link

Misleading error message on empty world #84

Open xynydev opened 2 years ago

xynydev commented 2 years ago

I've tried with both the latest releases and a new build using the commands in Readme.md. Anything in #64 didn't help.

Here's the command I'm running: [path-to-mcmap-executable] -from -2006464 -1995968 -to -2006337 -1995841 -vv [path-to-world]

And here's the output of the command:

[Debug] Parsing [path-to-world]/level.dat
[Debug] Processed boundaries: 2147483647.2147483647.-64 ~> -2147483648.-2147483648.319 (North-West)
[Error] Nothing to render: -from X Z has to be <= -to X Z
Usage: [path-to-mcmap-executable] <options> WORLDPATH
...

I've also tried swapping -from and -to. As you can see, -from X Z <= -to X Z.

spoutn1k commented 2 years ago

When you input boundaries, mcmap will intersect your boundaries with the available map and render that.

This line: [Debug] Processed boundaries: 2147483647.2147483647.-64 ~> -2147483648.-2147483648.319 (North-West) means that the intersected coordinates are undefined; maybe your world is empty, maybe you put the wrong dimension; either way, it did not find terrain to render.

The whole argument parsing needs to be remade. This is confusing and misleading.

To make sure, look at the output of ls [path-to-world]/region (for the overworld).

xynydev commented 2 years ago

Thanks for this, turns out it was my fault and I was just executing the command with the wrong world directory...

deltreey commented 2 years ago

I cannot figure out how you managed to do this. I was trying to create a fix, but I cannot reproduce this issue. When you generate a new world, it automatically generates some spawn chunks. If you close minecraft too early, or something else weird, it doesn't create and level.dat files, and there are logical error messages already built in for this.

[2022-06-16 20:34:02.053] [mcmap_cli] [error] Error opening file '/home/deltreey/.local/share/multimc/instances/1.18.2/.minecraft/saves/New/level.dat': No such file or directory
[2022-06-16 20:34:02.053] [mcmap_cli] [error] Error opening file 'World/level.dat': No such file or directory
[2022-06-16 20:34:02.053] [mcmap_cli] [error] Given folder does not seem to be a save file

Can you give some instructions on how to reproduce this error?

spoutn1k commented 2 years ago

This error arises when the requested area does not overlap with the available terrain. Try rendering a new world with the -from -5000 -5000 -to -4990 -4990 options (the values do not really matter).

mcmap calculates the intersection of what is requested and what is available. When this is an empty area, the area has its coordinates set to special values, and this is not checked in the argument parsing code. Those values are the integer boundaries (minX/Z to the maximum possible value, maxX/Z to the minimum). This triggers the error that you see.

The whole argument parsing code is legacy from the start of the project. One needs to take it all down and use a modern c++ library to parse the command line.

deltreey commented 2 years ago

probably too far out of my comfort zone then. I'll leave this for someone better with C++