mcmap icon indicating copy to clipboard operation
mcmap copied to clipboard

Misleading error message on empty world

Open xynydev opened this issue 3 years ago • 5 comments

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.

xynydev avatar Mar 18 '22 17:03 xynydev

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).

spoutn1k avatar Mar 19 '22 03:03 spoutn1k

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

xynydev avatar Mar 20 '22 09:03 xynydev

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?

deltreey avatar Jun 17 '22 00:06 deltreey

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.

spoutn1k avatar Jun 18 '22 02:06 spoutn1k

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

deltreey avatar Jun 20 '22 01:06 deltreey