优化了mca计算方式

This commit is contained in:
zhangyuheng 2024-03-29 22:19:29 +08:00
parent d55b46f657
commit 02839f7f3b
2 changed files with 9 additions and 5 deletions

View File

@ -6,7 +6,7 @@
<groupId>cn.lunadeer</groupId>
<artifactId>Dominion</artifactId>
<version>1.13.4-beta</version>
<version>1.13.6-beta</version>
<packaging>jar</packaging>
<name>Dominion</name>

View File

@ -46,10 +46,10 @@ public class Operator {
Integer world_x2 = dom.getX2();
Integer world_z1 = dom.getZ1();
Integer world_z2 = dom.getZ2();
int mca_x1 = world_x1 / 512 - 1;
int mca_x2 = world_x2 / 512 + 1;
int mca_z1 = world_z1 / 512 - 1;
int mca_z2 = world_z2 / 512 + 1;
int mca_x1 = convertWorld2Mca(world_x1) - 1;
int mca_x2 = convertWorld2Mca(world_x2) + 1;
int mca_z1 = convertWorld2Mca(world_z1) - 1;
int mca_z2 = convertWorld2Mca(world_z2) + 1;
for (int x = mca_x1; x <= mca_x2; x++) {
for (int z = mca_z1; z <= mca_z2; z++) {
String file_name = "r." + x + "." + z + ".mca";
@ -103,4 +103,8 @@ public class Operator {
});
}
private static int convertWorld2Mca(int world) {
return world < 0 ? world / 512 - 1 : world / 512;
}
}