From 9b9534360136d69e2fd488fb58791066d0272b1f Mon Sep 17 00:00:00 2001 From: wea_ondara Date: Mon, 3 Aug 2020 17:34:06 +0200 Subject: [PATCH] keep original constructor to not break plugin that use the api --- .../function/entity/ExtentEntityCopy.java | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 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 fda0e0103..04d179bdf 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 @@ -60,6 +60,28 @@ public class ExtentEntityCopy implements EntityFunction { * @param to the destination position * @param transform the transformation to apply to both position and orientation */ + @Deprecated + public ExtentEntityCopy(Vector3 from, Extent destination, Vector3 to, Transform transform) { + checkNotNull(from); + checkNotNull(destination); + checkNotNull(to); + checkNotNull(transform); + this.source = null; + this.destination = destination; + this.from = from; + this.to = to; + this.transform = transform; + } + + /** + * Create a new instance. + * + * @param source the source {@code Extent} + * @param from the from position + * @param destination the destination {@code Extent} + * @param to the destination position + * @param transform the transformation to apply to both position and orientation + */ public ExtentEntityCopy(Extent source, Vector3 from, Extent destination, Vector3 to, Transform transform) { checkNotNull(source); checkNotNull(from); @@ -132,8 +154,12 @@ public class ExtentEntityCopy implements EntityFunction { } else if (tag.containsKey("PersistentIDMSB")) { uuid = new UUID(tag.getLong("PersistentIDMSB"), tag.getLong("PersistentIDLSB")); } - if (uuid != null) - source.removeEntity(entity.getLocation().getBlockX(), entity.getLocation().getBlockY(), entity.getLocation().getBlockZ(), uuid); + if (uuid != null) { + Extent src = source != null ? source : entity.getExtent(); + if (src != null) { + src.removeEntity(entity.getLocation().getBlockX(), entity.getLocation().getBlockY(), entity.getLocation().getBlockZ(), uuid); + } + } } return success;