Skip to content

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

@Delvin4519

Description

@Delvin4519

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions