Querz / mcaselector

A tool to select chunks from Minecraft worlds for deletion or export.
MIT License
3.25k stars 177 forks source link

Query not selecting the correct chunks #74

Closed hyperdefined closed 4 years ago

hyperdefined commented 4 years ago

Hello, I run an anarchy server and I wanted to delete chunks that are far out with little to no inhabited time to clear up some space. Players use elytras to travel, so the ticks counted in each chunk will be low. I am trying to delete chunks on the Z+ axis.

However, my query command seems to be picking up chunks out of the query.

sudo java -jar mcaselector-1.9.3.jar --headless --mode select --output test.csv --world "/world/region" --query "xPos >= -100000 AND xPos <= 100000 AND zPos >= 1000000 AND InhabitedTime <= 1

So this should get all the chunks that are AT LEAST Z >1000000. However, it seems to be selecting chunks under Z > 1000000.

Querz commented 4 years ago

Keep in mind that xPos and zPos are chunk coordinates, not block coordinates. Can you give an example of a chunk that was selected but shouldn't be?

hyperdefined commented 4 years ago

Is there a way I can convert from block to chunk coordinates?

My output file is always empty. However, it shows the region files and the percentages when I run the command. Is that different from the output?

Querz commented 4 years ago

You can divide the coordinates by 16 or use this tool. The MCASelector will check every file for its file name. The name of an mca file is the region coordinate so by using the xPos and zPos conditions in the query it can skip files by just checking their name and therefore not having to read the entire file.

How many mca files does your world have? I assume the command runs relatively fast with your current parameters because it doesn't read any files.

Your output is probably empty because of the mix-up with chunk and block coordinates.

hyperdefined commented 4 years ago
java -jar mcaselector-1.9.3.jar --mode select --output "test.csv" --world "/DestroyMC/world/region/" --query "zPos <= -156250 AND InhabitedTime < 10seconds" --headless

I adjusted my command to do this instead. However, it still has no output to "test.csv." It creates the file but it's empty.

There are 222,696 region files. I am running a Paper server so it splits the worlds up. It runs really fast still.

hyperdefined commented 4 years ago

Turns out I was doing the wrong query. That explains it.

How would I read the output?

This is an example line: 28;5522;915;176729

Querz commented 4 years ago

<region-x>;<region-z>;<chunk-x>;<chunk-z> region-x and region-z are the region coordinates that are also used in the file names of the mca files: r.<region-x>.<region-z>.mca, e.g. r.28.5522.mca. chunk-x and chunk-z are the coordinates of the chunk that has been selected in chunk coordinates. If an entire region has been selected (all 1024 chunks), the line only contains the region coordinates like so: <region-x>;<region-z>.

You can use this file to delete, export or import chunks by applying them as an input to your command. If you simply want to delete chunks though, you can also run --mode delete with the same query as you used for --mode select. Keep in mind though that in deletion mode, all chunks will be deleted that are a positive match for the query. Always make backups before altering your world.

hyperdefined commented 4 years ago

Thanks, I tried to delete the chunks using the query and it finally worked.