use of ValkyrienWarfareBase.Interaction.ShipUUIDToPosData.ShipPositionData in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class AirshipMapCommand method execute.
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
String term = args[0];
if (term.equals("tpto")) {
String shipName = args[1];
if (args.length > 2) {
for (int i = 2; i < args.length; i++) {
shipName += " " + args[i];
}
}
Entity player = sender.getCommandSenderEntity();
World world = player.worldObj;
ShipNameUUIDData data = ShipNameUUIDData.get(world);
if (data.ShipNameToLongMap.containsKey(shipName)) {
long shipUUIDMostSig = data.ShipNameToLongMap.get(shipName);
ShipUUIDToPosData posData = ShipUUIDToPosData.get(world);
ShipPositionData positionData = posData.getShipPositionData(shipUUIDMostSig);
double posX = positionData.shipPosition.X;
double posY = positionData.shipPosition.Y;
double posZ = positionData.shipPosition.Z;
if (player instanceof EntityPlayerMP) {
EntityPlayerMP playerMP = (EntityPlayerMP) player;
((EntityPlayerMP) player).connection.setPlayerLocation(posX, posY, posZ, 0, 0);
}
}
}
if (term.equals("help")) {
sender.addChatMessage(new TextComponentString("tpto"));
}
}
use of ValkyrienWarfareBase.Interaction.ShipUUIDToPosData.ShipPositionData in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class CallRunner method getBedSpawnLocation.
public static BlockPos getBedSpawnLocation(BlockPos toReturn, World worldIn, BlockPos bedLocation, boolean forceSpawn) {
// System.out.println("Keep their heads ringing");
int chunkX = bedLocation.getX() >> 4;
int chunkZ = bedLocation.getZ() >> 4;
long chunkPos = ChunkPos.chunkXZ2Int(chunkX, chunkZ);
UUID shipManagingID = ValkyrienWarfareMod.chunkManager.getShipIDManagingPos_Persistant(worldIn, chunkX, chunkZ);
if (shipManagingID != null) {
ShipPositionData positionData = ValkyrienWarfareMod.chunkManager.getShipPosition_Persistant(worldIn, shipManagingID);
if (positionData != null) {
double[] lToWTransform = RotationMatrices.convertToDouble(positionData.lToWTransform);
Vector bedPositionInWorld = new Vector(bedLocation.getX() + .5D, bedLocation.getY() + .5D, bedLocation.getZ() + .5D);
RotationMatrices.applyTransform(lToWTransform, bedPositionInWorld);
bedPositionInWorld.Y += 1D;
bedLocation = new BlockPos(bedPositionInWorld.X, bedPositionInWorld.Y, bedPositionInWorld.Z);
return bedLocation;
} else {
System.err.println("A ship just had Chunks claimed persistant, but not any position data persistant");
}
}
return toReturn;
}
Aggregations