Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-09-06 16:12:51 +02:00
Added /chunkinfo.
Dieser Commit ist enthalten in:
Ursprung
c25f13c3f0
Commit
0a288acbaa
@ -161,6 +161,7 @@ public class WorldEdit {
|
||||
commands.put("/jumpto", "Jump to the block that you are looking at");
|
||||
commands.put("/thru", "Go through the wall that you are looking at");
|
||||
commands.put("/ceil", "<Clearance> - Get to the ceiling");
|
||||
commands.put("/chunkinfo", "Get the filename of the chunk that you are in");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -341,7 +342,7 @@ public class WorldEdit {
|
||||
checkArgs(split, 0, 1, split[0]);
|
||||
int clearence = split.length > 1 ?
|
||||
Math.max(0, Integer.parseInt(split[1])) : 0;
|
||||
|
||||
|
||||
if (player.ascendToCeiling(clearence)) {
|
||||
player.print("Whoosh!");
|
||||
} else {
|
||||
@ -857,12 +858,41 @@ public class WorldEdit {
|
||||
player.printError("Angles must be divisible by 90 degrees.");
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
// Get chunk filename
|
||||
} else if (split[0].equalsIgnoreCase("/chunkinfo")) {
|
||||
checkArgs(split, 0, 0, split[0]);
|
||||
|
||||
Vector pos = player.getBlockIn();
|
||||
int chunkX = (int)Math.floor(pos.getBlockX() / 16.0);
|
||||
int chunkZ = (int)Math.floor(pos.getBlockZ() / 16.0);
|
||||
|
||||
String folder1 = Integer.toString(divisorMod(chunkX, 64), 36);
|
||||
String folder2 = Integer.toString(divisorMod(chunkZ, 64), 36);
|
||||
String filename = "c." + Integer.toString(chunkX, 36)
|
||||
+ "." + Integer.toString(chunkZ, 36) + ".dat";
|
||||
|
||||
player.print("Chunk: " + chunkX + ", " + chunkZ);
|
||||
player.print(folder1 + "/" + folder2 + "/" + filename);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Modulus, divisor-style.
|
||||
*
|
||||
* @param a
|
||||
* @param n
|
||||
* @return
|
||||
*/
|
||||
private static int divisorMod(int a, int n) {
|
||||
return (int)(a - n * Math.floor(Math.floor(a) / (double)n));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the direction vector for a player's direction. May return
|
||||
* null if a direction could not be found.
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren