3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-25 02:20:07 +01:00

Merge pull request #5 from SirYwell/master

change entity list to ignore player when pasting
Dieser Commit ist enthalten in:
NotMyFault 2018-12-22 09:04:45 +01:00 committet von GitHub
Commit 8d5a655a2e
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 17 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -274,6 +274,10 @@ public class Schematic {
final int entityOffsetZ = to.getBlockZ() - origin.getBlockZ();
// entities
for (Entity entity : clipboard.getEntities()) {
// skip players on pasting schematic
if (entity.getState() != null && entity.getState().getType().getId().equals("minecraft:player")) {
continue;
}
Location pos = entity.getLocation();
Location newPos = new Location(pos.getExtent(), pos.getX() + entityOffsetX, pos.getY() + entityOffsetY, pos.getZ() + entityOffsetZ, pos.getYaw(), pos.getPitch());
extent.createEntity(newPos, entity.getState());

Datei anzeigen

@ -50,7 +50,7 @@ import com.sk89q.worldedit.math.transform.Transform;
import com.sk89q.worldedit.regions.Region;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
@ -347,7 +347,18 @@ public class ForwardExtentCopy implements Operation {
blockCopy = new RegionVisitor(region, copy, queue instanceof MappedFaweQueue ? (MappedFaweQueue) queue : null);
}
List<? extends Entity> entities = isCopyingEntities() ? source.getEntities(region) : new ArrayList<>();
List<? extends Entity> entities;
if (isCopyingEntities()) {
// filter players since they can't be copied
entities = source.getEntities()
.stream()
.filter(entity -> entity.getState() != null &&
entity.getState().getType().getId().equals("minecraft:player"))
.collect(Collectors.toList());
} else {
entities = new ArrayList<>();
}
for (int i = 0; i < repetitions; i++) {
Operations.completeBlindly(blockCopy);