mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 09:47:38 +00:00
change entity list to ignore player when pasting
This commit is contained in:
parent
74fade22a6
commit
cf96c478be
@ -274,6 +274,10 @@ public class Schematic {
|
|||||||
final int entityOffsetZ = to.getBlockZ() - origin.getBlockZ();
|
final int entityOffsetZ = to.getBlockZ() - origin.getBlockZ();
|
||||||
// entities
|
// entities
|
||||||
for (Entity entity : clipboard.getEntities()) {
|
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 pos = entity.getLocation();
|
||||||
Location newPos = new Location(pos.getExtent(), pos.getX() + entityOffsetX, pos.getY() + entityOffsetY, pos.getZ() + entityOffsetZ, pos.getYaw(), pos.getPitch());
|
Location newPos = new Location(pos.getExtent(), pos.getX() + entityOffsetX, pos.getY() + entityOffsetY, pos.getZ() + entityOffsetZ, pos.getYaw(), pos.getPitch());
|
||||||
extent.createEntity(newPos, entity.getState());
|
extent.createEntity(newPos, entity.getState());
|
||||||
|
@ -50,7 +50,7 @@ import com.sk89q.worldedit.math.transform.Transform;
|
|||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
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);
|
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++) {
|
for (int i = 0; i < repetitions; i++) {
|
||||||
Operations.completeBlindly(blockCopy);
|
Operations.completeBlindly(blockCopy);
|
||||||
|
Loading…
Reference in New Issue
Block a user