}
@Override
public void execute(WorldBorder wb, EntityPlayerMP player)
{
Vector2 vecp = ModuleWorldBorder.getDirectionVector(wb.center, player);
vecp.multiply(wb.rad);
vecp.add(new Vector2(wb.center.getX(), wb.center.getZ()));
double y = 0;
double rideY = 0;
if (player.worldObj.blockExists((int)vecp.getX(), (int)player.prevPosY, (int)vecp.getY()))
{
y = player.worldObj.getActualHeight();
if (player.ridingEntity != null)
{
rideY = player.ridingEntity.posY;
}
while (player.worldObj.blockExists((int)vecp.getX(), (int)y, (int)vecp.getY()))
{
y--;
if (player.isRiding())
rideY--;
}
y = y + 1;
OutputHandler.chatNotification(player, "Teleported.");
}
if (player.ridingEntity != null)
{
player.ridingEntity
.setLocationAndAngles(vecp.getX(), rideY, vecp.getY(), player.ridingEntity.rotationYaw, player.ridingEntity.rotationPitch);
player.playerNetServerHandler.setPlayerLocation(vecp.getX(), y, vecp.getY(), player.rotationYaw, player.rotationPitch);
}
else
{
player.playerNetServerHandler.setPlayerLocation(vecp.getX(), y, vecp.getY(), player.rotationYaw, player.rotationPitch);
}
}