Search in sources :

Example 1 with EntityEntryPod

use of micdoodle8.mods.galacticraft.planets.asteroids.entities.EntityEntryPod in project Galacticraft by micdoodle8.

the class TeleportTypeAsteroids method onSpaceDimensionChanged.

@Override
public void onSpaceDimensionChanged(World newWorld, EntityPlayerMP player, boolean ridingAutoRocket) {
    if (!ridingAutoRocket && player != null) {
        GCPlayerStats stats = GCPlayerStats.get(player);
        if (stats.getTeleportCooldown() <= 0) {
            if (player.capabilities.isFlying) {
                player.capabilities.isFlying = false;
            }
            if (!newWorld.isRemote) {
                EntityEntryPod entryPod = new EntityEntryPod(player);
                boolean previous = CompatibilityManager.forceLoadChunks((WorldServer) newWorld);
                entryPod.forceSpawn = true;
                newWorld.spawnEntity(entryPod);
                CompatibilityManager.forceLoadChunksEnd((WorldServer) newWorld, previous);
            }
            stats.setTeleportCooldown(10);
        }
    }
}
Also used : GCPlayerStats(micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats) EntityEntryPod(micdoodle8.mods.galacticraft.planets.asteroids.entities.EntityEntryPod)

Aggregations

GCPlayerStats (micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats)1 EntityEntryPod (micdoodle8.mods.galacticraft.planets.asteroids.entities.EntityEntryPod)1