Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-03 01:50:07 +01:00
Made /thru work better.
Dieser Commit ist enthalten in:
Ursprung
9124cdd91f
Commit
ebf5b97451
@ -86,26 +86,30 @@ public class SMWorldEditPlayer extends WorldEditPlayer {
|
|||||||
* @return whether the player was pass through
|
* @return whether the player was pass through
|
||||||
*/
|
*/
|
||||||
public boolean passThroughForwardWall(int range) {
|
public boolean passThroughForwardWall(int range) {
|
||||||
int free = 0;
|
boolean foundNext = false;
|
||||||
int spots = 0;
|
int searchDist = 0;
|
||||||
|
|
||||||
HitBlox hitBlox = new HitBlox(player, range, 0.2);
|
HitBlox hitBlox = new HitBlox(player, range, 0.2);
|
||||||
Block block;
|
Block block;
|
||||||
|
|
||||||
free = hitBlox.getLastBlock().getType() == 0 ? 1 : 0;
|
|
||||||
while ((block = hitBlox.getNextBlock()) != null) {
|
while ((block = hitBlox.getNextBlock()) != null) {
|
||||||
|
searchDist++;
|
||||||
|
|
||||||
|
if (searchDist > 20) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (block.getType() == 0) {
|
if (block.getType() == 0) {
|
||||||
free++;
|
if (foundNext) {
|
||||||
if (spots >= 1) {
|
Vector v = new Vector(block.getX(), block.getY() - 1, block.getZ());
|
||||||
Vector v = new Vector(block.getX(), block.getY() + 1, block.getZ());
|
|
||||||
if (server.getBlockType(v) == 0) {
|
if (server.getBlockType(v) == 0) {
|
||||||
setPosition(v.subtract(0, 1, 0));
|
setPosition(v.add(0.5, 0, 0.5));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
free = 0;
|
foundNext = true;
|
||||||
spots++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,7 +329,7 @@ public class WorldEdit {
|
|||||||
// Go through a wall
|
// Go through a wall
|
||||||
} else if (split[0].equalsIgnoreCase("/thru")) {
|
} else if (split[0].equalsIgnoreCase("/thru")) {
|
||||||
checkArgs(split, 0, 0, split[0]);
|
checkArgs(split, 0, 0, split[0]);
|
||||||
if (player.passThroughForwardWall(300)) {
|
if (player.passThroughForwardWall(6)) {
|
||||||
player.print("Whoosh!");
|
player.print("Whoosh!");
|
||||||
} else {
|
} else {
|
||||||
player.printError("No free spot ahead of you found.");
|
player.printError("No free spot ahead of you found.");
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren