Search in sources :

Example 1 with GuiCelestialSelection

use of micdoodle8.mods.galacticraft.core.client.gui.screen.GuiCelestialSelection in project MorePlanets by SteveKunG.

the class ClientEventHandler method onRenderCelestialPost.

@SubscribeEvent
public void onRenderCelestialPost(CelestialBodyRenderEvent.Post event) {
    if (this.mc.currentScreen instanceof GuiCelestialSelection) {
        GuiCelestialSelection gui = (GuiCelestialSelection) this.mc.currentScreen;
        boolean enable = false;
        if (event.celestialBody == GalacticraftCore.planetOverworld && enable) {
            float size = GuiCelestialSelection.getWidthForCelestialBodyStatic(event.celestialBody) / 16.0F;
            float orbitTick = MathHelper.sin(this.partialTicks * 0.2F) / 10.0F + 0.5F;
            GlStateManager.rotate(this.partialTicks, 0.0F, 0.0F, 1.0F);
            GlStateManager.translate(orbitTick + 5.0F, 5.0F, 0.0F);
            this.mc.renderEngine.bindTexture(new ResourceLocation("moreplanets:textures/gui/celestialbodies/ion_cannon.png"));
            gui.drawTexturedModalRect(-7.5F * size, -1.75F * size, 2.0F, 2.0F, 0, 0, 32, 32, false, false, 32, 32);
        }
    }
}
Also used : GuiCelestialSelection(micdoodle8.mods.galacticraft.core.client.gui.screen.GuiCelestialSelection) ResourceLocation(net.minecraft.util.ResourceLocation) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 2 with GuiCelestialSelection

use of micdoodle8.mods.galacticraft.core.client.gui.screen.GuiCelestialSelection in project Galacticraft by micdoodle8.

the class PacketSimple method handleClientSide.

@SideOnly(Side.CLIENT)
@Override
public void handleClientSide(EntityPlayer player) {
    EntityPlayerSP playerBaseClient = null;
    GCPlayerStatsClient stats = null;
    if (player instanceof EntityPlayerSP) {
        playerBaseClient = (EntityPlayerSP) player;
        stats = GCPlayerStatsClient.get(playerBaseClient);
    } else {
        if (type != EnumSimplePacket.C_UPDATE_SPACESTATION_LIST && type != EnumSimplePacket.C_UPDATE_PLANETS_LIST && type != EnumSimplePacket.C_UPDATE_CONFIGS) {
            return;
        }
    }
    switch(this.type) {
        case C_AIR_REMAINING:
            if (String.valueOf(this.data.get(2)).equals(String.valueOf(PlayerUtil.getName(player)))) {
                TickHandlerClient.airRemaining = (Integer) this.data.get(0);
                TickHandlerClient.airRemaining2 = (Integer) this.data.get(1);
            }
            break;
        case C_UPDATE_DIMENSION_LIST:
            if (String.valueOf(this.data.get(0)).equals(PlayerUtil.getName(player))) {
                String dimensionList = (String) this.data.get(1);
                if (ConfigManagerCore.enableDebug) {
                    if (!dimensionList.equals(PacketSimple.spamCheckString)) {
                        GCLog.info("DEBUG info: " + dimensionList);
                        PacketSimple.spamCheckString = dimensionList;
                    }
                }
                final String[] destinations = dimensionList.split("\\?");
                List<CelestialBody> possibleCelestialBodies = Lists.newArrayList();
                Map<Integer, Map<String, GuiCelestialSelection.StationDataGUI>> spaceStationData = Maps.newHashMap();
                for (String str : destinations) {
                    CelestialBody celestialBody = WorldUtil.getReachableCelestialBodiesForName(str);
                    if (celestialBody == null && str.contains("$")) {
                        String[] values = str.split("\\$");
                        int homePlanetID = Integer.parseInt(values[4]);
                        for (Satellite satellite : GalaxyRegistry.getRegisteredSatellites().values()) {
                            if (satellite.getParentPlanet().getDimensionID() == homePlanetID) {
                                celestialBody = satellite;
                                break;
                            }
                        }
                        if (!spaceStationData.containsKey(homePlanetID)) {
                            spaceStationData.put(homePlanetID, new HashMap<String, GuiCelestialSelection.StationDataGUI>());
                        }
                        spaceStationData.get(homePlanetID).put(values[1], new GuiCelestialSelection.StationDataGUI(values[2], Integer.parseInt(values[3])));
                    // spaceStationNames.put(values[1], values[2]);
                    // spaceStationIDs.put(values[1], Integer.parseInt(values[3]));
                    // spaceStationHomes.put(values[1], Integer.parseInt(values[4]));
                    }
                    if (celestialBody != null) {
                        possibleCelestialBodies.add(celestialBody);
                    }
                }
                if (FMLClientHandler.instance().getClient().theWorld != null) {
                    if (!(FMLClientHandler.instance().getClient().currentScreen instanceof GuiCelestialSelection)) {
                        GuiCelestialSelection gui = new GuiCelestialSelection(false, possibleCelestialBodies);
                        gui.spaceStationMap = spaceStationData;
                        // gui.spaceStationNames = spaceStationNames;
                        // gui.spaceStationIDs = spaceStationIDs;
                        FMLClientHandler.instance().getClient().displayGuiScreen(gui);
                    } else {
                        ((GuiCelestialSelection) FMLClientHandler.instance().getClient().currentScreen).possibleBodies = possibleCelestialBodies;
                        ((GuiCelestialSelection) FMLClientHandler.instance().getClient().currentScreen).spaceStationMap = spaceStationData;
                    // ((GuiCelestialSelection) FMLClientHandler.instance().getClient().currentScreen).spaceStationNames = spaceStationNames;
                    // ((GuiCelestialSelection) FMLClientHandler.instance().getClient().currentScreen).spaceStationIDs = spaceStationIDs;
                    }
                }
            }
            break;
        case C_SPAWN_SPARK_PARTICLES:
            BlockPos pos = (BlockPos) this.data.get(0);
            Minecraft mc = Minecraft.getMinecraft();
            for (int i = 0; i < 4; i++) {
                if (mc != null && mc.getRenderViewEntity() != null && mc.effectRenderer != null && mc.theWorld != null) {
                    final EntityFX fx = new EntityFXSparks(mc.theWorld, pos.getX() - 0.15 + 0.5, pos.getY() + 1.2, pos.getZ() + 0.15 + 0.5, mc.theWorld.rand.nextDouble() / 20 - mc.theWorld.rand.nextDouble() / 20, mc.theWorld.rand.nextDouble() / 20 - mc.theWorld.rand.nextDouble() / 20);
                    if (fx != null) {
                        mc.effectRenderer.addEffect(fx);
                    }
                }
            }
            break;
        case C_UPDATE_GEAR_SLOT:
            int subtype = (Integer) this.data.get(3);
            String gearName = (String) this.data.get(0);
            EntityPlayer gearDataPlayer = player.worldObj.getPlayerEntityByName(gearName);
            if (gearDataPlayer != null) {
                PlayerGearData gearData = ClientProxyCore.playerItemData.get(PlayerUtil.getName(gearDataPlayer));
                if (gearData == null) {
                    gearData = new PlayerGearData(player);
                    if (!ClientProxyCore.gearDataRequests.contains(gearName)) {
                        GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(PacketSimple.EnumSimplePacket.S_REQUEST_GEAR_DATA, getDimensionID(), new Object[] { gearName }));
                        ClientProxyCore.gearDataRequests.add(gearName);
                    }
                } else {
                    ClientProxyCore.gearDataRequests.remove(gearName);
                }
                EnumExtendedInventorySlot type = EnumExtendedInventorySlot.values()[(Integer) this.data.get(2)];
                EnumModelPacketType typeChange = EnumModelPacketType.values()[(Integer) this.data.get(1)];
                switch(type) {
                    case MASK:
                        gearData.setMask(subtype);
                        break;
                    case GEAR:
                        gearData.setGear(subtype);
                        break;
                    case LEFT_TANK:
                        gearData.setLeftTank(subtype);
                        break;
                    case RIGHT_TANK:
                        gearData.setRightTank(subtype);
                        break;
                    case PARACHUTE:
                        if (typeChange == EnumModelPacketType.ADD) {
                            String name;
                            if (subtype != -1) {
                                name = ItemParaChute.names[subtype];
                                gearData.setParachute(new ResourceLocation(Constants.ASSET_PREFIX, "textures/model/parachute/" + name + ".png"));
                            }
                        } else {
                            gearData.setParachute(null);
                        }
                        break;
                    case FREQUENCY_MODULE:
                        gearData.setFrequencyModule(subtype);
                        break;
                    case THERMAL_HELMET:
                        gearData.setThermalPadding(0, subtype);
                        break;
                    case THERMAL_CHESTPLATE:
                        gearData.setThermalPadding(1, subtype);
                        break;
                    case THERMAL_LEGGINGS:
                        gearData.setThermalPadding(2, subtype);
                        break;
                    case THERMAL_BOOTS:
                        gearData.setThermalPadding(3, subtype);
                        break;
                    case SHIELD_CONTROLLER:
                        gearData.setShieldController(subtype);
                        break;
                    default:
                        break;
                }
                ClientProxyCore.playerItemData.put(gearName, gearData);
            }
            break;
        case C_CLOSE_GUI:
            FMLClientHandler.instance().getClient().displayGuiScreen(null);
            break;
        case C_RESET_THIRD_PERSON:
            FMLClientHandler.instance().getClient().gameSettings.thirdPersonView = stats.getThirdPersonView();
            break;
        case C_UPDATE_SPACESTATION_LIST:
            WorldUtil.decodeSpaceStationListClient(data);
            break;
        case C_UPDATE_SPACESTATION_DATA:
            SpaceStationWorldData var4 = SpaceStationWorldData.getMPSpaceStationData(player.worldObj, (Integer) this.data.get(0), player);
            var4.readFromNBT((NBTTagCompound) this.data.get(1));
            break;
        case C_UPDATE_SPACESTATION_CLIENT_ID:
            ClientProxyCore.clientSpaceStationID = WorldUtil.stringToSpaceStationData((String) this.data.get(0));
            break;
        case C_UPDATE_PLANETS_LIST:
            WorldUtil.decodePlanetsListClient(data);
            break;
        case C_UPDATE_CONFIGS:
            ConfigManagerCore.saveClientConfigOverrideable();
            ConfigManagerCore.setConfigOverride(data);
            break;
        case C_ADD_NEW_SCHEMATIC:
            final ISchematicPage page = SchematicRegistry.getMatchingRecipeForID((Integer) this.data.get(0));
            if (!stats.getUnlockedSchematics().contains(page)) {
                stats.getUnlockedSchematics().add(page);
            }
            break;
        case C_UPDATE_SCHEMATIC_LIST:
            for (Object o : this.data) {
                Integer schematicID = (Integer) o;
                if (schematicID != -2) {
                    Collections.sort(stats.getUnlockedSchematics());
                    if (!stats.getUnlockedSchematics().contains(SchematicRegistry.getMatchingRecipeForID(schematicID))) {
                        stats.getUnlockedSchematics().add(SchematicRegistry.getMatchingRecipeForID(schematicID));
                    }
                }
            }
            break;
        case C_PLAY_SOUND_BOSS_DEATH:
            player.playSound(Constants.TEXTURE_PREFIX + "entity.bossdeath", 10.0F, (Float) this.data.get(0));
            break;
        case C_PLAY_SOUND_EXPLODE:
            player.playSound("random.explode", 10.0F, 0.7F);
            break;
        case C_PLAY_SOUND_BOSS_LAUGH:
            player.playSound(Constants.TEXTURE_PREFIX + "entity.bosslaugh", 10.0F, 1.1F);
            break;
        case C_PLAY_SOUND_BOW:
            player.playSound("random.bow", 10.0F, 0.2F);
            break;
        case C_UPDATE_OXYGEN_VALIDITY:
            stats.setOxygenSetupValid((Boolean) this.data.get(0));
            break;
        case C_OPEN_PARACHEST_GUI:
            switch((Integer) this.data.get(1)) {
                case 0:
                    if (player.ridingEntity instanceof EntityBuggy) {
                        FMLClientHandler.instance().getClient().displayGuiScreen(new GuiBuggy(player.inventory, (EntityBuggy) player.ridingEntity, ((EntityBuggy) player.ridingEntity).getType()));
                        player.openContainer.windowId = (Integer) this.data.get(0);
                    }
                    break;
                case 1:
                    int entityID = (Integer) this.data.get(2);
                    Entity entity = player.worldObj.getEntityByID(entityID);
                    if (entity != null && entity instanceof IInventorySettable) {
                        FMLClientHandler.instance().getClient().displayGuiScreen(new GuiParaChest(player.inventory, (IInventorySettable) entity));
                    }
                    player.openContainer.windowId = (Integer) this.data.get(0);
                    break;
            }
            break;
        case C_UPDATE_WIRE_BOUNDS:
            TileEntity tile = player.worldObj.getTileEntity((BlockPos) this.data.get(0));
            if (tile instanceof TileBaseConductor) {
                ((TileBaseConductor) tile).adjacentConnections = null;
                player.worldObj.getBlockState(tile.getPos()).getBlock().setBlockBoundsBasedOnState(player.worldObj, tile.getPos());
            }
            break;
        case C_OPEN_SPACE_RACE_GUI:
            if (Minecraft.getMinecraft().currentScreen == null) {
                TickHandlerClient.spaceRaceGuiScheduled = false;
                player.openGui(GalacticraftCore.instance, GuiIdsCore.SPACE_RACE_START, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ);
            } else {
                TickHandlerClient.spaceRaceGuiScheduled = true;
            }
            break;
        case C_UPDATE_SPACE_RACE_DATA:
            Integer teamID = (Integer) this.data.get(0);
            String teamName = (String) this.data.get(1);
            FlagData flagData = (FlagData) this.data.get(2);
            Vector3 teamColor = (Vector3) this.data.get(3);
            List<String> playerList = new ArrayList<String>();
            for (int i = 4; i < this.data.size(); i++) {
                String playerName = (String) this.data.get(i);
                ClientProxyCore.flagRequestsSent.remove(playerName);
                playerList.add(playerName);
            }
            SpaceRace race = new SpaceRace(playerList, teamName, flagData, teamColor);
            race.setSpaceRaceID(teamID);
            SpaceRaceManager.addSpaceRace(race);
            break;
        case C_OPEN_JOIN_RACE_GUI:
            stats.setSpaceRaceInviteTeamID((Integer) this.data.get(0));
            player.openGui(GalacticraftCore.instance, GuiIdsCore.SPACE_RACE_JOIN, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ);
            break;
        case C_UPDATE_DUNGEON_DIRECTION:
            stats.setDungeonDirection((Float) this.data.get(0));
            break;
        case C_UPDATE_FOOTPRINT_LIST:
            List<Footprint> printList = new ArrayList<Footprint>();
            long chunkKey = (Long) this.data.get(0);
            for (int i = 1; i < this.data.size(); i++) {
                Footprint print = (Footprint) this.data.get(i);
                if (!print.owner.equals(player.getName())) {
                    printList.add(print);
                }
            }
            FootprintRenderer.setFootprints(chunkKey, printList);
            break;
        case C_FOOTPRINTS_REMOVED:
            long chunkKey0 = (Long) this.data.get(0);
            BlockVec3 position = (BlockVec3) this.data.get(1);
            List<Footprint> footprintList = FootprintRenderer.footprints.get(chunkKey0);
            List<Footprint> toRemove = new ArrayList<Footprint>();
            if (footprintList != null) {
                for (Footprint footprint : footprintList) {
                    if (footprint.position.x > position.x && footprint.position.x < position.x + 1 && footprint.position.z > position.z && footprint.position.z < position.z + 1) {
                        toRemove.add(footprint);
                    }
                }
            }
            if (!toRemove.isEmpty()) {
                footprintList.removeAll(toRemove);
                FootprintRenderer.footprints.put(chunkKey0, footprintList);
            }
            break;
        case C_UPDATE_STATION_SPIN:
            if (playerBaseClient.worldObj.provider instanceof WorldProviderSpaceStation) {
                ((WorldProviderSpaceStation) playerBaseClient.worldObj.provider).getSpinManager().setSpinRate((Float) this.data.get(0), (Boolean) this.data.get(1));
            }
            break;
        case C_UPDATE_STATION_DATA:
            if (playerBaseClient.worldObj.provider instanceof WorldProviderSpaceStation) {
                ((WorldProviderSpaceStation) playerBaseClient.worldObj.provider).getSpinManager().setSpinCentre((Double) this.data.get(0), (Double) this.data.get(1));
            }
            break;
        case C_UPDATE_STATION_BOX:
            if (playerBaseClient.worldObj.provider instanceof WorldProviderSpaceStation) {
                ((WorldProviderSpaceStation) playerBaseClient.worldObj.provider).getSpinManager().setSpinBox((Integer) this.data.get(0), (Integer) this.data.get(1), (Integer) this.data.get(2), (Integer) this.data.get(3), (Integer) this.data.get(4), (Integer) this.data.get(5));
            }
            break;
        case C_UPDATE_THERMAL_LEVEL:
            stats.setThermalLevel((Integer) this.data.get(0));
            stats.setThermalLevelNormalising((Boolean) this.data.get(1));
            break;
        case C_DISPLAY_ROCKET_CONTROLS:
            player.addChatMessage(new ChatComponentText(GameSettings.getKeyDisplayString(KeyHandlerClient.spaceKey.getKeyCode()) + "  - " + GCCoreUtil.translate("gui.rocket.launch.name")));
            player.addChatMessage(new ChatComponentText(GameSettings.getKeyDisplayString(KeyHandlerClient.leftKey.getKeyCode()) + " / " + GameSettings.getKeyDisplayString(KeyHandlerClient.rightKey.getKeyCode()) + "  - " + GCCoreUtil.translate("gui.rocket.turn.name")));
            player.addChatMessage(new ChatComponentText(GameSettings.getKeyDisplayString(KeyHandlerClient.accelerateKey.getKeyCode()) + " / " + GameSettings.getKeyDisplayString(KeyHandlerClient.decelerateKey.getKeyCode()) + "  - " + GCCoreUtil.translate("gui.rocket.updown.name")));
            player.addChatMessage(new ChatComponentText(GameSettings.getKeyDisplayString(KeyHandlerClient.openFuelGui.getKeyCode()) + "       - " + GCCoreUtil.translate("gui.rocket.inv.name")));
            break;
        case C_GET_CELESTIAL_BODY_LIST:
            String str = "";
            for (CelestialBody cBody : GalaxyRegistry.getRegisteredPlanets().values()) {
                str = str.concat(cBody.getUnlocalizedName() + ";");
            }
            for (CelestialBody cBody : GalaxyRegistry.getRegisteredMoons().values()) {
                str = str.concat(cBody.getUnlocalizedName() + ";");
            }
            for (CelestialBody cBody : GalaxyRegistry.getRegisteredSatellites().values()) {
                str = str.concat(cBody.getUnlocalizedName() + ";");
            }
            for (SolarSystem solarSystem : GalaxyRegistry.getRegisteredSolarSystems().values()) {
                str = str.concat(solarSystem.getUnlocalizedName() + ";");
            }
            GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_COMPLETE_CBODY_HANDSHAKE, getDimensionID(), new Object[] { str }));
            break;
        case C_UPDATE_ENERGYUNITS:
            CommandGCEnergyUnits.handleParamClientside((Integer) this.data.get(0));
            break;
        case C_RESPAWN_PLAYER:
            final WorldProvider provider = WorldUtil.getProviderForNameClient((String) this.data.get(0));
            final int dimID = GCCoreUtil.getDimensionID(provider);
            if (ConfigManagerCore.enableDebug) {
                GCLog.info("DEBUG: Client receiving respawn packet for dim " + dimID);
            }
            int par2 = (Integer) this.data.get(1);
            String par3 = (String) this.data.get(2);
            int par4 = (Integer) this.data.get(3);
            WorldUtil.forceRespawnClient(dimID, par2, par3, par4);
            break;
        case C_UPDATE_STATS:
            stats.setBuildFlags((Integer) this.data.get(0));
            BlockPanelLighting.updateClient(this.data);
            break;
        case C_UPDATE_TELEMETRY:
            tile = player.worldObj.getTileEntity((BlockPos) this.data.get(0));
            if (tile instanceof TileEntityTelemetry) {
                ((TileEntityTelemetry) tile).receiveUpdate(data, this.getDimensionID());
            }
            break;
        case C_SEND_PLAYERSKIN:
            String strName = (String) this.data.get(0);
            String s1 = (String) this.data.get(1);
            String s2 = (String) this.data.get(2);
            String strUUID = (String) this.data.get(3);
            GameProfile gp = PlayerUtil.getOtherPlayerProfile(strName);
            if (gp == null) {
                gp = PlayerUtil.makeOtherPlayerProfile(strName, strUUID);
            }
            gp.getProperties().put("textures", new Property("textures", s1, s2));
            break;
        case C_SEND_OVERWORLD_IMAGE:
            try {
                int cx = (Integer) this.data.get(0);
                int cz = (Integer) this.data.get(1);
                byte[] bytes = (byte[]) this.data.get(2);
                MapUtil.receiveOverworldImageCompressed(cx, cz, bytes);
            } catch (Exception e) {
                e.printStackTrace();
            }
            break;
        case C_RECOLOR_PIPE:
            TileEntity tileEntity = player.worldObj.getTileEntity((BlockPos) this.data.get(0));
            if (tileEntity instanceof TileEntityFluidPipe) {
                TileEntityFluidPipe pipe = (TileEntityFluidPipe) tileEntity;
                pipe.getNetwork().split(pipe);
                pipe.setNetwork(null);
            }
            break;
        case C_RECOLOR_ALL_GLASS:
            BlockSpaceGlass.updateGlassColors((Integer) this.data.get(0), (Integer) this.data.get(1), (Integer) this.data.get(2));
            break;
        case C_UPDATE_MACHINE_DATA:
            TileEntity tile3 = player.worldObj.getTileEntity((BlockPos) this.data.get(0));
            if (tile3 instanceof ITileClientUpdates) {
                ((ITileClientUpdates) tile3).updateClient(this.data);
            }
            break;
        case C_LEAK_DATA:
            TileEntity tile4 = player.worldObj.getTileEntity((BlockPos) this.data.get(0));
            if (tile4 instanceof TileEntityOxygenSealer) {
                ((ITileClientUpdates) tile4).updateClient(this.data);
            }
            break;
        case C_SPAWN_HANGING_SCHEMATIC:
            EntityHangingSchematic entity = new EntityHangingSchematic(player.worldObj, (BlockPos) this.data.get(0), EnumFacing.getFront((Integer) this.data.get(2)), (Integer) this.data.get(3));
            ((WorldClient) player.worldObj).addEntityToWorld((Integer) this.data.get(1), entity);
            break;
        default:
            break;
    }
}
Also used : IControllableEntity(micdoodle8.mods.galacticraft.core.entities.IControllableEntity) Entity(net.minecraft.entity.Entity) TileEntity(net.minecraft.tileentity.TileEntity) TileBaseConductor(micdoodle8.mods.galacticraft.core.energy.tile.TileBaseConductor) SolarSystem(micdoodle8.mods.galacticraft.api.galaxies.SolarSystem) EntityBuggy(micdoodle8.mods.galacticraft.core.entities.EntityBuggy) WorldProvider(net.minecraft.world.WorldProvider) EntityFXSparks(micdoodle8.mods.galacticraft.core.client.fx.EntityFXSparks) EntityFX(net.minecraft.client.particle.EntityFX) Footprint(micdoodle8.mods.galacticraft.core.wrappers.Footprint) EnumExtendedInventorySlot(micdoodle8.mods.galacticraft.api.item.EnumExtendedInventorySlot) GuiParaChest(micdoodle8.mods.galacticraft.core.client.gui.container.GuiParaChest) WorldClient(net.minecraft.client.multiplayer.WorldClient) EntityHangingSchematic(micdoodle8.mods.galacticraft.core.entities.EntityHangingSchematic) GuiCelestialSelection(micdoodle8.mods.galacticraft.core.client.gui.screen.GuiCelestialSelection) GameProfile(com.mojang.authlib.GameProfile) EntityPlayer(net.minecraft.entity.player.EntityPlayer) GuiBuggy(micdoodle8.mods.galacticraft.core.client.gui.container.GuiBuggy) SpaceRace(micdoodle8.mods.galacticraft.core.dimension.SpaceRace) ITileClientUpdates(micdoodle8.mods.galacticraft.api.tile.ITileClientUpdates) Satellite(micdoodle8.mods.galacticraft.api.galaxies.Satellite) TileEntity(net.minecraft.tileentity.TileEntity) FlagData(micdoodle8.mods.galacticraft.core.wrappers.FlagData) WorldProviderSpaceStation(micdoodle8.mods.galacticraft.core.dimension.WorldProviderSpaceStation) CelestialBody(micdoodle8.mods.galacticraft.api.galaxies.CelestialBody) PlayerGearData(micdoodle8.mods.galacticraft.core.wrappers.PlayerGearData) EnumModelPacketType(micdoodle8.mods.galacticraft.core.entities.player.GCPlayerHandler.EnumModelPacketType) Property(com.mojang.authlib.properties.Property) BlockVec3(micdoodle8.mods.galacticraft.api.vector.BlockVec3) SpaceStationWorldData(micdoodle8.mods.galacticraft.core.dimension.SpaceStationWorldData) IInventorySettable(micdoodle8.mods.galacticraft.core.inventory.IInventorySettable) Vector3(micdoodle8.mods.galacticraft.api.vector.Vector3) Minecraft(net.minecraft.client.Minecraft) Footprint(micdoodle8.mods.galacticraft.core.wrappers.Footprint) IOException(java.io.IOException) ISchematicPage(micdoodle8.mods.galacticraft.api.recipe.ISchematicPage) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 3 with GuiCelestialSelection

use of micdoodle8.mods.galacticraft.core.client.gui.screen.GuiCelestialSelection in project Galacticraft by micdoodle8.

the class TickHandlerClient method onClientTick.

@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onClientTick(ClientTickEvent event) {
    final Minecraft minecraft = FMLClientHandler.instance().getClient();
    final WorldClient world = minecraft.theWorld;
    final EntityPlayerSP player = minecraft.thePlayer;
    if (teleportingGui != null) {
        if (minecraft.currentScreen != teleportingGui) {
            minecraft.currentScreen = teleportingGui;
        }
    }
    if (menuReset) {
        TickHandlerClient.resetClient();
        menuReset = false;
    }
    if (event.phase == Phase.START && player != null) {
        if (ClientProxyCore.playerHead == null && player.getGameProfile() != null) {
            Map<Type, MinecraftProfileTexture> map = minecraft.getSkinManager().loadSkinFromCache(player.getGameProfile());
            if (map.containsKey(Type.SKIN)) {
                ClientProxyCore.playerHead = minecraft.getSkinManager().loadSkin((MinecraftProfileTexture) map.get(Type.SKIN), Type.SKIN);
            } else {
                ClientProxyCore.playerHead = DefaultPlayerSkin.getDefaultSkin(EntityPlayer.getUUID(player.getGameProfile()));
            }
        }
        TickHandlerClient.tickCount++;
        if (!GalacticraftCore.proxy.isPaused()) {
            Iterator<FluidNetwork> it = TickHandlerClient.fluidNetworks.iterator();
            while (it.hasNext()) {
                FluidNetwork network = it.next();
                if (network.getTransmitters().size() == 0) {
                    it.remove();
                } else {
                    network.clientTick();
                }
            }
        }
        if (TickHandlerClient.tickCount % 20 == 0) {
            if (updateJEIhiding) {
                updateJEIhiding = false;
                if (CompressorRecipes.steelIngotsPresent) {
                    // Update JEI to hide the ingot compressor recipe for GC steel in hard mode
                    GalacticraftJEI.updateHiddenSteel(ConfigManagerCore.hardMode && !ConfigManagerCore.challengeRecipes);
                }
                // Update JEI to hide adventure mode recipes when not in adventure mode
                GalacticraftJEI.updateHiddenAdventure(!ConfigManagerCore.challengeRecipes);
            }
            for (List<Footprint> fpList : FootprintRenderer.footprints.values()) {
                Iterator<Footprint> fpIt = fpList.iterator();
                while (fpIt.hasNext()) {
                    Footprint fp = fpIt.next();
                    fp.age += 20;
                    if (fp.age >= Footprint.MAX_AGE) {
                        fpIt.remove();
                    }
                }
            }
            if (player.inventory.armorItemInSlot(3) != null && player.inventory.armorItemInSlot(3).getItem() instanceof ItemSensorGlasses) {
                ClientProxyCore.valueableBlocks.clear();
                for (int i = -4; i < 5; i++) {
                    int x = MathHelper.floor_double(player.posX + i);
                    for (int j = -4; j < 5; j++) {
                        int y = MathHelper.floor_double(player.posY + j);
                        for (int k = -4; k < 5; k++) {
                            int z = MathHelper.floor_double(player.posZ + k);
                            BlockPos pos = new BlockPos(x, y, z);
                            IBlockState state = player.worldObj.getBlockState(pos);
                            final Block block = state.getBlock();
                            if (block.getMaterial() != Material.air) {
                                int metadata = block.getMetaFromState(state);
                                boolean isDetectable = false;
                                for (BlockMetaList blockMetaList : ClientProxyCore.detectableBlocks) {
                                    if (blockMetaList.getBlock() == block && blockMetaList.getMetaList().contains(metadata)) {
                                        isDetectable = true;
                                        break;
                                    }
                                }
                                if (isDetectable || (block instanceof IDetectableResource && ((IDetectableResource) block).isValueable(state))) {
                                    ClientProxyCore.valueableBlocks.add(new BlockVec3(x, y, z));
                                }
                            }
                        }
                    }
                }
                TileEntityOxygenSealer nearestSealer = TileEntityOxygenSealer.getNearestSealer(world, MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY), MathHelper.floor_double(player.posZ));
                if (nearestSealer != null && !nearestSealer.sealed) {
                    ClientProxyCore.leakTrace = nearestSealer.getLeakTraceClient();
                } else {
                    ClientProxyCore.leakTrace = null;
                }
            } else {
                ClientProxyCore.leakTrace = null;
            }
            if (world != null) {
                if (MapUtil.resetClientFlag.getAndSet(false)) {
                    MapUtil.resetClientBody();
                }
            }
        }
        if (ClientProxyCore.leakTrace != null)
            this.spawnLeakParticles();
        if (world != null && TickHandlerClient.spaceRaceGuiScheduled && minecraft.currentScreen == null && ConfigManagerCore.enableSpaceRaceManagerPopup) {
            player.openGui(GalacticraftCore.instance, GuiIdsCore.SPACE_RACE_START, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ);
            TickHandlerClient.spaceRaceGuiScheduled = false;
        }
        if (world != null && TickHandlerClient.checkedVersion) {
            ThreadVersionCheck.startCheck();
            TickHandlerClient.checkedVersion = false;
        }
        boolean inSpaceShip = false;
        if (player.ridingEntity instanceof EntitySpaceshipBase) {
            inSpaceShip = true;
            EntitySpaceshipBase rocket = (EntitySpaceshipBase) player.ridingEntity;
            if (rocket.prevRotationPitch != rocket.rotationPitch || rocket.prevRotationYaw != rocket.rotationYaw)
                GalacticraftCore.packetPipeline.sendToServer(new PacketRotateRocket(player.ridingEntity));
        }
        if (world != null) {
            if (world.provider instanceof WorldProviderSurface) {
                if (world.provider.getSkyRenderer() == null && inSpaceShip && player.ridingEntity.posY > Constants.OVERWORLD_SKYPROVIDER_STARTHEIGHT) {
                    world.provider.setSkyRenderer(new SkyProviderOverworld());
                } else if (world.provider.getSkyRenderer() instanceof SkyProviderOverworld && player.posY <= Constants.OVERWORLD_SKYPROVIDER_STARTHEIGHT) {
                    world.provider.setSkyRenderer(null);
                }
            } else if (world.provider instanceof WorldProviderSpaceStation) {
                if (world.provider.getSkyRenderer() == null) {
                    ((WorldProviderSpaceStation) world.provider).createSkyProvider();
                }
            } else if (world.provider instanceof WorldProviderMoon) {
                if (world.provider.getSkyRenderer() == null) {
                    world.provider.setSkyRenderer(new SkyProviderMoon());
                }
                if (world.provider.getCloudRenderer() == null) {
                    world.provider.setCloudRenderer(new CloudRenderer());
                }
            }
        }
        if (inSpaceShip) {
            final EntitySpaceshipBase ship = (EntitySpaceshipBase) player.ridingEntity;
            boolean hasChanged = false;
            if (minecraft.gameSettings.keyBindLeft.isKeyDown()) {
                ship.turnYaw(-1.0F);
                hasChanged = true;
            }
            if (minecraft.gameSettings.keyBindRight.isKeyDown()) {
                ship.turnYaw(1.0F);
                hasChanged = true;
            }
            if (minecraft.gameSettings.keyBindForward.isKeyDown()) {
                if (ship.getLaunched()) {
                    ship.turnPitch(-0.7F);
                    hasChanged = true;
                }
            }
            if (minecraft.gameSettings.keyBindBack.isKeyDown()) {
                if (ship.getLaunched()) {
                    ship.turnPitch(0.7F);
                    hasChanged = true;
                }
            }
            if (hasChanged) {
                GalacticraftCore.packetPipeline.sendToServer(new PacketRotateRocket(ship));
            }
        }
        if (world != null) {
            List entityList = world.loadedEntityList;
            for (Object e : entityList) {
                if (e instanceof IEntityNoisy) {
                    IEntityNoisy vehicle = (IEntityNoisy) e;
                    if (vehicle.getSoundUpdater() == null) {
                        ISound noise = vehicle.setSoundUpdater(FMLClientHandler.instance().getClient().thePlayer);
                        if (noise != null) {
                            FMLClientHandler.instance().getClient().getSoundHandler().playSound(noise);
                        }
                    }
                }
            }
        }
        if (FMLClientHandler.instance().getClient().currentScreen instanceof GuiCelestialSelection) {
            player.motionY = 0;
        }
        if (world != null && world.provider instanceof IGalacticraftWorldProvider && OxygenUtil.noAtmosphericCombustion(world.provider) && ((IGalacticraftWorldProvider) world.provider).shouldDisablePrecipitation()) {
            world.setRainStrength(0.0F);
        }
        boolean isPressed = KeyHandlerClient.spaceKey.isPressed();
        if (!isPressed) {
            ClientProxyCore.lastSpacebarDown = false;
        }
        if (player.ridingEntity != null && isPressed && !ClientProxyCore.lastSpacebarDown) {
            GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_IGNITE_ROCKET, GCCoreUtil.getDimensionID(player.worldObj), new Object[] {}));
            ClientProxyCore.lastSpacebarDown = true;
        }
        if (!(this.screenConnectionsUpdateList.isEmpty())) {
            HashSet<TileEntityScreen> updateListCopy = (HashSet<TileEntityScreen>) screenConnectionsUpdateList.clone();
            screenConnectionsUpdateList.clear();
            for (TileEntityScreen te : updateListCopy) {
                if (te.getWorld().getBlockState(te.getPos()).getBlock() == GCBlocks.screen) {
                    if (te.refreshOnUpdate) {
                        te.refreshConnections(true);
                    }
                    te.getWorld().markBlockRangeForRenderUpdate(te.getPos(), te.getPos());
                }
            }
        }
    } else if (event.phase == Phase.END) {
        if (world != null) {
            for (GalacticraftPacketHandler handler : packetHandlers) {
                handler.tick(world);
            }
        }
    }
}
Also used : TileEntityOxygenSealer(micdoodle8.mods.galacticraft.core.tile.TileEntityOxygenSealer) IGalacticraftWorldProvider(micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider) IEntityNoisy(micdoodle8.mods.galacticraft.api.entity.IEntityNoisy) PacketSimple(micdoodle8.mods.galacticraft.core.network.PacketSimple) GalacticraftPacketHandler(micdoodle8.mods.galacticraft.core.network.GalacticraftPacketHandler) IDetectableResource(micdoodle8.mods.galacticraft.api.block.IDetectableResource) ISound(net.minecraft.client.audio.ISound) WorldProviderSpaceStation(micdoodle8.mods.galacticraft.core.dimension.WorldProviderSpaceStation) WorldProviderMoon(micdoodle8.mods.galacticraft.core.dimension.WorldProviderMoon) BlockPos(net.minecraft.util.BlockPos) PacketRotateRocket(micdoodle8.mods.galacticraft.core.network.PacketRotateRocket) BlockMetaList(micdoodle8.mods.galacticraft.core.wrappers.BlockMetaList) ItemSensorGlasses(micdoodle8.mods.galacticraft.core.items.ItemSensorGlasses) BlockVec3(micdoodle8.mods.galacticraft.api.vector.BlockVec3) TileEntityScreen(micdoodle8.mods.galacticraft.core.tile.TileEntityScreen) EntitySpaceshipBase(micdoodle8.mods.galacticraft.api.prefab.entity.EntitySpaceshipBase) Footprint(micdoodle8.mods.galacticraft.core.wrappers.Footprint) WorldProviderSurface(net.minecraft.world.WorldProviderSurface) IBlockState(net.minecraft.block.state.IBlockState) FluidNetwork(micdoodle8.mods.galacticraft.core.fluid.FluidNetwork) MinecraftProfileTexture(com.mojang.authlib.minecraft.MinecraftProfileTexture) Minecraft(net.minecraft.client.Minecraft) WorldClient(net.minecraft.client.multiplayer.WorldClient) Footprint(micdoodle8.mods.galacticraft.core.wrappers.Footprint) BlockMetaList(micdoodle8.mods.galacticraft.core.wrappers.BlockMetaList) Type(com.mojang.authlib.minecraft.MinecraftProfileTexture.Type) GuiCelestialSelection(micdoodle8.mods.galacticraft.core.client.gui.screen.GuiCelestialSelection) Block(net.minecraft.block.Block) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 4 with GuiCelestialSelection

use of micdoodle8.mods.galacticraft.core.client.gui.screen.GuiCelestialSelection in project Galacticraft by micdoodle8.

the class GuiHandler method getClientGuiElement.

@SideOnly(Side.CLIENT)
private Object getClientGuiElement(int ID, EntityPlayer player, World world, BlockPos position) {
    EntityPlayerSP playerClient = PlayerUtil.getPlayerBaseClientFromPlayer(player, false);
    if (ID == GuiIdsCore.GALAXY_MAP) {
        return new GuiCelestialSelection(true, null);
    } else if (ID == GuiIdsCore.ROCKET_INVENTORY && player.ridingEntity instanceof EntityTieredRocket) {
        return new GuiRocketInventory(player.inventory, (EntityTieredRocket) player.ridingEntity, ((EntityTieredRocket) player.ridingEntity).getType());
    } else if (ID == GuiIdsCore.EXTENDED_INVENTORY) {
        return new GuiExtendedInventory(player, ClientProxyCore.dummyInventory);
    } else if (ID == GuiIdsCore.SPACE_RACE_START) {
        return new GuiNewSpaceRace(player);
    } else if (ID == GuiIdsCore.SPACE_RACE_JOIN) {
        return new GuiJoinSpaceRace(playerClient);
    } else if (ID == GuiIdsCore.PRE_LAUNCH_CHECKLIST) {
        return new GuiPreLaunchChecklist(WorldUtil.getAllChecklistKeys(), player.getHeldItem().hasTagCompound() ? (NBTTagCompound) player.getHeldItem().getTagCompound().getTag("checklistData") : null);
    }
    TileEntity tile = world.getTileEntity(position);
    if (tile != null) {
        if (tile instanceof TileEntityCrafting) {
            return new GuiCrafting(player.inventory, (TileEntityCrafting) tile);
        } else if (tile instanceof TileEntityRefinery) {
            return new GuiRefinery(player.inventory, (TileEntityRefinery) world.getTileEntity(position));
        } else if (tile instanceof TileEntityOxygenCollector) {
            return new GuiOxygenCollector(player.inventory, (TileEntityOxygenCollector) tile);
        } else if (tile instanceof TileEntityOxygenDistributor) {
            return new GuiOxygenDistributor(player.inventory, (TileEntityOxygenDistributor) tile);
        } else if (tile instanceof TileEntityFuelLoader) {
            return new GuiFuelLoader(player.inventory, (TileEntityFuelLoader) tile);
        } else if (tile instanceof TileEntityOxygenSealer) {
            return new GuiOxygenSealer(player.inventory, (TileEntityOxygenSealer) tile);
        } else if (tile instanceof TileEntityCargoLoader) {
            return new GuiCargoLoader(player.inventory, (TileEntityCargoLoader) tile);
        } else if (tile instanceof TileEntityCargoUnloader) {
            return new GuiCargoUnloader(player.inventory, (TileEntityCargoUnloader) tile);
        } else if (tile instanceof TileEntityParaChest) {
            return new GuiParaChest(player.inventory, (TileEntityParaChest) tile);
        } else if (tile instanceof TileEntitySolar) {
            return new GuiSolar(player.inventory, (TileEntitySolar) tile);
        } else if (tile instanceof TileEntityAirLockController) {
            return new GuiAirLockController((TileEntityAirLockController) tile);
        } else if (tile instanceof TileEntityEnergyStorageModule) {
            return new GuiEnergyStorageModule(player.inventory, (TileEntityEnergyStorageModule) tile);
        } else if (tile instanceof TileEntityCoalGenerator) {
            return new GuiCoalGenerator(player.inventory, (TileEntityCoalGenerator) tile);
        } else if (tile instanceof TileEntityElectricFurnace) {
            return new GuiElectricFurnace(player.inventory, (TileEntityElectricFurnace) tile);
        } else if (tile instanceof TileEntityIngotCompressor) {
            return new GuiIngotCompressor(player.inventory, (TileEntityIngotCompressor) tile);
        } else if (tile instanceof TileEntityElectricIngotCompressor) {
            return new GuiElectricIngotCompressor(player.inventory, (TileEntityElectricIngotCompressor) tile);
        } else if (tile instanceof TileEntityCircuitFabricator) {
            return new GuiCircuitFabricator(player.inventory, (TileEntityCircuitFabricator) tile);
        } else if (tile instanceof TileEntityOxygenStorageModule) {
            return new GuiOxygenStorageModule(player.inventory, (TileEntityOxygenStorageModule) tile);
        } else if (tile instanceof TileEntityOxygenCompressor) {
            return new GuiOxygenCompressor(player.inventory, (TileEntityOxygenCompressor) tile);
        } else if (tile instanceof TileEntityOxygenDecompressor) {
            return new GuiOxygenDecompressor(player.inventory, (TileEntityOxygenDecompressor) tile);
        } else if (tile instanceof TileEntityDeconstructor) {
            return new GuiDeconstructor(player.inventory, (TileEntityDeconstructor) tile);
        } else if (tile instanceof TileEntityPainter) {
            return new GuiPainter(player.inventory, (TileEntityPainter) tile);
        }
    }
    if (playerClient != null) {
        GCPlayerStatsClient stats = GCPlayerStatsClient.get(playerClient);
        for (ISchematicPage page : stats.getUnlockedSchematics()) {
            if (ID == page.getGuiID()) {
                GuiScreen screen = page.getResultScreen(playerClient, position);
                if (screen instanceof ISchematicResultPage) {
                    ((ISchematicResultPage) screen).setPageIndex(page.getPageID());
                }
                return screen;
            }
        }
    }
    return null;
}
Also used : EntityTieredRocket(micdoodle8.mods.galacticraft.api.prefab.entity.EntityTieredRocket) GuiJoinSpaceRace(micdoodle8.mods.galacticraft.core.client.gui.screen.GuiJoinSpaceRace) GuiCelestialSelection(micdoodle8.mods.galacticraft.core.client.gui.screen.GuiCelestialSelection) GCPlayerStatsClient(micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStatsClient) ISchematicResultPage(micdoodle8.mods.galacticraft.api.recipe.ISchematicResultPage) TileEntity(net.minecraft.tileentity.TileEntity) ISchematicPage(micdoodle8.mods.galacticraft.api.recipe.ISchematicPage) GuiScreen(net.minecraft.client.gui.GuiScreen) GuiNewSpaceRace(micdoodle8.mods.galacticraft.core.client.gui.screen.GuiNewSpaceRace) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) GuiPreLaunchChecklist(micdoodle8.mods.galacticraft.core.client.gui.screen.GuiPreLaunchChecklist) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 5 with GuiCelestialSelection

use of micdoodle8.mods.galacticraft.core.client.gui.screen.GuiCelestialSelection in project Galacticraft by micdoodle8.

the class EntityTieredRocket method onReachAtmosphere.

@Override
public void onReachAtmosphere() {
    // Launch controlled
    if (this.destinationFrequency != -1) {
        if (this.worldObj.isRemote) {
            // stop the sounds on the client - but do not reset, the rocket may start again
            this.stopRocketSound();
            return;
        }
        this.setTarget(true, this.destinationFrequency);
        if (this.targetVec != null) {
            if (this.targetDimension != this.worldObj.provider.getDimensionId()) {
                WorldProvider targetDim = WorldUtil.getProviderForDimensionServer(this.targetDimension);
                if (targetDim != null && targetDim.worldObj instanceof WorldServer) {
                    boolean dimensionAllowed = this.targetDimension == ConfigManagerCore.idDimensionOverworld;
                    if (targetDim instanceof IGalacticraftWorldProvider) {
                        if (((IGalacticraftWorldProvider) targetDim).canSpaceshipTierPass(this.getRocketTier()))
                            dimensionAllowed = true;
                        else
                            dimensionAllowed = false;
                    } else // No rocket flight to non-Galacticraft dimensions other than the Overworld allowed unless config
                    if ((this.targetDimension > 1 || this.targetDimension < -1) && marsConfigAllDimsAllowed != null) {
                        try {
                            if (marsConfigAllDimsAllowed.getBoolean(null)) {
                                dimensionAllowed = true;
                            }
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                    if (dimensionAllowed) {
                        if (this.riddenByEntity != null) {
                            WorldUtil.transferEntityToDimension(this.riddenByEntity, this.targetDimension, (WorldServer) targetDim.worldObj, false, this);
                        } else {
                            Entity e = WorldUtil.transferEntityToDimension(this, this.targetDimension, (WorldServer) targetDim.worldObj, false, null);
                            if (e instanceof EntityAutoRocket) {
                                e.setPosition(this.targetVec.getX() + 0.5F, this.targetVec.getY() + 800, this.targetVec.getZ() + 0.5f);
                                ((EntityAutoRocket) e).setLaunchPhase(EnumLaunchPhase.LANDING);
                                ((EntityAutoRocket) e).setWaitForPlayer(false);
                            } else {
                                GCLog.info("Error: failed to recreate the unmanned rocket in landing mode on target planet.");
                                e.setDead();
                                this.setDead();
                            }
                        }
                        return;
                    }
                }
            // No destination world found - in this situation continue into regular take-off (as if Not launch controlled)
            } else {
                // Same dimension controlled rocket flight
                this.setPosition(this.targetVec.getX() + 0.5F, this.targetVec.getY() + 800, this.targetVec.getZ() + 0.5F);
                // Stop any lateral motion, otherwise it will update to an incorrect x,z position first tick after spawning above target
                this.motionX = this.motionZ = 0.0D;
                // Small upward motion initially, to keep clear of own flame trail from launch
                this.motionY = 0.1D;
                if (this.riddenByEntity != null) {
                    WorldUtil.forceMoveEntityToPos(this.riddenByEntity, (WorldServer) this.worldObj, new Vector3(this.targetVec.getX() + 0.5F, this.targetVec.getY() + 800, this.targetVec.getZ() + 0.5F), false);
                    this.setWaitForPlayer(true);
                    GCLog.debug("Rocket repositioned, waiting for player");
                }
                this.setLaunchPhase(EnumLaunchPhase.LANDING);
                // Do not destroy the rocket, we still need it!
                return;
            }
        } else {
            // Launch controlled launch but no valid target frequency = rocket loss [INVESTIGATE]
            GCLog.info("Error: the launch controlled rocket failed to find a valid landing spot when it reached space.");
            this.fuelTank.drain(Integer.MAX_VALUE, true);
            this.posY = Math.max(255, (this.worldObj.provider instanceof IExitHeight ? ((IExitHeight) this.worldObj.provider).getYCoordinateToTeleport() : 1200) - 200);
            return;
        }
    }
    // Not launch controlled
    if (!this.worldObj.isRemote) {
        if (this.riddenByEntity instanceof EntityPlayerMP) {
            EntityPlayerMP player = (EntityPlayerMP) this.riddenByEntity;
            this.onTeleport(player);
            GCPlayerStats stats = GCPlayerStats.get(player);
            WorldUtil.toCelestialSelection(player, stats, this.getRocketTier());
        }
        // Destroy any rocket which reached the top of the atmosphere and is not controlled by a Launch Controller
        this.setDead();
    }
// Client side, non-launch controlled, do nothing - no reason why it can't continue flying until the GUICelestialSelection activates
}
Also used : ICameraZoomEntity(micdoodle8.mods.galacticraft.api.entity.ICameraZoomEntity) Entity(net.minecraft.entity.Entity) IGalacticraftWorldProvider(micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider) WorldProvider(net.minecraft.world.WorldProvider) IGalacticraftWorldProvider(micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider) GCPlayerStats(micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats) WorldServer(net.minecraft.world.WorldServer) Vector3(micdoodle8.mods.galacticraft.api.vector.Vector3) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) IExitHeight(micdoodle8.mods.galacticraft.api.world.IExitHeight)

Aggregations

GuiCelestialSelection (micdoodle8.mods.galacticraft.core.client.gui.screen.GuiCelestialSelection)4 EntityPlayerSP (net.minecraft.client.entity.EntityPlayerSP)3 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)3 ISchematicPage (micdoodle8.mods.galacticraft.api.recipe.ISchematicPage)2 BlockVec3 (micdoodle8.mods.galacticraft.api.vector.BlockVec3)2 Vector3 (micdoodle8.mods.galacticraft.api.vector.Vector3)2 IGalacticraftWorldProvider (micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider)2 WorldProviderSpaceStation (micdoodle8.mods.galacticraft.core.dimension.WorldProviderSpaceStation)2 Footprint (micdoodle8.mods.galacticraft.core.wrappers.Footprint)2 Minecraft (net.minecraft.client.Minecraft)2 WorldClient (net.minecraft.client.multiplayer.WorldClient)2 Entity (net.minecraft.entity.Entity)2 TileEntity (net.minecraft.tileentity.TileEntity)2 WorldProvider (net.minecraft.world.WorldProvider)2 GameProfile (com.mojang.authlib.GameProfile)1 MinecraftProfileTexture (com.mojang.authlib.minecraft.MinecraftProfileTexture)1 Type (com.mojang.authlib.minecraft.MinecraftProfileTexture.Type)1 Property (com.mojang.authlib.properties.Property)1 IOException (java.io.IOException)1 IDetectableResource (micdoodle8.mods.galacticraft.api.block.IDetectableResource)1