Search in sources :

Example 1 with EntityCargoRocket

use of micdoodle8.mods.galacticraft.planets.mars.entities.EntityCargoRocket in project Galacticraft by micdoodle8.

the class PacketSimpleMars method handleServerSide.

@Override
public void handleServerSide(EntityPlayer player) {
    EntityPlayerMP playerBase = PlayerUtil.getPlayerBaseServerFromPlayer(player, false);
    switch(this.type) {
        case S_UPDATE_SLIMELING_DATA:
            Entity entity = player.worldObj.getEntityByID((Integer) this.data.get(0));
            if (entity instanceof EntitySlimeling) {
                EntitySlimeling slimeling = (EntitySlimeling) entity;
                int subType = (Integer) this.data.get(1);
                switch(subType) {
                    case 0:
                        if (player == slimeling.getOwner() && !slimeling.worldObj.isRemote) {
                            slimeling.setSittingAI(!slimeling.isSitting());
                            slimeling.setJumping(false);
                            slimeling.getNavigator().clearPathEntity();
                            slimeling.setAttackTarget(null);
                        }
                        break;
                    case 1:
                        if (player == slimeling.getOwner() && !slimeling.worldObj.isRemote) {
                            slimeling.slimelingName = (String) this.data.get(2);
                            slimeling.setName(slimeling.slimelingName);
                        }
                        break;
                    case 2:
                        if (player == slimeling.getOwner() && !slimeling.worldObj.isRemote) {
                            slimeling.age += 5000;
                        }
                        break;
                    case 3:
                        if (!slimeling.isInLove() && player == slimeling.getOwner() && !slimeling.worldObj.isRemote) {
                            slimeling.setInLove(playerBase);
                        }
                        break;
                    case 4:
                        if (player == slimeling.getOwner() && !slimeling.worldObj.isRemote) {
                            slimeling.attackDamage = Math.min(slimeling.attackDamage + 0.1F, 1.0F);
                        }
                        break;
                    case 5:
                        if (player == slimeling.getOwner() && !slimeling.worldObj.isRemote) {
                            slimeling.setHealth(slimeling.getHealth() + 5.0F);
                        }
                        break;
                    case 6:
                        if (player == slimeling.getOwner() && !slimeling.worldObj.isRemote) {
                            MarsUtil.openSlimelingInventory(playerBase, slimeling);
                        }
                        break;
                }
            }
            break;
        case S_WAKE_PLAYER:
            BlockPos c = playerBase.playerLocation;
            if (c != null) {
                EventWakePlayer event = new EventWakePlayer(playerBase, c, true, true, false, true);
                MinecraftForge.EVENT_BUS.post(event);
                playerBase.wakeUpPlayer(true, true, false);
            }
            break;
        case S_UPDATE_ADVANCED_GUI:
            TileEntity tile = player.worldObj.getTileEntity((BlockPos) this.data.get(1));
            switch((Integer) this.data.get(0)) {
                case 0:
                    if (tile instanceof TileEntityLaunchController) {
                        TileEntityLaunchController launchController = (TileEntityLaunchController) tile;
                        launchController.setFrequency((Integer) this.data.get(2));
                    }
                    break;
                case 1:
                    if (tile instanceof TileEntityLaunchController) {
                        TileEntityLaunchController launchController = (TileEntityLaunchController) tile;
                        launchController.setLaunchDropdownSelection((Integer) this.data.get(2));
                    }
                    break;
                case 2:
                    if (tile instanceof TileEntityLaunchController) {
                        TileEntityLaunchController launchController = (TileEntityLaunchController) tile;
                        launchController.setDestinationFrequency((Integer) this.data.get(2));
                    }
                    break;
                case 3:
                    if (tile instanceof TileEntityLaunchController) {
                        TileEntityLaunchController launchController = (TileEntityLaunchController) tile;
                        launchController.launchPadRemovalDisabled = (Integer) this.data.get(2) == 1;
                    }
                    break;
                case 4:
                    if (tile instanceof TileEntityLaunchController) {
                        TileEntityLaunchController launchController = (TileEntityLaunchController) tile;
                        launchController.setLaunchSchedulingEnabled((Integer) this.data.get(2) == 1);
                    }
                    break;
                case 5:
                    if (tile instanceof TileEntityLaunchController) {
                        TileEntityLaunchController launchController = (TileEntityLaunchController) tile;
                        launchController.requiresClientUpdate = true;
                    }
                    break;
                default:
                    break;
            }
            break;
        case S_UPDATE_CARGO_ROCKET_STATUS:
            Entity entity2 = player.worldObj.getEntityByID((Integer) this.data.get(0));
            if (entity2 instanceof EntityCargoRocket) {
                EntityCargoRocket rocket = (EntityCargoRocket) entity2;
                int subType = (Integer) this.data.get(1);
                switch(subType) {
                    default:
                        rocket.statusValid = rocket.checkLaunchValidity();
                        break;
                }
            }
            break;
        case S_SWITCH_LAUNCH_CONTROLLER_GUI:
            BlockPos pos = (BlockPos) this.data.get(0);
            TileEntity tile1 = player.worldObj.getTileEntity(pos);
            if (tile1 instanceof TileEntityLaunchController) {
                TileEntityLaunchController launchController = (TileEntityLaunchController) tile1;
                switch((Integer) this.data.get(1)) {
                    case 0:
                        MarsUtil.openAdvancedLaunchController(playerBase, launchController);
                        break;
                    case 1:
                        player.openGui(GalacticraftPlanets.instance, GuiIdsPlanets.MACHINE_MARS, player.worldObj, pos.getX(), pos.getY(), pos.getZ());
                        break;
                }
            }
            break;
        default:
            break;
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) EntityCargoRocket(micdoodle8.mods.galacticraft.planets.mars.entities.EntityCargoRocket) Entity(net.minecraft.entity.Entity) TileEntity(net.minecraft.tileentity.TileEntity) EntitySlimeling(micdoodle8.mods.galacticraft.planets.mars.entities.EntitySlimeling) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) BlockPos(net.minecraft.util.BlockPos) EventWakePlayer(micdoodle8.mods.galacticraft.core.event.EventWakePlayer) TileEntityLaunchController(micdoodle8.mods.galacticraft.planets.mars.tile.TileEntityLaunchController)

Example 2 with EntityCargoRocket

use of micdoodle8.mods.galacticraft.planets.mars.entities.EntityCargoRocket in project Galacticraft by micdoodle8.

the class WorldUtil method teleportEntity.

private static Entity teleportEntity(World worldNew, Entity entity, int dimID, ITeleportType type, boolean transferInv, EntityAutoRocket ridingRocket) {
    Entity otherRiddenEntity = null;
    if (entity.ridingEntity != null) {
        if (entity.ridingEntity instanceof EntitySpaceshipBase) {
            entity.mountEntity(entity.ridingEntity);
        } else if (entity.ridingEntity instanceof EntityCelestialFake) {
            entity.ridingEntity.setDead();
            entity.mountEntity(null);
        } else {
            otherRiddenEntity = entity.ridingEntity;
            entity.mountEntity(null);
        }
    }
    boolean dimChange = entity.worldObj != worldNew;
    // Make sure the entity is added to the correct chunk in the OLD world so that it will be properly removed later if it needs to be unloaded from that world
    entity.worldObj.updateEntityWithOptionalForce(entity, false);
    EntityPlayerMP player = null;
    Vector3 spawnPos = null;
    int oldDimID = GCCoreUtil.getDimensionID(entity.worldObj);
    if (ridingRocket != null) {
        ArrayList<TileEntityTelemetry> tList = ridingRocket.getTelemetry();
        NBTTagCompound nbt = new NBTTagCompound();
        ridingRocket.isDead = false;
        ridingRocket.riddenByEntity = null;
        ridingRocket.writeToNBTOptional(nbt);
        ((WorldServer) ridingRocket.worldObj).getEntityTracker().untrackEntity(ridingRocket);
        removeEntityFromWorld(ridingRocket.worldObj, ridingRocket, true);
        ridingRocket = (EntityAutoRocket) EntityList.createEntityFromNBT(nbt, worldNew);
        if (ridingRocket != null) {
            ridingRocket.setWaitForPlayer(true);
            if (ridingRocket instanceof IWorldTransferCallback) {
                ((IWorldTransferCallback) ridingRocket).onWorldTransferred(worldNew);
            }
        }
    }
    if (dimChange) {
        if (entity instanceof EntityPlayerMP) {
            player = (EntityPlayerMP) entity;
            World worldOld = player.worldObj;
            GCPlayerStats stats = GCPlayerStats.get(player);
            stats.setUsingPlanetSelectionGui(false);
            player.dimension = dimID;
            if (ConfigManagerCore.enableDebug) {
                GCLog.info("DEBUG: Sending respawn packet to player for dim " + dimID);
            }
            player.playerNetServerHandler.sendPacket(new S07PacketRespawn(dimID, player.worldObj.getDifficulty(), player.worldObj.getWorldInfo().getTerrainType(), player.theItemInWorldManager.getGameType()));
            if (worldNew.provider instanceof WorldProviderSpaceStation) {
                if (WorldUtil.registeredSpaceStations.containsKey(dimID)) // TODO This has never been effective before due to the earlier bug - what does it actually do?
                {
                    NBTTagCompound var2 = new NBTTagCompound();
                    SpaceStationWorldData.getStationData(worldNew, dimID, player).writeToNBT(var2);
                    GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_UPDATE_SPACESTATION_DATA, GCCoreUtil.getDimensionID(player.worldObj), new Object[] { dimID, var2 }), player);
                }
            }
            removeEntityFromWorld(worldOld, player, true);
            if (ridingRocket != null) {
                spawnPos = new Vector3(ridingRocket);
            } else {
                spawnPos = type.getPlayerSpawnLocation((WorldServer) worldNew, player);
            }
            forceMoveEntityToPos(entity, (WorldServer) worldNew, spawnPos, true);
            GCLog.info("Server attempting to transfer player " + PlayerUtil.getName(player) + " to dimension " + GCCoreUtil.getDimensionID(worldNew));
            if (worldNew.provider instanceof WorldProviderSpaceStation) {
                GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_RESET_THIRD_PERSON, GCCoreUtil.getDimensionID(worldNew), new Object[] {}), player);
            }
            player.capabilities.isFlying = false;
            player.mcServer.getConfigurationManager().preparePlayer(player, (WorldServer) worldOld);
            player.theItemInWorldManager.setWorld((WorldServer) worldNew);
            player.mcServer.getConfigurationManager().updateTimeAndWeatherForPlayer(player, (WorldServer) worldNew);
            player.mcServer.getConfigurationManager().syncPlayerInventory(player);
            for (Object o : player.getActivePotionEffects()) {
                PotionEffect var10 = (PotionEffect) o;
                player.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(player.getEntityId(), var10));
            }
            player.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(player.experience, player.experienceTotal, player.experienceLevel));
        } else // Non-player entity transfer i.e. it's an EntityCargoRocket or an empty rocket
        {
            ArrayList<TileEntityTelemetry> tList = null;
            if (entity instanceof EntitySpaceshipBase) {
                tList = ((EntitySpaceshipBase) entity).getTelemetry();
            }
            WorldUtil.removeEntityFromWorld(entity.worldObj, entity, true);
            NBTTagCompound nbt = new NBTTagCompound();
            entity.isDead = false;
            entity.writeToNBTOptional(nbt);
            entity = EntityList.createEntityFromNBT(nbt, worldNew);
            if (entity == null) {
                return null;
            }
            if (entity instanceof IWorldTransferCallback) {
                ((IWorldTransferCallback) entity).onWorldTransferred(worldNew);
            }
            forceMoveEntityToPos(entity, (WorldServer) worldNew, new Vector3(entity), true);
            if (tList != null && tList.size() > 0) {
                for (TileEntityTelemetry t : tList) {
                    t.addTrackedEntity(entity);
                }
            }
        }
    } else {
        // Same dimension player transfer
        if (entity instanceof EntityPlayerMP) {
            player = (EntityPlayerMP) entity;
            player.closeScreen();
            GCPlayerStats stats = GCPlayerStats.get(player);
            stats.setUsingPlanetSelectionGui(false);
            if (ridingRocket != null) {
                spawnPos = new Vector3(ridingRocket);
            } else {
                spawnPos = type.getPlayerSpawnLocation((WorldServer) entity.worldObj, (EntityPlayerMP) entity);
            }
            forceMoveEntityToPos(entity, (WorldServer) worldNew, spawnPos, false);
            GCLog.info("Server attempting to transfer player " + PlayerUtil.getName(player) + " within same dimension " + GCCoreUtil.getDimensionID(worldNew));
            if (worldNew.provider instanceof WorldProviderSpaceStation) {
                GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_RESET_THIRD_PERSON, GCCoreUtil.getDimensionID(worldNew), new Object[] {}), player);
            }
            player.capabilities.isFlying = false;
        }
    // Cargo rocket does not needs its location setting here, it will do that itself
    }
    // Update PlayerStatsGC
    if (player != null) {
        GCPlayerStats stats = GCPlayerStats.get(player);
        if (ridingRocket == null && type.useParachute() && stats.getExtendedInventory().getStackInSlot(4) != null && stats.getExtendedInventory().getStackInSlot(4).getItem() instanceof ItemParaChute) {
            GCPlayerHandler.setUsingParachute(player, stats, true);
        } else {
            GCPlayerHandler.setUsingParachute(player, stats, false);
        }
        if (stats.getRocketStacks() != null && stats.getRocketStacks().length > 0) {
            for (int stack = 0; stack < stats.getRocketStacks().length; stack++) {
                if (transferInv) {
                    if (stats.getRocketStacks()[stack] == null) {
                        if (stack == stats.getRocketStacks().length - 1) {
                            if (stats.getRocketItem() != null) {
                                stats.getRocketStacks()[stack] = new ItemStack(stats.getRocketItem(), 1, stats.getRocketType());
                            }
                        } else if (stack == stats.getRocketStacks().length - 2) {
                            stats.getRocketStacks()[stack] = stats.getLaunchpadStack();
                            stats.setLaunchpadStack(null);
                        }
                    }
                } else {
                    stats.getRocketStacks()[stack] = null;
                }
            }
        }
        if (transferInv && stats.getChestSpawnCooldown() == 0) {
            stats.setChestSpawnVector(type.getParaChestSpawnLocation((WorldServer) entity.worldObj, player, new Random()));
            stats.setChestSpawnCooldown(200);
        }
    }
    if (ridingRocket != null) {
        ridingRocket.forceSpawn = true;
        worldNew.spawnEntityInWorld(ridingRocket);
        ridingRocket.setWorld(worldNew);
        worldNew.updateEntityWithOptionalForce(ridingRocket, true);
        entity.mountEntity(ridingRocket);
        GCLog.debug("Entering rocket at : " + entity.posX + "," + entity.posZ + " rocket at: " + ridingRocket.posX + "," + ridingRocket.posZ);
    } else if (otherRiddenEntity != null) {
        if (dimChange) {
            World worldOld = otherRiddenEntity.worldObj;
            NBTTagCompound nbt = new NBTTagCompound();
            otherRiddenEntity.writeToNBTOptional(nbt);
            removeEntityFromWorld(worldOld, otherRiddenEntity, true);
            otherRiddenEntity = EntityList.createEntityFromNBT(nbt, worldNew);
            worldNew.spawnEntityInWorld(otherRiddenEntity);
            otherRiddenEntity.setWorld(worldNew);
        }
        otherRiddenEntity.setPositionAndRotation(entity.posX, entity.posY - 10, entity.posZ, otherRiddenEntity.rotationYaw, otherRiddenEntity.rotationPitch);
        worldNew.updateEntityWithOptionalForce(otherRiddenEntity, true);
    }
    if (entity instanceof EntityPlayerMP) {
        if (dimChange)
            FMLCommonHandler.instance().firePlayerChangedDimensionEvent((EntityPlayerMP) entity, oldDimID, dimID);
        // Spawn in a lander if appropriate
        type.onSpaceDimensionChanged(worldNew, (EntityPlayerMP) entity, ridingRocket != null);
    }
    return entity;
}
Also used : EntitySpaceshipBase(micdoodle8.mods.galacticraft.api.prefab.entity.EntitySpaceshipBase) Entity(net.minecraft.entity.Entity) TileEntityTelemetry(micdoodle8.mods.galacticraft.core.tile.TileEntityTelemetry) S07PacketRespawn(net.minecraft.network.play.server.S07PacketRespawn) PotionEffect(net.minecraft.potion.PotionEffect) EntityCelestialFake(micdoodle8.mods.galacticraft.core.entities.EntityCelestialFake) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) GCPlayerStats(micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats) S1DPacketEntityEffect(net.minecraft.network.play.server.S1DPacketEntityEffect) PacketSimple(micdoodle8.mods.galacticraft.core.network.PacketSimple) Vector3(micdoodle8.mods.galacticraft.api.vector.Vector3) ItemParaChute(micdoodle8.mods.galacticraft.core.items.ItemParaChute) IWorldTransferCallback(micdoodle8.mods.galacticraft.api.entity.IWorldTransferCallback) WorldProviderSpaceStation(micdoodle8.mods.galacticraft.core.dimension.WorldProviderSpaceStation) S1FPacketSetExperience(net.minecraft.network.play.server.S1FPacketSetExperience) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) ItemStack(net.minecraft.item.ItemStack)

Example 3 with EntityCargoRocket

use of micdoodle8.mods.galacticraft.planets.mars.entities.EntityCargoRocket in project Galacticraft by micdoodle8.

the class EntityCargoRocket method onReachAtmosphere.

@Override
public void onReachAtmosphere() {
    if (this.worldObj.isRemote) {
        // stop the sounds on the client - but do not reset, the rocket may start again
        this.stopRocketSound();
        return;
    }
    GCLog.debug("[Serverside] Cargo rocket reached space, heading to " + this.destinationFrequency);
    this.setTarget(true, this.destinationFrequency);
    if (this.targetVec != null) {
        GCLog.debug("Destination location = " + this.targetVec.toString());
        if (this.targetDimension != GCCoreUtil.getDimensionID(this.worldObj)) {
            GCLog.debug("Destination is in different dimension: " + this.targetDimension);
            WorldProvider targetDim = WorldUtil.getProviderForDimensionServer(this.targetDimension);
            if (targetDim != null && targetDim.worldObj instanceof WorldServer) {
                GCLog.debug("Loaded destination dimension " + this.targetDimension);
                this.setPosition(this.targetVec.getX() + 0.5F, this.targetVec.getY() + 800, this.targetVec.getZ() + 0.5F);
                Entity e = WorldUtil.transferEntityToDimension(this, this.targetDimension, (WorldServer) targetDim.worldObj, false, null);
                if (e instanceof EntityCargoRocket) {
                    GCLog.debug("Cargo rocket arrived at destination dimension, going into landing mode.");
                    e.setPosition(this.targetVec.getX() + 0.5F, this.targetVec.getY() + 800, this.targetVec.getZ() + 0.5F);
                    ((EntityCargoRocket) e).setLaunchPhase(EnumLaunchPhase.LANDING);
                // No setDead() following successful transferEntityToDimension() - see javadoc on that
                } else {
                    GCLog.info("Error: failed to recreate the cargo rocket in landing mode on target planet.");
                    e.setDead();
                    this.setDead();
                }
                return;
            }
            GCLog.info("Error: the server failed to load the dimension the cargo rocket is supposed to land in. Destroying rocket!");
            this.setDead();
            return;
        } else {
            GCLog.debug("Cargo rocket going into landing mode in same destination.");
            this.setPosition(this.targetVec.getX() + 0.5F, this.targetVec.getY() + 800, this.targetVec.getZ() + 0.5F);
            this.setLaunchPhase(EnumLaunchPhase.LANDING);
            return;
        }
    } else {
        GCLog.info("Error: the cargo rocket failed to find a valid landing spot when it reached space.");
        this.setDead();
    }
}
Also used : Entity(net.minecraft.entity.Entity) WorldProvider(net.minecraft.world.WorldProvider) IGalacticraftWorldProvider(micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider) WorldServer(net.minecraft.world.WorldServer)

Example 4 with EntityCargoRocket

use of micdoodle8.mods.galacticraft.planets.mars.entities.EntityCargoRocket in project Galacticraft by micdoodle8.

the class ItemTier2Rocket method placeRocketOnPad.

public static boolean placeRocketOnPad(ItemStack stack, World world, TileEntity tile, float centerX, float centerY, float centerZ) {
    // Check whether there is already a rocket on the pad
    if (tile instanceof TileEntityLandingPad) {
        if (((TileEntityLandingPad) tile).getDockedEntity() != null) {
            return false;
        }
    } else {
        return false;
    }
    EntityAutoRocket rocket;
    if (stack.getItemDamage() < 10) {
        rocket = new EntityTier2Rocket(world, centerX, centerY, centerZ, EnumRocketType.values()[stack.getItemDamage()]);
    } else {
        rocket = new EntityCargoRocket(world, centerX, centerY, centerZ, EnumRocketType.values()[stack.getItemDamage() - 10]);
    }
    rocket.setPosition(rocket.posX, rocket.posY + rocket.getOnPadYOffset(), rocket.posZ);
    world.spawnEntityInWorld(rocket);
    if (((IRocketType) rocket).getType().getPreFueled()) {
        if (rocket instanceof EntityTieredRocket) {
            ((EntityTieredRocket) rocket).fuelTank.fill(new FluidStack(GCFluids.fluidFuel, rocket.getMaxFuel()), true);
        } else {
            ((EntityCargoRocket) rocket).fuelTank.fill(new FluidStack(GCFluids.fluidFuel, rocket.getMaxFuel()), true);
        }
    } else if (stack.hasTagCompound() && stack.getTagCompound().hasKey("RocketFuel")) {
        rocket.fuelTank.fill(new FluidStack(GCFluids.fluidFuel, stack.getTagCompound().getInteger("RocketFuel")), true);
    }
    return true;
}
Also used : EntityCargoRocket(micdoodle8.mods.galacticraft.planets.mars.entities.EntityCargoRocket) EntityTieredRocket(micdoodle8.mods.galacticraft.api.prefab.entity.EntityTieredRocket) FluidStack(net.minecraftforge.fluids.FluidStack) EntityAutoRocket(micdoodle8.mods.galacticraft.api.prefab.entity.EntityAutoRocket) TileEntityLandingPad(micdoodle8.mods.galacticraft.core.tile.TileEntityLandingPad) EntityTier2Rocket(micdoodle8.mods.galacticraft.planets.mars.entities.EntityTier2Rocket)

Example 5 with EntityCargoRocket

use of micdoodle8.mods.galacticraft.planets.mars.entities.EntityCargoRocket in project Galacticraft by micdoodle8.

the class PacketSimpleMars method handleClientSide.

@SideOnly(Side.CLIENT)
@Override
public void handleClientSide(EntityPlayer player) {
    EntityPlayerSP playerBaseClient = null;
    if (player instanceof EntityPlayerSP) {
        playerBaseClient = (EntityPlayerSP) player;
    }
    switch(this.type) {
        case C_OPEN_CUSTOM_GUI:
            int entityID = 0;
            Entity entity = null;
            switch((Integer) this.data.get(1)) {
                case 0:
                    entityID = (Integer) this.data.get(2);
                    entity = player.worldObj.getEntityByID(entityID);
                    if (entity != null && entity instanceof EntitySlimeling) {
                        FMLClientHandler.instance().getClient().displayGuiScreen(new GuiSlimelingInventory(player, (EntitySlimeling) entity));
                    }
                    player.openContainer.windowId = (Integer) this.data.get(0);
                    break;
                case 1:
                    entityID = (Integer) this.data.get(2);
                    entity = player.worldObj.getEntityByID(entityID);
                    if (entity != null && entity instanceof EntityCargoRocket) {
                        FMLClientHandler.instance().getClient().displayGuiScreen(new GuiCargoRocket(player.inventory, (EntityCargoRocket) entity));
                    }
                    player.openContainer.windowId = (Integer) this.data.get(0);
                    break;
            }
            break;
        case C_OPEN_CUSTOM_GUI_TILE:
            BlockPos pos;
            TileEntity tile;
            switch((Integer) this.data.get(1)) {
                case 0:
                    pos = (BlockPos) this.data.get(2);
                    tile = player.worldObj.getTileEntity(pos);
                    if (tile != null && tile instanceof TileEntityLaunchController) {
                        FMLClientHandler.instance().getClient().displayGuiScreen(new GuiLaunchControllerAdvanced(player.inventory, (TileEntityLaunchController) tile));
                    }
                    player.openContainer.windowId = (Integer) this.data.get(0);
                    break;
            }
            break;
        case C_BEGIN_CRYOGENIC_SLEEP:
            pos = (BlockPos) this.data.get(0);
            tile = player.worldObj.getTileEntity(pos);
            if (tile instanceof TileEntityCryogenicChamber) {
                ((TileEntityCryogenicChamber) tile).sleepInBedAt(player, pos.getX(), pos.getY(), pos.getZ());
            }
        default:
            break;
    }
}
Also used : Entity(net.minecraft.entity.Entity) TileEntity(net.minecraft.tileentity.TileEntity) TileEntityCryogenicChamber(micdoodle8.mods.galacticraft.planets.mars.tile.TileEntityCryogenicChamber) GuiLaunchControllerAdvanced(micdoodle8.mods.galacticraft.planets.mars.client.gui.GuiLaunchControllerAdvanced) GuiSlimelingInventory(micdoodle8.mods.galacticraft.planets.mars.client.gui.GuiSlimelingInventory) EntityCargoRocket(micdoodle8.mods.galacticraft.planets.mars.entities.EntityCargoRocket) TileEntity(net.minecraft.tileentity.TileEntity) EntitySlimeling(micdoodle8.mods.galacticraft.planets.mars.entities.EntitySlimeling) BlockPos(net.minecraft.util.BlockPos) GuiCargoRocket(micdoodle8.mods.galacticraft.planets.mars.client.gui.GuiCargoRocket) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) TileEntityLaunchController(micdoodle8.mods.galacticraft.planets.mars.tile.TileEntityLaunchController) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

EntityCargoRocket (micdoodle8.mods.galacticraft.planets.mars.entities.EntityCargoRocket)4 Entity (net.minecraft.entity.Entity)4 EntityAutoRocket (micdoodle8.mods.galacticraft.api.prefab.entity.EntityAutoRocket)2 EntitySlimeling (micdoodle8.mods.galacticraft.planets.mars.entities.EntitySlimeling)2 EntityTier2Rocket (micdoodle8.mods.galacticraft.planets.mars.entities.EntityTier2Rocket)2 TileEntityLaunchController (micdoodle8.mods.galacticraft.planets.mars.tile.TileEntityLaunchController)2 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)2 TileEntity (net.minecraft.tileentity.TileEntity)2 BlockPos (net.minecraft.util.BlockPos)2 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)2 EnumRocketType (micdoodle8.mods.galacticraft.api.entity.IRocketType.EnumRocketType)1 IWorldTransferCallback (micdoodle8.mods.galacticraft.api.entity.IWorldTransferCallback)1 EntitySpaceshipBase (micdoodle8.mods.galacticraft.api.prefab.entity.EntitySpaceshipBase)1 EntityTieredRocket (micdoodle8.mods.galacticraft.api.prefab.entity.EntityTieredRocket)1 Vector3 (micdoodle8.mods.galacticraft.api.vector.Vector3)1 IGalacticraftWorldProvider (micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider)1 WorldProviderSpaceStation (micdoodle8.mods.galacticraft.core.dimension.WorldProviderSpaceStation)1 EntityCelestialFake (micdoodle8.mods.galacticraft.core.entities.EntityCelestialFake)1 GCPlayerStats (micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats)1 EventWakePlayer (micdoodle8.mods.galacticraft.core.event.EventWakePlayer)1