mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-06 20:56:41 +00:00
Move handling of hanging entities into ExtentEntityCopy.
This commit is contained in:
@ -55,28 +55,9 @@ class ForgeEntity implements Entity {
|
||||
|
||||
@Override
|
||||
public Location getLocation() {
|
||||
Vector position;
|
||||
float pitch;
|
||||
float yaw;
|
||||
|
||||
if (entity instanceof EntityHanging) {
|
||||
EntityHanging hanging = (EntityHanging) entity;
|
||||
|
||||
position = new Vector(hanging.xPosition, hanging.yPosition, hanging.zPosition);
|
||||
|
||||
Direction direction = MCDirections.fromHanging(hanging.hangingDirection);
|
||||
if (direction != null) {
|
||||
yaw = direction.toVector().toYaw();
|
||||
pitch = direction.toVector().toPitch();
|
||||
} else {
|
||||
yaw = (float) Math.toRadians(entity.rotationYaw);
|
||||
pitch = (float) Math.toRadians(entity.rotationPitch);
|
||||
}
|
||||
} else {
|
||||
position = new Vector(entity.posX, entity.posY, entity.posZ);
|
||||
yaw = (float) Math.toRadians(entity.rotationYaw);
|
||||
pitch = (float) Math.toRadians(entity.rotationPitch);
|
||||
}
|
||||
Vector position = new Vector(entity.posX, entity.posY, entity.posZ);
|
||||
float yaw = (float) Math.toRadians(entity.rotationYaw);
|
||||
float pitch = (float) Math.toRadians(entity.rotationPitch);
|
||||
|
||||
return new Location(ForgeAdapter.adapt(entity.worldObj), position, yaw, pitch);
|
||||
}
|
||||
|
@ -551,16 +551,6 @@ public class ForgeWorld extends AbstractWorld {
|
||||
|
||||
createdEntity.setLocationAndAngles(location.getX(), location.getY(), location.getZ(), (float) Math.toDegrees(location.getYaw()), (float) Math.toDegrees(location.getPitch()));
|
||||
|
||||
// Special handling for hanging entities
|
||||
if (createdEntity instanceof EntityHanging) {
|
||||
EntityHanging hanging = (EntityHanging) createdEntity;
|
||||
hanging.xPosition = location.getBlockX();
|
||||
hanging.yPosition = location.getBlockY();
|
||||
hanging.zPosition = location.getBlockZ();
|
||||
Direction direction = Direction.findClosest(location.getDirection(), Flag.CARDINAL);
|
||||
hanging.setDirection(MCDirections.toHanging(direction));
|
||||
}
|
||||
|
||||
world.spawnEntityInWorld(createdEntity);
|
||||
return new ForgeEntity(createdEntity);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user