Cubitect / cubiomes-viewer

An efficient graphical Minecraft seed finder and map viewer.
GNU General Public License v3.0
1.02k stars 60 forks source link

[Feature suggestion], add "Copy region coordinates" to right click map menu #211

Closed Delvin4519 closed 1 year ago

Delvin4519 commented 1 year ago

I was going to file this prior to release, however, github was down that night and therefore wasn't able to do so.

This is an extremely minor quality of life feature. To my understanding, it's only 2 simple lines to add.

As the title says, when right clicking the map, the right click menu should show an extra option to copy the region file coordinates. Minecraft stores chunks in region files of 512x512 wide. This makes it easy to locate what region file a block or chunk is located in.

For example, block coordinates -2127, -5263 is located in region file -5, -11, in file r.-5.-11.mca, therefore, the right click menu shows this is such that can have the option to copy the region file coordinates "Copy region -5 -11".

The region file coordinates is simply FLOOR(coordinates / 512), which is divide the coordinates by 512, and round down to the lower integer. Alternatively, it's 2 to the power of 9.

Perhaps mapview.cpp can be updated with an extra 2 lines at line 335 and 341?

ln336: QString region = QString::asprintf("%d %d", p.x >> 9, p.z >> 9); ln343 menu.addAction(tr("Copy region: ")+region, [=](){ this->copyText(region); });

image

Block 210, -320 is in region file 0, -1. Block 2050, 1700 is in region file 4, 3. Block -38574, 23985 is in region file -76, 46.

Cubitect commented 1 year ago

Added in v3.2.1. -- I was just creating a patch anyway, since the noise views no longer worked.

Delvin4519 commented 1 year ago

ah, anyhow, looks fine, marking this as closed and resolved.