@Override public BaseEntity getState() { return entity.getState(); }
@Override public boolean remove() { Location location = entity.getLocation(); BaseEntity state = entity.getState(); boolean success = entity.remove(); if (state != null && success) { changeSet.add(new EntityRemove(location, state)); } return success; }
@Override public boolean apply(Entity entity) throws WorldEditException { BaseEntity state = entity.getState(); if (state != null) { Location newLocation; Location location = entity.getLocation(); Vector3 pivot = from.round().add(0.5, 0.5, 0.5); Vector3 newPosition = transform.apply(location.toVector().subtract(pivot)); Vector3 newDirection; newDirection = transform.isIdentity() ? entity.getLocation().getDirection() : transform.apply(location.getDirection()).subtract(transform.apply(Vector3.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 state = transformNbtData(state); boolean success = destination.createEntity(newLocation, state) != null; // Remove if (isRemoving() && success) { entity.remove(); } return success; } else { return false; } }