mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
Fix entities copying to original location.
Fixes WORLDEDIT-3275.
This commit is contained in:
parent
78a8683df3
commit
642f2a1f58
@ -89,19 +89,19 @@ public class ExtentEntityCopy implements EntityFunction {
|
|||||||
BaseEntity state = entity.getState();
|
BaseEntity state = entity.getState();
|
||||||
if (state != null) {
|
if (state != null) {
|
||||||
Location newLocation;
|
Location newLocation;
|
||||||
|
Location location = entity.getLocation();
|
||||||
|
|
||||||
if (!transform.isIdentity()) {
|
Vector pivot = from.round().add(0.5, 0.5, 0.5);
|
||||||
Location location = entity.getLocation();
|
Vector newPosition = transform.apply(location.toVector().subtract(pivot));
|
||||||
Vector pivot = from.round().add(0.5, 0.5, 0.5);
|
Vector newDirection;
|
||||||
Vector newPosition = transform.apply(location.toVector().subtract(pivot));
|
|
||||||
Vector newDirection = transform.apply(location.getDirection()).subtract(transform.apply(Vector.ZERO)).normalize();
|
|
||||||
newLocation = new Location(destination, newPosition.add(to.round().add(0.5, 0.5, 0.5)), newDirection);
|
|
||||||
|
|
||||||
// Some entities store their position data in NBT
|
newDirection = transform.isIdentity() ?
|
||||||
state = transformNbtData(state);
|
entity.getLocation().getDirection()
|
||||||
} else {
|
: transform.apply(location.getDirection()).subtract(transform.apply(Vector.ZERO)).normalize();
|
||||||
newLocation = entity.getLocation();
|
newLocation = new Location(destination, newPosition.add(to.round().add(0.5, 0.5, 0.5)), newDirection);
|
||||||
}
|
|
||||||
|
// Some entities store their position data in NBT
|
||||||
|
state = transformNbtData(state);
|
||||||
|
|
||||||
boolean success = destination.createEntity(newLocation, state) != null;
|
boolean success = destination.createEntity(newLocation, state) != null;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user