Fix door relative rotation (dungeon schematics will have to be fixed too)

This commit is contained in:
Runemoro 2018-03-20 19:09:23 -04:00
parent 24c02fba5d
commit 599804a914
5 changed files with 12 additions and 5 deletions

View file

@ -121,7 +121,7 @@ public abstract class BlockDimensionalDoor extends BlockDoor implements IRiftPro
@Override
public TileEntityEntranceRift createNewTileEntity(World world, int meta) {
TileEntityEntranceRift rift = new TileEntityEntranceRift();
rift.orientation = getStateFromMeta(meta).getValue(BlockDoor.FACING).getOpposite();
rift.setOrientation(getStateFromMeta(meta).getValue(BlockDoor.FACING).getOpposite());
rift.extendUp += 1;
return rift;
}

View file

@ -69,7 +69,7 @@ public class BlockDimensionalPortal extends BlockDimensionalDoor { // TODO: conv
@Override
public TileEntityEntranceRift createNewTileEntity(World world, int meta) {
TileEntityEntranceRift rift = new TileEntityEntranceRift();
rift.orientation = getStateFromMeta(meta).getValue(BlockDoor.FACING).getOpposite();
rift.setOrientation(getStateFromMeta(meta).getValue(BlockDoor.FACING).getOpposite());
rift.extendUp += 1;
rift.pushIn = 0.5;
return rift;

View file

@ -59,7 +59,7 @@ public abstract class BlockDimensionalTrapdoor extends BlockTrapDoor implements
@Override
public TileEntityEntranceRift createNewTileEntity(World world, int meta) {
TileEntityEntranceRift rift = new TileEntityEntranceRift();
rift.orientation = EnumFacing.UP;
rift.setOrientation(EnumFacing.UP);
return rift;
}

View file

@ -188,7 +188,7 @@ import javax.annotation.Nonnull;
// Attempt a teleport
try {
if (destination.teleport(new RotatedLocation(new Location(world, pos), yaw, pitch), entity)) {
if (destination.teleport(new RotatedLocation(new Location(world, pos), yaw, pitch), entity)) { // TODO: yaw should be player's yaw % 90 for floating rifts
VirtualLocation vloc = VirtualLocation.fromLocation(new Location(entity.world, entity.getPosition()));
DimDoors.sendTranslatedMessage(entity, "You are at x = " + vloc.getX() + ", y = ?, z = " + vloc.getZ() + ", w = " + vloc.getDepth());
return true;

View file

@ -59,6 +59,12 @@ import java.util.Random;
public void setLockStatus(byte lockStatus) { this.lockStatus = lockStatus; markDirty(); }
public void setCloseAfterPassThrough(boolean closeAfterPassThrough) { this.closeAfterPassThrough = closeAfterPassThrough; markDirty(); }
public void setOrientation(EnumFacing orientation) {
this.orientation = orientation;
yaw = orientation.getHorizontalAngle();
pitch = orientation.getFrontOffsetY() * 90;
}
@Override
public boolean teleport(Entity entity) {
boolean status = super.teleport(entity);
@ -72,7 +78,8 @@ import java.util.Random;
@Override
public void teleportTo(Entity entity, float fromYaw, float fromPitch) {
if (relativeRotation) {
TeleportUtils.teleport(entity, new Location(world, pos.offset(orientation, tpOffset)), orientation.getHorizontalAngle() + entity.rotationYaw - fromYaw, entity.rotationPitch - fromPitch);
TeleportUtils.teleport(entity, new Location(world, pos.offset(orientation, tpOffset)), orientation.getHorizontalAngle() + entity.rotationYaw - fromYaw, entity.rotationPitch);
// TODO: velocity
} else {
teleportTo(entity);
}