3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-25 18:40:05 +01:00

Made /thru work better.

Dieser Commit ist enthalten in:
sk89q 2010-10-19 20:33:50 -07:00
Ursprung 9124cdd91f
Commit ebf5b97451
2 geänderte Dateien mit 14 neuen und 10 gelöschten Zeilen

Datei anzeigen

@ -86,26 +86,30 @@ public class SMWorldEditPlayer extends WorldEditPlayer {
* @return whether the player was pass through
*/
public boolean passThroughForwardWall(int range) {
int free = 0;
int spots = 0;
boolean foundNext = false;
int searchDist = 0;
HitBlox hitBlox = new HitBlox(player, range, 0.2);
Block block;
free = hitBlox.getLastBlock().getType() == 0 ? 1 : 0;
while ((block = hitBlox.getNextBlock()) != null) {
searchDist++;
if (searchDist > 20) {
return false;
}
if (block.getType() == 0) {
free++;
if (spots >= 1) {
Vector v = new Vector(block.getX(), block.getY() + 1, block.getZ());
if (foundNext) {
Vector v = new Vector(block.getX(), block.getY() - 1, block.getZ());
if (server.getBlockType(v) == 0) {
setPosition(v.subtract(0, 1, 0));
setPosition(v.add(0.5, 0, 0.5));
return true;
}
}
} else {
free = 0;
spots++;
foundNext = true;
}
}

Datei anzeigen

@ -329,7 +329,7 @@ public class WorldEdit {
// Go through a wall
} else if (split[0].equalsIgnoreCase("/thru")) {
checkArgs(split, 0, 0, split[0]);
if (player.passThroughForwardWall(300)) {
if (player.passThroughForwardWall(6)) {
player.print("Whoosh!");
} else {
player.printError("No free spot ahead of you found.");