mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-01 02:46:41 +00:00
Current progress with update
This commit is contained in:
@ -22,17 +22,23 @@ package com.sk89q.worldedit.function.entity;
|
||||
import com.boydti.fawe.util.ReflectionUtils;
|
||||
import com.sk89q.jnbt.ByteTag;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.jnbt.FloatTag;
|
||||
import com.sk89q.jnbt.IntTag;
|
||||
import com.sk89q.jnbt.ListTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import com.sk89q.jnbt.CompoundTagBuilder;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.EntityFunction;
|
||||
import com.sk89q.worldedit.internal.helper.MCDirections;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.util.Direction;
|
||||
import com.sk89q.worldedit.util.Direction.Flag;
|
||||
@ -50,8 +56,8 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
public class ExtentEntityCopy implements EntityFunction {
|
||||
|
||||
private final Extent destination;
|
||||
private final Vector from;
|
||||
private final Vector to;
|
||||
private final Vector3 from;
|
||||
private final Vector3 to;
|
||||
private final Transform transform;
|
||||
private boolean removing;
|
||||
|
||||
@ -63,7 +69,7 @@ public class ExtentEntityCopy implements EntityFunction {
|
||||
* @param to the destination position
|
||||
* @param transform the transformation to apply to both position and orientation
|
||||
*/
|
||||
public ExtentEntityCopy(Vector from, Extent destination, Vector to, Transform transform) {
|
||||
public ExtentEntityCopy(Vector3 from, Extent destination, Vector3 to, Transform transform) {
|
||||
checkNotNull(from);
|
||||
checkNotNull(destination);
|
||||
checkNotNull(to);
|
||||
@ -99,6 +105,7 @@ public class ExtentEntityCopy implements EntityFunction {
|
||||
Location newLocation;
|
||||
Location location = entity.getLocation();
|
||||
|
||||
<<<<<<< HEAD
|
||||
Vector pivot = from.round().add(0.5, 0.5, 0.5);
|
||||
Vector newPosition = transform.apply(location.toVector().subtract(pivot));
|
||||
Vector newDirection;
|
||||
@ -110,6 +117,19 @@ public class ExtentEntityCopy implements EntityFunction {
|
||||
newLocation = new Location(destination, newPosition.add(to.round().add(0.5, 0.5, 0.5)), newDirection);
|
||||
state = transformNbtData(state);
|
||||
}
|
||||
=======
|
||||
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);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
boolean success = destination.createEntity(newLocation, state) != null;
|
||||
|
||||
@ -147,9 +167,14 @@ public class ExtentEntityCopy implements EntityFunction {
|
||||
boolean hasFacing = tag.containsKey("Facing");
|
||||
|
||||
if (hasTilePosition) {
|
||||
<<<<<<< HEAD
|
||||
changed = true;
|
||||
Vector tilePosition = new Vector(tag.asInt("TileX"), tag.asInt("TileY"), tag.asInt("TileZ"));
|
||||
Vector newTilePosition = transform.apply(tilePosition.subtract(from)).add(to);
|
||||
=======
|
||||
Vector3 tilePosition = new Vector3(tag.asInt("TileX"), tag.asInt("TileY"), tag.asInt("TileZ"));
|
||||
BlockVector3 newTilePosition = transform.apply(tilePosition.subtract(from)).add(to).toBlockPoint();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
values.put("TileX", new IntTag(newTilePosition.getBlockX()));
|
||||
values.put("TileY", new IntTag(newTilePosition.getBlockY()));
|
||||
@ -168,7 +193,7 @@ public class ExtentEntityCopy implements EntityFunction {
|
||||
Direction direction = MCDirections.fromHanging(d);
|
||||
|
||||
if (direction != null) {
|
||||
Vector vector = transform.apply(direction.toVector()).subtract(transform.apply(Vector.ZERO)).normalize();
|
||||
Vector3 vector = transform.apply(direction.toVector()).subtract(transform.apply(Vector3.ZERO)).normalize();
|
||||
Direction newDirection = Direction.findClosest(vector, Flag.CARDINAL);
|
||||
|
||||
if (newDirection != null) {
|
||||
|
Reference in New Issue
Block a user