From 7257c7bb2b0cb22c7411ad9abc506454f1d9a044 Mon Sep 17 00:00:00 2001 From: sk89q Date: Fri, 20 Feb 2015 21:09:48 -0800 Subject: [PATCH] Don't transform entity positions if the isIdentity() == true. --- .../function/entity/ExtentEntityCopy.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/entity/ExtentEntityCopy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/entity/ExtentEntityCopy.java index d172d10c6..dde39bc01 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/entity/ExtentEntityCopy.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/entity/ExtentEntityCopy.java @@ -88,13 +88,19 @@ public class ExtentEntityCopy implements EntityFunction { public boolean apply(Entity entity) throws WorldEditException { BaseEntity state = entity.getState(); if (state != null) { - Location location = entity.getLocation(); - Vector newPosition = transform.apply(location.toVector().subtract(from)); - Vector newDirection = transform.apply(location.getDirection()).subtract(transform.apply(Vector.ZERO)).normalize(); - Location newLocation = new Location(destination, newPosition.add(to), newDirection); + Location newLocation; - // Some entities store their position data in NBT - state = transformNbtData(state); + if (!transform.isIdentity()) { + Location location = entity.getLocation(); + Vector newPosition = transform.apply(location.toVector().subtract(from)); + Vector newDirection = transform.apply(location.getDirection()).subtract(transform.apply(Vector.ZERO)).normalize(); + newLocation = new Location(destination, newPosition.add(to), newDirection); + + // Some entities store their position data in NBT + state = transformNbtData(state); + } else { + newLocation = entity.getLocation(); + } boolean success = destination.createEntity(newLocation, state) != null;