jason-green-io/papyri

Help with older MC (v1.5.2) maps

Closed this issue · 11 comments

I've got maps from a MC server running 1.5.2 (needed for Better Than Wolves mod). Papryi can draw the maps but doesn't seem to construct the tiles correctly.

Screen Shot 2022-12-12 at 1 39 11 PM

Oh right! Ok. BTW supports the grid but I'm guessing the map data doesn't have it. Gives me something to work with.

Will close this. Thanks for the clue.

(Sorry to re-open. Need a bit more info.)

Seems I have zCenter and xCenter. The maps are drawn correctly. Then merged-maps seem to draw the upper-left map quadrant in the lower-right position with upper-left, upper-right, lower-left being left empty.

Looking at the code it seems all maps get translated into a scala 4 coordinate system and drawn on the merged-maps. I only have scale 4 maps so would expect to see the same images as in maps but instead seeing the shift mentioned above.

A picture being worth 1000 words I've added screen shots.
Screen Shot 2022-12-12 at 3 51 31 PM
Screen Shot 2022-12-12 at 3 51 44 PM
I've highlighted map_0 (center 0,0) in maps and merged-maps. Oddly merged-maps thinks the coordinates (I believe upper-left point) are -2048,2048. That would end up drawing only the upper-left quadrant of a 0,0 map in the lower-right quadrant of merged-maps.

I'd love to see the map_*.dat files so I can see the nbt in them.

Sure. I'm going to pull out colors since as you can see from the maps directory the data is in there.

map_0: {data: {zCenter: 0, width: 128s, scale: 4b, dimension: 0b, xCenter: 0, colors: [], height: 128s}}
map_1: {data: {zCenter: -2048, width: 128s, scale: 4b, dimension: 0b, xCenter: 0, colors: [], height: 128s}}
map_2: {data: {zCenter: 0, width: 128s, scale: 4b, dimension: 0b, xCenter: 2048, colors: [], height: 128s}}
map_3: {data: {zCenter: 0, width: 128s, scale: 4b, dimension: 0b, xCenter: -2048, colors: [], height: 128s}}
map_4: {data: {zCenter: 0, width: 128s, scale: 4b, dimension: 0b, xCenter: -4096, colors: [], height: 128s}}
map_5: {data: {zCenter: 2048, width: 128s, scale: 4b, dimension: 0b, xCenter: 0, colors: [], height: 128s}}
map_6: {data: {zCenter: 4096, width: 128s, scale: 4b, dimension: 0b, xCenter: 0, colors: [], height: 128s}}
map_7: {data: {zCenter: 4096, width: 128s, scale: 4b, dimension: 0b, xCenter: 0, colors: [], height: 128s}}

The maps 6 and 7 have the same coords. Map 6 was lost while not paying attention to creepers.

I'm wondering if Minecraft versions that use a grid are not centered at 0,0 but maybe another reference point? That is maybe my map_0 should have center 1024,1024.

Hmm. I tried to shift all coords by 1024 in papyri.py to test above. The maps are now fully drawn but not in their correct locations. :/
Screen Shot 2022-12-12 at 4 56 13 PM

Yup, so starting in 1.8, the centre of the map depends on where the level 0 map was created and zoom level, explained here: https://minecraft.fandom.com/wiki/Map#Zoom_details

Pretty sure the maps you have there are impossible to create in versions past 1.8. I take advantage of the >=1.8 method as as shortcut. Since I know all maps at lower levels will tile evenly without trimming in a "level 4" map.

Ah.

At zoom level 0, a map created on the point (0,0) has (0,0) at the center of the map. At higher zoom levels of the same map, the coordinate (0,0) is in the top left square of the map.

So I can probably just rewrite my xCenter, zCenter and it will work.

Nope. Seems the center gets used in some way I'm not figuring out yet.

Thanks for all the help! I think I've got enough info to play around and eventually tease it out.

In the end it was just adjusting the map's center when read in. Trick was to use an adjustment of 1024 - 64.