3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-03 01:50:07 +01:00
Dieser Commit ist enthalten in:
sk89q 2010-11-06 21:47:50 -07:00
Ursprung bf04191c5c
Commit 363372b160
3 geänderte Dateien mit 77 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -169,6 +169,7 @@ public class WorldEditListener extends PluginListener {
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("/up", "<Distance> - Go up some distance");
commands.put("/chunkinfo", "Get the filename of the chunk that you are in");
commands.put("/listchunks", "Print a list of used chunks");
commands.put("/delchunks", "Generate a shell script to delete chunks");
@ -442,6 +443,18 @@ public class WorldEditListener extends PluginListener {
}
return true;
// Go up
} else if (split[0].equalsIgnoreCase("/up")) {
checkArgs(split, 1, 1, split[0]);
int distance = Integer.parseInt(split[1]);
if (player.ascendUpwards(distance)) {
player.print("Whoosh!");
} else {
player.printError("You would hit something above you.");
}
return true;
// Set edit position #1
} else if (split[0].equalsIgnoreCase("//pos1")) {
checkArgs(split, 0, 0, split[0]);

Datei anzeigen

@ -225,6 +225,38 @@ public class WorldEditPlayer {
return false;
}
/**
* Just go up.
*
* @param distance
* @return whether the player was moved
*/
public boolean ascendUpwards(int distance) {
Vector pos = getBlockIn();
int x = pos.getBlockX();
int initialY = Math.max(0, pos.getBlockY());
int y = Math.max(0, pos.getBlockY() + 1);
int z = pos.getBlockZ();
int maxY = Math.min(128, initialY + distance);
while (y <= 129) {
if (!BlockType.canPassThrough(ServerInterface.getBlockType(new Vector(x, y, z)))) {
break; // Hit something
} else if (y > maxY + 1) {
break;
} else if (y == maxY + 1) {
ServerInterface.setBlockType(new Vector(x, y - 2, z),
BlockType.GLASS.getID());
setPosition(new Vector(x + 0.5, y - 1, z + 0.5));
return true;
}
y++;
}
return false;
}
/**
* Returns true if equal.
*

Datei anzeigen

@ -236,4 +236,36 @@ public enum BlockType {
|| id == 83 // Reed
|| id == 90; // Portal
}
/**
* Checks whether a block can be passed through.
*
* @param id
* @return
*/
public static boolean canPassThrough(int id) {
return id == 0 // Air
|| id == 6 // Saplings
|| id == 37 // Yellow flower
|| id == 38 // Red flower
|| id == 39 // Brown mushroom
|| id == 40 // Red mush room
|| id == 50 // Torch
|| id == 51 // Fire
|| id == 55 // Redstone wire
|| id == 59 // Crops
|| id == 63 // Sign post
|| id == 65 // Ladder
|| id == 66 // Minecart tracks
|| id == 68 // Wall sign
|| id == 69 // Lever
|| id == 70 // Stone pressure plate
|| id == 72 // Wooden pressure plate
|| id == 75 // Redstone torch (off)
|| id == 76 // Redstone torch (on)
|| id == 77 // Stone button
|| id == 78 // Snow
|| id == 83 // Reed
|| id == 90; // Portal
}
}