{
SpaceRace race = SpaceRaceManager.getSpaceRaceFromPlayer(player.getGameProfile().getName());
if (race == null || race.getTeamName().equals(SpaceRace.DEFAULT_NAME))
{
GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_OPEN_SPACE_RACE_GUI, new Object[] { }), player);
}
GCPlayerStats.get(player).openedSpaceRaceManager = true;
}
}
//This will speed things up a little
final GCPlayerStats GCPlayer = GCPlayerStats.get(player);
final boolean isInGCDimension = player.worldObj.provider instanceof IGalacticraftWorldProvider;
if (GCPlayer.cryogenicChamberCooldown > 0)
{
GCPlayer.cryogenicChamberCooldown--;
}
if (!player.onGround && GCPlayer.lastOnGround)
{
GCPlayer.touchedGround = true;
}
if (GCPlayer.teleportCooldown > 0)
{
GCPlayer.teleportCooldown--;
}
if (GCPlayer.chatCooldown > 0)
{
GCPlayer.chatCooldown--;
}
if (GCPlayer.openPlanetSelectionGuiCooldown > 0)
{
GCPlayer.openPlanetSelectionGuiCooldown--;
if (GCPlayer.openPlanetSelectionGuiCooldown == 1 && !GCPlayer.hasOpenedPlanetSelectionGui)
{
WorldUtil.toCelestialSelection(player, GCPlayer, GCPlayer.spaceshipTier);
GCPlayer.hasOpenedPlanetSelectionGui = true;
}
}
if (GCPlayer.usingParachute)
{
if (GCPlayer.lastParachuteInSlot != null)
{
player.fallDistance = 0.0F;
}
if (player.onGround)
{
GCPlayerHandler.setUsingParachute(player, GCPlayer, false);
}
}
this.checkCurrentItem(player);
if (GCPlayer.usingPlanetSelectionGui)
{
this.sendPlanetList(player, GCPlayer);
}
/* if (isInGCDimension || player.usingPlanetSelectionGui)
{
player.playerNetServerHandler.ticksForFloatKick = 0;
}
*/
if (GCPlayer.damageCounter > 0)
{
GCPlayer.damageCounter--;
}
if (isInGCDimension)
{
if (tick % 30 == 0)
{
this.sendAirRemainingPacket(player, GCPlayer);
this.sendThermalLevelPacket(player, GCPlayer);
}
if (player.ridingEntity instanceof EntityLanderBase)
{
GCPlayer.inLander = true;
GCPlayer.justLanded = false;
}
else
{
if (GCPlayer.inLander)
{
GCPlayer.justLanded = true;
}
GCPlayer.inLander = false;
}
if (player.onGround && GCPlayer.justLanded)
{
GCPlayer.justLanded = false;
//Set spawn point here if just descended from a lander for the first time
if (player.getBedLocation(player.worldObj.provider.dimensionId) == null)
{
int i = 30000000;
int j = Math.min(i, Math.max(-i, MathHelper.floor_double(player.posX + 0.5D)));
int k = Math.min(256, Math.max(0, MathHelper.floor_double(player.posY + 1.5D)));
int l = Math.min(i, Math.max(-i, MathHelper.floor_double(player.posZ + 0.5D)));
ChunkCoordinates coords = new ChunkCoordinates(j, k, l);
player.setSpawnChunk(coords, true, player.worldObj.provider.dimensionId);
}
GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_RESET_THIRD_PERSON, new Object[] { }), player);
}
if (player.worldObj.provider instanceof WorldProviderOrbit)
{
player.fallDistance = 0.0F;
if (GCPlayer.newInOrbit)
{
((WorldProviderOrbit) player.worldObj.provider).sendPacketsToClient(player);
GCPlayer.newInOrbit = false;
}
}
else
GCPlayer.newInOrbit = true;
}
else
GCPlayer.newInOrbit = true;
checkGear(player, GCPlayer, false);
if (GCPlayer.chestSpawnCooldown > 0)
{
GCPlayer.chestSpawnCooldown--;
if (GCPlayer.chestSpawnCooldown == 180)
{
if (GCPlayer.chestSpawnVector != null)
{
EntityParachest chest = new EntityParachest(player.worldObj, GCPlayer.rocketStacks, GCPlayer.fuelLevel);
chest.setPosition(GCPlayer.chestSpawnVector.x, GCPlayer.chestSpawnVector.y, GCPlayer.chestSpawnVector.z);
if (!player.worldObj.isRemote)
{
player.worldObj.spawnEntityInWorld(chest);
}
}
}
}
//
if (GCPlayer.launchAttempts > 0 && player.ridingEntity == null)
{
GCPlayer.launchAttempts = 0;
}
this.checkThermalStatus(player, GCPlayer);
this.checkOxygen(player, GCPlayer);
if (isInGCDimension && (GCPlayer.oxygenSetupValid != GCPlayer.lastOxygenSetupValid || tick % 100 == 0))
{
GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_UPDATE_OXYGEN_VALIDITY, new Object[] { GCPlayer.oxygenSetupValid }), player);
}
this.throwMeteors(player);
this.updateSchematics(player, GCPlayer);