3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-13 22:50:06 +01:00

Allow scatter command brush to use FAWE commands. Best for scatter sphere, etc.

Dieser Commit ist enthalten in:
dordsor21 2021-09-18 17:08:03 +01:00
Ursprung 51aa500857
Commit 34301b446a
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B
4 geänderte Dateien mit 59 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -65,6 +65,7 @@ public class ScatterBrush implements Brush {
visited.add(position);
}
LocalBlockVectorSet placed = new LocalBlockVectorSet();
placed.setOffset(position.getX(), position.getZ());
int maxFails = 1000;
for (int i = 0; i < count; i++) {
int index = ThreadLocalRandom.current().nextInt(length);

Datei anzeigen

@ -2,6 +2,7 @@ package com.fastasyncworldedit.core.command.tool.brush;
import com.fastasyncworldedit.core.math.LocalBlockVectorSet;
import com.fastasyncworldedit.core.util.StringMan;
import com.fastasyncworldedit.core.wrappers.LocationMaskedPlayerWrapper;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.entity.Player;
@ -41,7 +42,10 @@ public class ScatterCommand extends ScatterBrush {
player.setSelection(selector);
List<String> cmds = StringMan.split(replaced, ';');
for (String cmd : cmds) {
CommandEvent event = new CommandEvent(player, cmd);
CommandEvent event = new CommandEvent(
new LocationMaskedPlayerWrapper(player, player.getLocation().setPosition(position.toVector3()), false),
cmd
);
PlatformCommandManager.getInstance().handleCommandOnCurrentThread(event);
}
}

Datei anzeigen

@ -24,6 +24,14 @@ public class LocationMaskedPlayerWrapper extends AsyncPlayer {
return position;
}
@Override
public void setPosition(final Vector3 pos) {
if (allowTeleport) {
super.setPosition(pos);
update();
}
}
private void update() {
this.position = super.getLocation();
}

Datei anzeigen

@ -206,6 +206,51 @@ public class PlayerProxy extends AbstractPlayerActor {
basePlayer.sendFakeBlock(pos, block);
}
@Override
public void findFreePosition(final Location searchPos) {
basePlayer.findFreePosition(searchPos);
}
@Override
public void setOnGround(final Location searchPos) {
basePlayer.setOnGround(searchPos);
}
@Override
public void findFreePosition() {
basePlayer.findFreePosition();
}
@Override
public boolean ascendLevel() {
return basePlayer.ascendLevel();
}
@Override
public boolean descendLevel() {
return basePlayer.descendLevel();
}
@Override
public boolean ascendToCeiling(final int clearance) {
return basePlayer.ascendToCeiling(clearance);
}
@Override
public boolean ascendToCeiling(final int clearance, final boolean alwaysGlass) {
return basePlayer.ascendToCeiling(clearance, alwaysGlass);
}
@Override
public boolean ascendUpwards(final int distance) {
return basePlayer.ascendUpwards(distance);
}
@Override
public boolean ascendUpwards(final int distance, final boolean alwaysGlass) {
return basePlayer.ascendUpwards(distance, alwaysGlass);
}
@Override
public void floatAt(int x, int y, int z, boolean alwaysGlass) {
basePlayer.floatAt(x, y, z, alwaysGlass);