Search in sources :

Example 11 with CelestialBody

use of micdoodle8.mods.galacticraft.api.galaxies.CelestialBody in project Galacticraft by micdoodle8.

the class GalacticraftCore method postInit.

@EventHandler
public void postInit(FMLPostInitializationEvent event) {
    GalacticraftCore.planetMercury = makeDummyPlanet("mercury", GalacticraftCore.solarSystemSol);
    if (GalacticraftCore.planetMercury != null) {
        GalacticraftCore.planetMercury.setRingColorRGB(0.1F, 0.9F, 0.6F).setPhaseShift(1.45F).setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(0.5F, 0.5F)).setRelativeOrbitTime(0.24096385542168674698795180722892F);
    }
    GalacticraftCore.planetVenus = makeDummyPlanet("venus", GalacticraftCore.solarSystemSol);
    if (GalacticraftCore.planetVenus != null) {
        GalacticraftCore.planetVenus.setRingColorRGB(0.1F, 0.9F, 0.6F).setPhaseShift(2.0F).setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(0.75F, 0.75F)).setRelativeOrbitTime(0.61527929901423877327491785323111F);
    }
    GalacticraftCore.planetMars = makeDummyPlanet("mars", GalacticraftCore.solarSystemSol);
    if (GalacticraftCore.planetMars != null) {
        GalacticraftCore.planetMars.setRingColorRGB(0.67F, 0.1F, 0.1F).setPhaseShift(0.1667F).setRelativeSize(0.5319F).setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(1.25F, 1.25F)).setRelativeOrbitTime(1.8811610076670317634173055859803F);
    }
    GalacticraftCore.planetJupiter = makeDummyPlanet("jupiter", GalacticraftCore.solarSystemSol);
    if (GalacticraftCore.planetJupiter != null) {
        GalacticraftCore.planetJupiter.setRingColorRGB(0.1F, 0.9F, 0.6F).setPhaseShift((float) Math.PI).setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(1.5F, 1.5F)).setRelativeOrbitTime(11.861993428258488499452354874042F);
    }
    GalacticraftCore.planetSaturn = makeDummyPlanet("saturn", GalacticraftCore.solarSystemSol);
    if (GalacticraftCore.planetSaturn != null) {
        GalacticraftCore.planetSaturn.setRingColorRGB(0.1F, 0.9F, 0.6F).setPhaseShift(5.45F).setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(1.75F, 1.75F)).setRelativeOrbitTime(29.463307776560788608981380065717F);
    }
    GalacticraftCore.planetUranus = makeDummyPlanet("uranus", GalacticraftCore.solarSystemSol);
    if (GalacticraftCore.planetUranus != null) {
        GalacticraftCore.planetUranus.setRingColorRGB(0.1F, 0.9F, 0.6F).setPhaseShift(1.38F).setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(2.0F, 2.0F)).setRelativeOrbitTime(84.063526834611171960569550930997F);
    }
    GalacticraftCore.planetNeptune = makeDummyPlanet("neptune", GalacticraftCore.solarSystemSol);
    if (GalacticraftCore.planetNeptune != null) {
        GalacticraftCore.planetNeptune.setRingColorRGB(0.1F, 0.9F, 0.6F).setPhaseShift(1.0F).setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(2.25F, 2.25F)).setRelativeOrbitTime(164.84118291347207009857612267251F);
    }
    MinecraftForge.EVENT_BUS.register(new OreGenOtherMods());
    GalacticraftCore.proxy.postInit(event);
    ArrayList<CelestialBody> cBodyList = new ArrayList<CelestialBody>();
    cBodyList.addAll(GalaxyRegistry.getRegisteredPlanets().values());
    cBodyList.addAll(GalaxyRegistry.getRegisteredMoons().values());
    for (CelestialBody body : cBodyList) {
        if (body.shouldAutoRegister()) {
            int id = Arrays.binarySearch(ConfigManagerCore.staticLoadDimensions, body.getDimensionID());
            // It's important this is done in the same order as planets will be registered by WorldUtil.registerPlanet();
            if (GalacticraftRegistry.registerProvider(body.getDimensionID(), body.getWorldProvider(), body.getForceStaticLoad() || id < 0, 0)) {
                body.initialiseMobSpawns();
            } else {
                body.setUnreachable();
            }
        }
        if (body.getSurfaceBlocks() != null) {
            TransformerHooks.spawnListAE2_GC.addAll(body.getSurfaceBlocks());
        }
    }
    CompatibilityManager.checkForCompatibleMods();
    RecipeManagerGC.loadRecipes();
    TileEntityDeconstructor.initialiseRecipeList();
    ItemSchematic.registerSchematicItems();
    NetworkRegistry.INSTANCE.registerGuiHandler(GalacticraftCore.instance, new GuiHandler());
    MinecraftForge.EVENT_BUS.register(new TickHandlerServer());
    GalaxyRegistry.refreshGalaxies();
    // Screen API demo
    GalacticraftRegistry.registerScreen(new GameScreenText());
    try {
        jpgWriter = ImageIO.getImageWritersByFormatName("jpg").next();
        writeParam = jpgWriter.getDefaultWriteParam();
        writeParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
        writeParam.setCompressionQuality(1.0f);
        enableJPEG = true;
    } catch (UnsatisfiedLinkError e) {
        GCLog.severe("Error initialising JPEG compressor - this is likely caused by OpenJDK - see https://wiki.micdoodle8.com/wiki/Compatibility#For_clients_running_OpenJDK");
        e.printStackTrace();
    }
}
Also used : ArrayList(java.util.ArrayList) GuiHandler(micdoodle8.mods.galacticraft.core.client.gui.GuiHandler) GameScreenText(micdoodle8.mods.galacticraft.core.client.screen.GameScreenText) OreGenOtherMods(micdoodle8.mods.galacticraft.core.world.gen.OreGenOtherMods) TickHandlerServer(micdoodle8.mods.galacticraft.core.tick.TickHandlerServer) EventHandler(net.minecraftforge.fml.common.Mod.EventHandler)

Example 12 with CelestialBody

use of micdoodle8.mods.galacticraft.api.galaxies.CelestialBody in project Galacticraft by micdoodle8.

the class WorldUtil method getArrayOfPossibleDimensions.

/**
 * This will *load* all the GC dimensions which the player has access to (taking account of space station permissions).
 * Loading the dimensions through Forge activates any chunk loaders or forced chunks in that dimension,
 * if the dimension was not previously loaded.  This may place load on the server.
 *
 * @param tier       - the rocket tier to test
 * @param playerBase - the player who will be riding the rocket (needed for checking space station permissions)
 * @return a Map of the names of the dimension vs. the dimension IDs
 */
public static HashMap<String, Integer> getArrayOfPossibleDimensions(int tier, EntityPlayerMP playerBase) {
    List<Integer> ids = WorldUtil.getPossibleDimensionsForSpaceshipTier(tier, playerBase);
    final HashMap<String, Integer> map = new HashMap<String, Integer>(ids.size(), 1F);
    for (Integer id : ids) {
        CelestialBody celestialBody = getReachableCelestialBodiesForDimensionID(id);
        // It's a space station
        if (id > 0 && celestialBody == null) {
            celestialBody = GalacticraftCore.satelliteSpaceStation;
            // This no longer checks whether a WorldProvider can be created, for performance reasons (that causes the dimension to load unnecessarily at map building stage)
            if (playerBase != null) {
                final SpaceStationWorldData data = SpaceStationWorldData.getStationData(playerBase.worldObj, id, null);
                map.put(celestialBody.getName() + "$" + data.getOwner() + "$" + data.getSpaceStationName() + "$" + id + "$" + data.getHomePlanet(), id);
            }
        } else // It's a planet or moon
        {
            if (celestialBody == GalacticraftCore.planetOverworld) {
                map.put(celestialBody.getName(), id);
            } else {
                WorldProvider provider = WorldUtil.getProviderForDimensionServer(id);
                if (celestialBody != null && provider != null) {
                    if (provider instanceof IGalacticraftWorldProvider && !(provider instanceof IOrbitDimension) || GCCoreUtil.getDimensionID(provider) == 0) {
                        map.put(celestialBody.getName(), GCCoreUtil.getDimensionID(provider));
                    }
                }
            }
        }
    }
    ArrayList<CelestialBody> cBodyList = new ArrayList<CelestialBody>();
    cBodyList.addAll(GalaxyRegistry.getRegisteredPlanets().values());
    cBodyList.addAll(GalaxyRegistry.getRegisteredMoons().values());
    for (CelestialBody body : cBodyList) {
        if (!body.getReachable()) {
            map.put(body.getLocalizedName() + "*", body.getDimensionID());
        }
    }
    WorldUtil.celestialMapCache.put(playerBase, map);
    return map;
}
Also used : SpaceStationWorldData(micdoodle8.mods.galacticraft.core.dimension.SpaceStationWorldData) IGalacticraftWorldProvider(micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider) IGalacticraftWorldProvider(micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider) IOrbitDimension(micdoodle8.mods.galacticraft.api.world.IOrbitDimension)

Example 13 with CelestialBody

use of micdoodle8.mods.galacticraft.api.galaxies.CelestialBody in project Galacticraft by micdoodle8.

the class GuiCelestialSelection method drawCelestialBodies.

public HashMap<CelestialBody, Matrix4f> drawCelestialBodies(Matrix4f worldMatrix) {
    GL11.glColor3f(1, 1, 1);
    FloatBuffer fb = BufferUtils.createFloatBuffer(16 * Float.SIZE);
    HashMap<CelestialBody, Matrix4f> matrixMap = Maps.newHashMap();
    for (SolarSystem solarSystem : GalaxyRegistry.getRegisteredSolarSystems().values()) {
        Star star = solarSystem.getMainStar();
        if (star != null && star.getBodyIcon() != null) {
            GL11.glPushMatrix();
            Matrix4f worldMatrix0 = new Matrix4f(worldMatrix);
            Matrix4f.translate(this.getCelestialBodyPosition(star), worldMatrix0, worldMatrix0);
            Matrix4f worldMatrix1 = new Matrix4f();
            Matrix4f.rotate((float) Math.toRadians(45), new Vector3f(0, 0, 1), worldMatrix1, worldMatrix1);
            Matrix4f.rotate((float) Math.toRadians(-55), new Vector3f(1, 0, 0), worldMatrix1, worldMatrix1);
            worldMatrix1 = Matrix4f.mul(worldMatrix0, worldMatrix1, worldMatrix1);
            fb.rewind();
            worldMatrix1.store(fb);
            fb.flip();
            GL11.glMultMatrix(fb);
            float alpha = 1.0F;
            if (this.selectedBody != null && this.selectedBody != star && this.isZoomed()) {
                alpha = 1.0F - Math.min(this.ticksSinceSelection / 25.0F, 1.0F);
            }
            if (this.selectedBody != null && this.isZoomed()) {
                if (star != this.selectedBody) {
                    alpha = 1.0F - Math.min(this.ticksSinceSelection / 25.0F, 1.0F);
                    if (!(this.lastSelectedBody instanceof Star) && this.lastSelectedBody != null) {
                        alpha = 0.0F;
                    }
                }
            }
            if (alpha != 0) {
                CelestialBodyRenderEvent.Pre preEvent = new CelestialBodyRenderEvent.Pre(star, star.getBodyIcon(), 8);
                MinecraftForge.EVENT_BUS.post(preEvent);
                GL11.glColor4f(1, 1, 1, alpha);
                if (preEvent.celestialBodyTexture != null) {
                    this.mc.renderEngine.bindTexture(preEvent.celestialBodyTexture);
                }
                if (!preEvent.isCanceled()) {
                    int size = getWidthForCelestialBodyStatic(star);
                    if (star == this.selectedBody && this.selectionState == EnumSelection.SELECTED) {
                        size /= 2;
                        size *= 3;
                    }
                    this.drawTexturedModalRect(-size / 2, -size / 2, size, size, 0, 0, preEvent.textureSize, preEvent.textureSize, false, false, preEvent.textureSize, preEvent.textureSize);
                    matrixMap.put(star, worldMatrix1);
                }
                CelestialBodyRenderEvent.Post postEvent = new CelestialBodyRenderEvent.Post(star);
                MinecraftForge.EVENT_BUS.post(postEvent);
            }
            fb.clear();
            GL11.glPopMatrix();
        }
    }
    for (Planet planet : GalaxyRegistry.getRegisteredPlanets().values()) {
        if (planet.getBodyIcon() != null) {
            GL11.glPushMatrix();
            Matrix4f worldMatrix0 = new Matrix4f(worldMatrix);
            Matrix4f.translate(this.getCelestialBodyPosition(planet), worldMatrix0, worldMatrix0);
            Matrix4f worldMatrix1 = new Matrix4f();
            Matrix4f.rotate((float) Math.toRadians(45), new Vector3f(0, 0, 1), worldMatrix1, worldMatrix1);
            Matrix4f.rotate((float) Math.toRadians(-55), new Vector3f(1, 0, 0), worldMatrix1, worldMatrix1);
            worldMatrix1 = Matrix4f.mul(worldMatrix0, worldMatrix1, worldMatrix1);
            fb.rewind();
            worldMatrix1.store(fb);
            fb.flip();
            GL11.glMultMatrix(fb);
            float alpha = 1.0F;
            if ((this.selectedBody instanceof IChildBody && ((IChildBody) this.selectedBody).getParentPlanet() != planet) || (this.selectedBody instanceof Planet && this.selectedBody != planet && this.isZoomed())) {
                if (this.lastSelectedBody == null && !(this.selectedBody instanceof IChildBody)) {
                    alpha = 1.0F - Math.min(this.ticksSinceSelection / 25.0F, 1.0F);
                } else {
                    alpha = 0.0F;
                }
            }
            if (alpha != 0) {
                CelestialBodyRenderEvent.Pre preEvent = new CelestialBodyRenderEvent.Pre(planet, planet.getBodyIcon(), 12);
                MinecraftForge.EVENT_BUS.post(preEvent);
                GL11.glColor4f(1, 1, 1, alpha);
                if (preEvent.celestialBodyTexture != null) {
                    this.mc.renderEngine.bindTexture(preEvent.celestialBodyTexture);
                }
                if (!preEvent.isCanceled()) {
                    int size = getWidthForCelestialBodyStatic(planet);
                    // Celestial body textures are 12x12 in a 16x16 .png
                    this.drawTexturedModalRect(-size / 2, -size / 2, size, size, 0, 0, preEvent.textureSize, preEvent.textureSize, false, false, 16, 16);
                    matrixMap.put(planet, worldMatrix1);
                }
                CelestialBodyRenderEvent.Post postEvent = new CelestialBodyRenderEvent.Post(planet);
                MinecraftForge.EVENT_BUS.post(postEvent);
            }
            fb.clear();
            GL11.glPopMatrix();
        }
    }
    if (this.selectedBody != null) {
        Matrix4f worldMatrix0 = new Matrix4f(worldMatrix);
        for (Moon moon : GalaxyRegistry.getRegisteredMoons().values()) {
            if ((moon == this.selectedBody || (moon.getParentPlanet() == this.selectedBody && this.selectionState != EnumSelection.SELECTED)) && (this.ticksSinceSelection > 35 || this.selectedBody == moon || (this.lastSelectedBody instanceof Moon && GalaxyRegistry.getMoonsForPlanet(((Moon) this.lastSelectedBody).getParentPlanet()).contains(moon))) || getSiblings(this.selectedBody).contains(moon)) {
                GL11.glPushMatrix();
                Matrix4f worldMatrix1 = new Matrix4f(worldMatrix0);
                Matrix4f.translate(this.getCelestialBodyPosition(moon), worldMatrix1, worldMatrix1);
                Matrix4f worldMatrix2 = new Matrix4f();
                Matrix4f.rotate((float) Math.toRadians(45), new Vector3f(0, 0, 1), worldMatrix2, worldMatrix2);
                Matrix4f.rotate((float) Math.toRadians(-55), new Vector3f(1, 0, 0), worldMatrix2, worldMatrix2);
                Matrix4f.scale(new Vector3f(0.25F, 0.25F, 1.0F), worldMatrix2, worldMatrix2);
                worldMatrix2 = Matrix4f.mul(worldMatrix1, worldMatrix2, worldMatrix2);
                fb.rewind();
                worldMatrix2.store(fb);
                fb.flip();
                GL11.glMultMatrix(fb);
                CelestialBodyRenderEvent.Pre preEvent = new CelestialBodyRenderEvent.Pre(moon, moon.getBodyIcon(), 8);
                MinecraftForge.EVENT_BUS.post(preEvent);
                GL11.glColor4f(1, 1, 1, 1);
                if (preEvent.celestialBodyTexture != null) {
                    this.mc.renderEngine.bindTexture(preEvent.celestialBodyTexture);
                }
                if (!preEvent.isCanceled()) {
                    int size = getWidthForCelestialBodyStatic(moon);
                    this.drawTexturedModalRect(-size / 2, -size / 2, size, size, 0, 0, preEvent.textureSize, preEvent.textureSize, false, false, preEvent.textureSize, preEvent.textureSize);
                    matrixMap.put(moon, worldMatrix1);
                }
                CelestialBodyRenderEvent.Post postEvent = new CelestialBodyRenderEvent.Post(moon);
                MinecraftForge.EVENT_BUS.post(postEvent);
                fb.clear();
                GL11.glPopMatrix();
            }
        }
    }
    if (this.selectedBody != null) {
        Matrix4f worldMatrix0 = new Matrix4f(worldMatrix);
        for (Satellite satellite : GalaxyRegistry.getRegisteredSatellites().values()) {
            if (this.possibleBodies != null && this.possibleBodies.contains(satellite)) {
                if ((satellite == this.selectedBody || (satellite.getParentPlanet() == this.selectedBody && this.selectionState != EnumSelection.SELECTED)) && (this.ticksSinceSelection > 35 || this.selectedBody == satellite || (this.lastSelectedBody instanceof Satellite && GalaxyRegistry.getSatellitesForCelestialBody(((Satellite) this.lastSelectedBody).getParentPlanet()).contains(satellite)))) {
                    GL11.glPushMatrix();
                    Matrix4f worldMatrix1 = new Matrix4f(worldMatrix0);
                    Matrix4f.translate(this.getCelestialBodyPosition(satellite), worldMatrix1, worldMatrix1);
                    Matrix4f worldMatrix2 = new Matrix4f();
                    Matrix4f.rotate((float) Math.toRadians(45), new Vector3f(0, 0, 1), worldMatrix2, worldMatrix2);
                    Matrix4f.rotate((float) Math.toRadians(-55), new Vector3f(1, 0, 0), worldMatrix2, worldMatrix2);
                    Matrix4f.scale(new Vector3f(0.25F, 0.25F, 1.0F), worldMatrix2, worldMatrix2);
                    worldMatrix2 = Matrix4f.mul(worldMatrix1, worldMatrix2, worldMatrix2);
                    fb.rewind();
                    worldMatrix2.store(fb);
                    fb.flip();
                    GL11.glMultMatrix(fb);
                    CelestialBodyRenderEvent.Pre preEvent = new CelestialBodyRenderEvent.Pre(satellite, satellite.getBodyIcon(), 8);
                    MinecraftForge.EVENT_BUS.post(preEvent);
                    GL11.glColor4f(1, 1, 1, 1);
                    this.mc.renderEngine.bindTexture(preEvent.celestialBodyTexture);
                    if (!preEvent.isCanceled()) {
                        int size = getWidthForCelestialBodyStatic(satellite);
                        this.drawTexturedModalRect(-size / 2, -size / 2, size, size, 0, 0, preEvent.textureSize, preEvent.textureSize, false, false, preEvent.textureSize, preEvent.textureSize);
                        matrixMap.put(satellite, worldMatrix1);
                    }
                    CelestialBodyRenderEvent.Post postEvent = new CelestialBodyRenderEvent.Post(satellite);
                    MinecraftForge.EVENT_BUS.post(postEvent);
                    fb.clear();
                    GL11.glPopMatrix();
                }
            }
        }
    }
    return matrixMap;
}
Also used : FloatBuffer(java.nio.FloatBuffer) Matrix4f(org.lwjgl.util.vector.Matrix4f) CelestialBodyRenderEvent(micdoodle8.mods.galacticraft.api.event.client.CelestialBodyRenderEvent) Vector3f(org.lwjgl.util.vector.Vector3f)

Example 14 with CelestialBody

use of micdoodle8.mods.galacticraft.api.galaxies.CelestialBody in project Galacticraft by micdoodle8.

the class GuiCelestialSelection method drawCircle.

protected boolean drawCircle(CelestialBody body, int count, float sin, float cos) {
    float x = this.getScale(body);
    float y = 0;
    float alpha = 1;
    if (this.isZoomed()) {
        alpha = this.selectedBody instanceof IChildBody ? 1.0F : Math.min(Math.max((this.ticksSinceSelection - 30) / 15.0F, 0.0F), 1.0F);
        if (this.lastSelectedBody instanceof Moon && body instanceof Moon) {
            if (GalaxyRegistry.getMoonsForPlanet(((Moon) this.lastSelectedBody).getParentPlanet()).contains(body)) {
                alpha = 1.0F;
            }
        } else if (this.lastSelectedBody instanceof Satellite && body instanceof Satellite) {
            if (GalaxyRegistry.getSatellitesForCelestialBody(((Satellite) this.lastSelectedBody).getParentPlanet()).contains(body)) {
                alpha = 1.0F;
            }
        }
    }
    if (alpha != 0) {
        switch(count % 2) {
            case 0:
                GL11.glColor4f(0.0F, 0.6F, 1.0F, alpha);
                break;
            case 1:
                GL11.glColor4f(0.4F, 0.9F, 1.0F, alpha);
                break;
        }
        CelestialBodyRenderEvent.CelestialRingRenderEvent.Pre preEvent = new CelestialBodyRenderEvent.CelestialRingRenderEvent.Pre(body, new Vector3f(0.0F, 0.0F, 0.0F));
        MinecraftForge.EVENT_BUS.post(preEvent);
        if (!preEvent.isCanceled()) {
            GL11.glBegin(GL11.GL_LINE_LOOP);
            float temp;
            for (int i = 0; i < 90; i++) {
                GL11.glVertex2f(x, y);
                temp = x;
                x = cos * x - sin * y;
                y = sin * temp + cos * y;
            }
            GL11.glEnd();
            return true;
        }
        CelestialBodyRenderEvent.CelestialRingRenderEvent.Post postEvent = new CelestialBodyRenderEvent.CelestialRingRenderEvent.Post(body);
        MinecraftForge.EVENT_BUS.post(postEvent);
    }
    return false;
}
Also used : CelestialBodyRenderEvent(micdoodle8.mods.galacticraft.api.event.client.CelestialBodyRenderEvent) Vector3f(org.lwjgl.util.vector.Vector3f)

Example 15 with CelestialBody

use of micdoodle8.mods.galacticraft.api.galaxies.CelestialBody in project Galacticraft by micdoodle8.

the class GuiCelestialSelection method drawButtons.

public void drawButtons(int mousePosX, int mousePosY) {
    this.zLevel = 0.0F;
    boolean handledSliderPos = false;
    final int LHS = GuiCelestialSelection.BORDER_SIZE + GuiCelestialSelection.BORDER_EDGE_SIZE;
    final int RHS = width - LHS;
    final int TOP = LHS;
    final int BOT = height - LHS;
    if (this.viewState == EnumView.PROFILE) {
        this.mc.renderEngine.bindTexture(GuiCelestialSelection.guiMain0);
        GL11.glColor4f(0.0F, 0.6F, 1.0F, 1);
        this.drawTexturedModalRect(width / 2 - 43, TOP, 86, 15, 266, 0, 172, 29, false, false);
        String str = GCCoreUtil.translate("gui.message.catalog.name").toUpperCase();
        this.fontRendererObj.drawString(str, width / 2 - this.fontRendererObj.getStringWidth(str) / 2, TOP + this.fontRendererObj.FONT_HEIGHT / 2, WHITE);
        if (this.selectedBody != null) {
            this.mc.renderEngine.bindTexture(GuiCelestialSelection.guiMain0);
            if (mousePosX > LHS && mousePosX < LHS + 88 && mousePosY > TOP && mousePosY < TOP + 13) {
                GL11.glColor3f(3.0F, 0.0F, 0.0F);
            } else {
                GL11.glColor3f(0.9F, 0.2F, 0.2F);
            }
            this.drawTexturedModalRect(LHS, TOP, 88, 13, 0, 392, 148, 22, false, false);
            str = GCCoreUtil.translate("gui.message.back.name").toUpperCase();
            this.fontRendererObj.drawString(str, LHS + 45 - this.fontRendererObj.getStringWidth(str) / 2, TOP + this.fontRendererObj.FONT_HEIGHT / 2 - 2, WHITE);
            this.mc.renderEngine.bindTexture(GuiCelestialSelection.guiMain0);
            if (mousePosX > RHS - 88 && mousePosX < RHS && mousePosY > TOP && mousePosY < TOP + 13) {
                GL11.glColor3f(0.0F, 3.0F, 0.0F);
            } else {
                GL11.glColor3f(0.2F, 0.9F, 0.2F);
            }
            this.drawTexturedModalRect(RHS - 88, TOP, 88, 13, 0, 392, 148, 22, true, false);
            GL11.glColor4f(0.0F, 0.6F, 1.0F, 1);
            this.drawTexturedModalRect(LHS, BOT - 13, 88, 13, 0, 392, 148, 22, false, true);
            this.drawTexturedModalRect(RHS - 88, BOT - 13, 88, 13, 0, 392, 148, 22, true, true);
            int menuTopLeft = TOP - 115 + height / 2 - 4;
            int posX = LHS + Math.min(this.ticksSinceSelection * 10, 133) - 134;
            int posX2 = (int) (LHS + Math.min(this.ticksSinceSelection * 1.25F, 15) - 15);
            int fontPosY = menuTopLeft + GuiCelestialSelection.BORDER_EDGE_SIZE + this.fontRendererObj.FONT_HEIGHT / 2 - 2;
            this.drawTexturedModalRect(posX, menuTopLeft + 12, 133, 196, 0, 0, 266, 392, false, false);
            // str = this.selectedBody.getLocalizedName();
            // this.fontRendererObj.drawString(str, posX + 20, fontPosY, GCCoreUtil.to32BitColor(255, 255, 255, 255));
            str = GCCoreUtil.translate("gui.message.daynightcycle.name") + ":";
            this.fontRendererObj.drawString(str, posX + 5, fontPosY + 14, CYAN);
            str = GCCoreUtil.translate("gui.message." + this.selectedBody.getName() + ".daynightcycle.0.name");
            this.fontRendererObj.drawString(str, posX + 10, fontPosY + 25, WHITE);
            str = GCCoreUtil.translate("gui.message." + this.selectedBody.getName() + ".daynightcycle.1.name");
            if (!str.isEmpty()) {
                this.fontRendererObj.drawString(str, posX + 10, fontPosY + 36, WHITE);
            }
            str = GCCoreUtil.translate("gui.message.surfacegravity.name") + ":";
            this.fontRendererObj.drawString(str, posX + 5, fontPosY + 50, CYAN);
            str = GCCoreUtil.translate("gui.message." + this.selectedBody.getName() + ".surfacegravity.0.name");
            this.fontRendererObj.drawString(str, posX + 10, fontPosY + 61, WHITE);
            str = GCCoreUtil.translate("gui.message." + this.selectedBody.getName() + ".surfacegravity.1.name");
            if (!str.isEmpty()) {
                this.fontRendererObj.drawString(str, posX + 10, fontPosY + 72, WHITE);
            }
            str = GCCoreUtil.translate("gui.message.surfacecomposition.name") + ":";
            this.fontRendererObj.drawString(str, posX + 5, fontPosY + 88, CYAN);
            str = GCCoreUtil.translate("gui.message." + this.selectedBody.getName() + ".surfacecomposition.0.name");
            this.fontRendererObj.drawString(str, posX + 10, fontPosY + 99, WHITE);
            str = GCCoreUtil.translate("gui.message." + this.selectedBody.getName() + ".surfacecomposition.1.name");
            if (!str.isEmpty()) {
                this.fontRendererObj.drawString(str, posX + 10, fontPosY + 110, WHITE);
            }
            str = GCCoreUtil.translate("gui.message.atmosphere.name") + ":";
            this.fontRendererObj.drawString(str, posX + 5, fontPosY + 126, CYAN);
            str = GCCoreUtil.translate("gui.message." + this.selectedBody.getName() + ".atmosphere.0.name");
            this.fontRendererObj.drawString(str, posX + 10, fontPosY + 137, WHITE);
            str = GCCoreUtil.translate("gui.message." + this.selectedBody.getName() + ".atmosphere.1.name");
            if (!str.isEmpty()) {
                this.fontRendererObj.drawString(str, posX + 10, fontPosY + 148, WHITE);
            }
            str = GCCoreUtil.translate("gui.message.meansurfacetemp.name") + ":";
            this.fontRendererObj.drawString(str, posX + 5, fontPosY + 165, CYAN);
            str = GCCoreUtil.translate("gui.message." + this.selectedBody.getName() + ".meansurfacetemp.0.name");
            this.fontRendererObj.drawString(str, posX + 10, fontPosY + 176, WHITE);
            str = GCCoreUtil.translate("gui.message." + this.selectedBody.getName() + ".meansurfacetemp.1.name");
            if (!str.isEmpty()) {
                this.fontRendererObj.drawString(str, posX + 10, fontPosY + 187, WHITE);
            }
            this.mc.renderEngine.bindTexture(GuiCelestialSelection.guiMain0);
            GL11.glColor4f(0.0F, 0.6F, 1.0F, 1);
            this.drawTexturedModalRect(posX2, menuTopLeft + 12, 17, 199, 439, 0, 32, 399, false, false);
        // this.drawRectD(posX2 + 16.5, menuTopLeft + 13, posX + 131, menuTopLeft + 14, GCCoreUtil.to32BitColor(120, 0, (int) (0.6F * 255), 255));
        }
    } else {
        String str;
        // Catalog:
        this.mc.renderEngine.bindTexture(GuiCelestialSelection.guiMain0);
        GL11.glColor4f(0.0F, 0.6F, 1.0F, 1);
        this.drawTexturedModalRect(LHS, TOP, 74, 11, 0, 392, 148, 22, false, false);
        str = GCCoreUtil.translate("gui.message.catalog.name").toUpperCase();
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        this.fontRendererObj.drawString(str, LHS + 40 - fontRendererObj.getStringWidth(str) / 2, TOP + 1, WHITE);
        int scale = (int) Math.min(95, this.ticksSinceMenuOpen * 12.0F);
        boolean planetZoomedNotMoon = this.isZoomed() && !(this.selectedParent instanceof Planet);
        // Parent frame:
        GL11.glColor4f(0.0F, 0.6F, 1.0F, 1);
        this.mc.renderEngine.bindTexture(GuiCelestialSelection.guiMain0);
        this.drawTexturedModalRect(LHS - 95 + scale, TOP + 12, 95, 41, 0, 436, 95, 41, false, false);
        str = planetZoomedNotMoon ? this.selectedBody.getLocalizedName() : this.getParentName();
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        this.fontRendererObj.drawString(str, LHS + 9 - 95 + scale, TOP + 34, WHITE);
        GL11.glColor4f(1, 1, 0, 1);
        this.mc.renderEngine.bindTexture(GuiCelestialSelection.guiMain0);
        // Grandparent frame:
        this.drawTexturedModalRect(LHS + 2 - 95 + scale, TOP + 14, 93, 17, 95, 436, 93, 17, false, false);
        str = planetZoomedNotMoon ? this.getParentName() : this.getGrandparentName();
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        this.fontRendererObj.drawString(str, LHS + 7 - 95 + scale, TOP + 16, GREY3);
        GL11.glColor4f(0.0F, 0.6F, 1.0F, 1);
        List<CelestialBody> children = this.getChildren(planetZoomedNotMoon ? this.selectedBody : this.selectedParent);
        drawChildren(children, 0, 0, true);
        if (this.mapMode) {
            this.mc.renderEngine.bindTexture(GuiCelestialSelection.guiMain0);
            GL11.glColor4f(1.0F, 0.0F, 0.0F, 1);
            this.mc.renderEngine.bindTexture(GuiCelestialSelection.guiMain0);
            this.drawTexturedModalRect(RHS - 74, TOP, 74, 11, 0, 392, 148, 22, true, false);
            str = GCCoreUtil.translate("gui.message.exit.name").toUpperCase();
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            this.fontRendererObj.drawString(str, RHS - 40 - fontRendererObj.getStringWidth(str) / 2, TOP + 1, WHITE);
        }
        if (this.selectedBody != null) {
            // Right-hand bar (basic selectionState info)
            this.mc.renderEngine.bindTexture(GuiCelestialSelection.guiMain1);
            GL11.glColor4f(0.0F, 0.6F, 1.0F, 1);
            if (this.selectedBody instanceof Satellite) {
                Satellite selectedSatellite = (Satellite) this.selectedBody;
                int stationListSize = this.spaceStationMap.get(getSatelliteParentID(selectedSatellite)).size();
                this.mc.renderEngine.bindTexture(GuiCelestialSelection.guiMain1);
                int max = Math.min((this.height / 2) / 14, stationListSize);
                this.drawTexturedModalRect(RHS - 95, TOP, 95, 53, this.selectedStationOwner.length() == 0 ? 95 : 0, 186, 95, 53, false, false);
                if (this.spaceStationListOffset <= 0) {
                    GL11.glColor4f(0.65F, 0.65F, 0.65F, 1);
                } else {
                    GL11.glColor4f(0.0F, 0.6F, 1.0F, 1);
                }
                this.drawTexturedModalRect(RHS - 85, TOP + 45, 61, 4, 0, 239, 61, 4, false, false);
                if (max + spaceStationListOffset >= stationListSize) {
                    GL11.glColor4f(0.65F, 0.65F, 0.65F, 1);
                } else {
                    GL11.glColor4f(0.0F, 0.6F, 1.0F, 1);
                }
                this.drawTexturedModalRect(RHS - 85, TOP + 49 + max * 14, 61, 4, 0, 239, 61, 4, false, true);
                GL11.glColor4f(0.0F, 0.6F, 1.0F, 1);
                if (this.spaceStationMap.get(getSatelliteParentID(selectedSatellite)).get(this.selectedStationOwner) == null) {
                    str = GCCoreUtil.translate("gui.message.select_ss.name");
                    this.drawSplitString(str, RHS - 47, TOP + 20, 91, WHITE, false, false);
                } else {
                    str = GCCoreUtil.translate("gui.message.ss_owner.name");
                    this.fontRendererObj.drawString(str, RHS - 85, TOP + 18, WHITE);
                    str = this.selectedStationOwner;
                    this.fontRendererObj.drawString(str, RHS - 47 - this.fontRendererObj.getStringWidth(str) / 2, TOP + 30, WHITE);
                }
                Iterator<Map.Entry<String, StationDataGUI>> it = this.spaceStationMap.get(getSatelliteParentID(selectedSatellite)).entrySet().iterator();
                int i = 0;
                int j = 0;
                while (it.hasNext() && i < max) {
                    Map.Entry<String, StationDataGUI> e = it.next();
                    if (j >= this.spaceStationListOffset) {
                        this.mc.renderEngine.bindTexture(GuiCelestialSelection.guiMain0);
                        GL11.glColor4f(0.0F, 0.6F, 1.0F, 1);
                        int xOffset = 0;
                        if (e.getKey().equalsIgnoreCase(this.selectedStationOwner)) {
                            xOffset -= 5;
                        }
                        this.drawTexturedModalRect(RHS - 95 + xOffset, TOP + 50 + i * 14, 93, 12, 95, 464, 93, 12, true, false);
                        str = "";
                        String str0 = e.getValue().getStationName();
                        int point = 0;
                        while (this.fontRendererObj.getStringWidth(str) < 80 && point < str0.length()) {
                            str = str + str0.substring(point, point + 1);
                            point++;
                        }
                        if (this.fontRendererObj.getStringWidth(str) >= 80) {
                            str = str.substring(0, str.length() - 3);
                            str = str + "...";
                        }
                        this.fontRendererObj.drawString(str, RHS - 88 + xOffset, TOP + 52 + i * 14, WHITE);
                        i++;
                    }
                    j++;
                }
            } else {
                this.drawTexturedModalRect(RHS - 96, TOP, 96, 139, 63, 0, 96, 139, false, false);
            }
            if (this.canCreateSpaceStation(this.selectedBody) && (!(this.selectedBody instanceof Satellite))) {
                GL11.glColor4f(0.0F, 0.6F, 1.0F, 1);
                this.mc.renderEngine.bindTexture(GuiCelestialSelection.guiMain1);
                int canCreateLength = Math.max(0, this.drawSplitString(GCCoreUtil.translate("gui.message.can_create_space_station.name"), 0, 0, 91, 0, true, true) - 2);
                canCreateOffset = canCreateLength * this.fontRendererObj.FONT_HEIGHT;
                this.drawTexturedModalRect(RHS - 95, TOP + 134, 93, 4, 159, 102, 93, 4, false, false);
                for (int barY = 0; barY < canCreateLength; ++barY) {
                    this.drawTexturedModalRect(RHS - 95, TOP + 138 + barY * this.fontRendererObj.FONT_HEIGHT, 93, this.fontRendererObj.FONT_HEIGHT, 159, 106, 93, this.fontRendererObj.FONT_HEIGHT, false, false);
                }
                this.drawTexturedModalRect(RHS - 95, TOP + 138 + canCreateOffset, 93, 43, 159, 106, 93, 43, false, false);
                this.drawTexturedModalRect(RHS - 79, TOP + 129, 61, 4, 0, 170, 61, 4, false, false);
                SpaceStationRecipe recipe = WorldUtil.getSpaceStationRecipe(this.selectedBody.getDimensionID());
                if (recipe != null) {
                    GL11.glColor4f(0.0F, 1.0F, 0.1F, 1);
                    boolean validInputMaterials = true;
                    int i = 0;
                    for (Map.Entry<Object, Integer> e : recipe.getInput().entrySet()) {
                        Object next = e.getKey();
                        int xPos = (int) (RHS - 95 + i * 93 / (double) recipe.getInput().size() + 5);
                        int yPos = TOP + 154 + canCreateOffset;
                        if (next instanceof ItemStack) {
                            int amount = getAmountInInventory((ItemStack) next);
                            RenderHelper.enableGUIStandardItemLighting();
                            ItemStack toRender = ((ItemStack) next).copy();
                            this.itemRender.renderItemAndEffectIntoGUI(toRender, xPos, yPos);
                            this.itemRender.renderItemOverlayIntoGUI(mc.fontRendererObj, toRender, xPos, yPos, null);
                            RenderHelper.disableStandardItemLighting();
                            GL11.glEnable(GL11.GL_BLEND);
                            if (mousePosX >= xPos && mousePosX <= xPos + 16 && mousePosY >= yPos && mousePosY <= yPos + 16) {
                                GL11.glDepthMask(true);
                                GL11.glEnable(GL11.GL_DEPTH_TEST);
                                GL11.glPushMatrix();
                                GL11.glTranslatef(0, 0, 300);
                                int k = this.fontRendererObj.getStringWidth(((ItemStack) next).getDisplayName());
                                int j2 = mousePosX - k / 2;
                                int k2 = mousePosY - 12;
                                int i1 = 8;
                                if (j2 + k > this.width) {
                                    j2 -= (j2 - this.width + k);
                                }
                                if (k2 + i1 + 6 > this.height) {
                                    k2 = this.height - i1 - 6;
                                }
                                int j1 = ColorUtil.to32BitColor(190, 0, 153, 255);
                                this.drawGradientRect(j2 - 3, k2 - 4, j2 + k + 3, k2 - 3, j1, j1);
                                this.drawGradientRect(j2 - 3, k2 + i1 + 3, j2 + k + 3, k2 + i1 + 4, j1, j1);
                                this.drawGradientRect(j2 - 3, k2 - 3, j2 + k + 3, k2 + i1 + 3, j1, j1);
                                this.drawGradientRect(j2 - 4, k2 - 3, j2 - 3, k2 + i1 + 3, j1, j1);
                                this.drawGradientRect(j2 + k + 3, k2 - 3, j2 + k + 4, k2 + i1 + 3, j1, j1);
                                int k1 = ColorUtil.to32BitColor(170, 0, 153, 255);
                                int l1 = (k1 & 16711422) >> 1 | k1 & -16777216;
                                this.drawGradientRect(j2 - 3, k2 - 3 + 1, j2 - 3 + 1, k2 + i1 + 3 - 1, k1, l1);
                                this.drawGradientRect(j2 + k + 2, k2 - 3 + 1, j2 + k + 3, k2 + i1 + 3 - 1, k1, l1);
                                this.drawGradientRect(j2 - 3, k2 - 3, j2 + k + 3, k2 - 3 + 1, k1, k1);
                                this.drawGradientRect(j2 - 3, k2 + i1 + 2, j2 + k + 3, k2 + i1 + 3, l1, l1);
                                this.fontRendererObj.drawString(((ItemStack) next).getDisplayName(), j2, k2, WHITE);
                                GL11.glPopMatrix();
                            }
                            str = "" + e.getValue();
                            boolean valid = amount >= e.getValue();
                            if (!valid && validInputMaterials) {
                                validInputMaterials = false;
                            }
                            int color = valid | this.mc.thePlayer.capabilities.isCreativeMode ? GREEN : RED;
                            this.fontRendererObj.drawString(str, xPos + 8 - this.fontRendererObj.getStringWidth(str) / 2, TOP + 170 + canCreateOffset, color);
                        } else if (next instanceof Collection) {
                            Collection<ItemStack> items = (Collection<ItemStack>) next;
                            int amount = 0;
                            for (ItemStack stack : items) {
                                amount += getAmountInInventory(stack);
                            }
                            RenderHelper.enableGUIStandardItemLighting();
                            Iterator<ItemStack> it = items.iterator();
                            int count = 0;
                            int toRenderIndex = (this.ticksSinceMenuOpen / 20) % items.size();
                            ItemStack toRender = null;
                            while (it.hasNext()) {
                                ItemStack stack = it.next();
                                if (count == toRenderIndex) {
                                    toRender = stack;
                                    break;
                                }
                                count++;
                            }
                            if (toRender == null) {
                                continue;
                            }
                            this.itemRender.renderItemAndEffectIntoGUI(toRender, xPos, yPos);
                            this.itemRender.renderItemOverlayIntoGUI(mc.fontRendererObj, toRender, xPos, yPos, null);
                            RenderHelper.disableStandardItemLighting();
                            GL11.glEnable(GL11.GL_BLEND);
                            if (mousePosX >= xPos && mousePosX <= xPos + 16 && mousePosY >= yPos && mousePosY <= yPos + 16) {
                                GL11.glDepthMask(true);
                                GL11.glEnable(GL11.GL_DEPTH_TEST);
                                GL11.glPushMatrix();
                                GL11.glTranslatef(0, 0, 300);
                                int k = this.fontRendererObj.getStringWidth(toRender.getDisplayName());
                                int j2 = mousePosX - k / 2;
                                int k2 = mousePosY - 12;
                                int i1 = 8;
                                if (j2 + k > this.width) {
                                    j2 -= (j2 - this.width + k);
                                }
                                if (k2 + i1 + 6 > this.height) {
                                    k2 = this.height - i1 - 6;
                                }
                                int j1 = ColorUtil.to32BitColor(190, 0, 153, 255);
                                this.drawGradientRect(j2 - 3, k2 - 4, j2 + k + 3, k2 - 3, j1, j1);
                                this.drawGradientRect(j2 - 3, k2 + i1 + 3, j2 + k + 3, k2 + i1 + 4, j1, j1);
                                this.drawGradientRect(j2 - 3, k2 - 3, j2 + k + 3, k2 + i1 + 3, j1, j1);
                                this.drawGradientRect(j2 - 4, k2 - 3, j2 - 3, k2 + i1 + 3, j1, j1);
                                this.drawGradientRect(j2 + k + 3, k2 - 3, j2 + k + 4, k2 + i1 + 3, j1, j1);
                                int k1 = ColorUtil.to32BitColor(170, 0, 153, 255);
                                int l1 = (k1 & 16711422) >> 1 | k1 & -16777216;
                                this.drawGradientRect(j2 - 3, k2 - 3 + 1, j2 - 3 + 1, k2 + i1 + 3 - 1, k1, l1);
                                this.drawGradientRect(j2 + k + 2, k2 - 3 + 1, j2 + k + 3, k2 + i1 + 3 - 1, k1, l1);
                                this.drawGradientRect(j2 - 3, k2 - 3, j2 + k + 3, k2 - 3 + 1, k1, k1);
                                this.drawGradientRect(j2 - 3, k2 + i1 + 2, j2 + k + 3, k2 + i1 + 3, l1, l1);
                                this.fontRendererObj.drawString(toRender.getDisplayName(), j2, k2, WHITE);
                                GL11.glPopMatrix();
                            }
                            str = "" + e.getValue();
                            boolean valid = amount >= e.getValue();
                            if (!valid && validInputMaterials) {
                                validInputMaterials = false;
                            }
                            int color = valid | this.mc.thePlayer.capabilities.isCreativeMode ? GREEN : RED;
                            this.fontRendererObj.drawString(str, xPos + 8 - this.fontRendererObj.getStringWidth(str) / 2, TOP + 170 + canCreateOffset, color);
                        }
                        i++;
                    }
                    if (validInputMaterials || this.mc.thePlayer.capabilities.isCreativeMode) {
                        GL11.glColor4f(0.0F, 1.0F, 0.1F, 1);
                    } else {
                        GL11.glColor4f(1.0F, 0.0F, 0.0F, 1);
                    }
                    this.mc.renderEngine.bindTexture(GuiCelestialSelection.guiMain1);
                    if (!this.mapMode) {
                        if (mousePosX >= RHS - 95 && mousePosX <= RHS && mousePosY >= TOP + 182 + canCreateOffset && mousePosY <= TOP + 182 + 12 + canCreateOffset) {
                            this.drawTexturedModalRect(RHS - 95, TOP + 182 + canCreateOffset, 93, 12, 0, 174, 93, 12, false, false);
                        }
                    }
                    this.drawTexturedModalRect(RHS - 95, TOP + 182 + canCreateOffset, 93, 12, 0, 174, 93, 12, false, false);
                    int color = (int) ((Math.sin(this.ticksSinceMenuOpen / 5.0) * 0.5 + 0.5) * 255);
                    this.drawSplitString(GCCoreUtil.translate("gui.message.can_create_space_station.name"), RHS - 48, TOP + 137, 91, ColorUtil.to32BitColor(255, color, 255, color), true, false);
                    if (!mapMode) {
                        this.drawSplitString(GCCoreUtil.translate("gui.message.create_ss.name").toUpperCase(), RHS - 48, TOP + 185 + canCreateOffset, 91, WHITE, false, false);
                    }
                } else {
                    this.drawSplitString(GCCoreUtil.translate("gui.message.cannot_create_space_station.name"), RHS - 48, TOP + 138, 91, WHITE, true, false);
                }
            }
            // Catalog overlay
            this.mc.renderEngine.bindTexture(GuiCelestialSelection.guiMain0);
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.3F - Math.min(0.3F, this.ticksSinceSelection / 50.0F));
            this.drawTexturedModalRect(LHS, TOP, 74, 11, 0, 392, 148, 22, false, false);
            str = GCCoreUtil.translate("gui.message.catalog.name").toUpperCase();
            this.fontRendererObj.drawString(str, LHS + 40 - fontRendererObj.getStringWidth(str) / 2, TOP + 1, WHITE);
            // Top bar title:
            this.mc.renderEngine.bindTexture(GuiCelestialSelection.guiMain0);
            GL11.glColor4f(0.0F, 0.6F, 1.0F, 1);
            if (this.selectedBody instanceof Satellite) {
                if (this.selectedStationOwner.length() == 0 || !this.selectedStationOwner.equalsIgnoreCase(PlayerUtil.getName(this.mc.thePlayer))) {
                    GL11.glColor4f(1.0F, 0.0F, 0.0F, 1);
                } else {
                    GL11.glColor4f(0.0F, 1.0F, 0.0F, 1);
                }
                this.drawTexturedModalRect(width / 2 - 47, TOP, 94, 11, 0, 414, 188, 22, false, false);
            } else {
                this.drawTexturedModalRect(width / 2 - 47, TOP, 94, 11, 0, 414, 188, 22, false, false);
            }
            if (this.selectedBody.getTierRequirement() >= 0 && (!(this.selectedBody instanceof Satellite))) {
                boolean canReach;
                if (!this.selectedBody.getReachable() || (this.possibleBodies != null && !this.possibleBodies.contains(this.selectedBody))) {
                    canReach = false;
                    GL11.glColor4f(1.0F, 0.0F, 0.0F, 1);
                } else {
                    canReach = true;
                    GL11.glColor4f(0.0F, 1.0F, 0.0F, 1);
                }
                this.drawTexturedModalRect(width / 2 - 30, TOP + 11, 30, 11, 0, 414, 60, 22, false, false);
                this.drawTexturedModalRect(width / 2, TOP + 11, 30, 11, 128, 414, 60, 22, false, false);
                str = GCCoreUtil.translateWithFormat("gui.message.tier.name", this.selectedBody.getTierRequirement() == 0 ? "?" : this.selectedBody.getTierRequirement());
                this.fontRendererObj.drawString(str, width / 2 - this.fontRendererObj.getStringWidth(str) / 2, TOP + 13, canReach ? GREY4 : RED3);
            }
            str = this.selectedBody.getLocalizedName();
            if (this.selectedBody instanceof Satellite) {
                str = GCCoreUtil.translate("gui.message.rename.name").toUpperCase();
            }
            this.fontRendererObj.drawString(str, width / 2 - this.fontRendererObj.getStringWidth(str) / 2, TOP + 2, WHITE);
            // Catalog wedge:
            this.mc.renderEngine.bindTexture(GuiCelestialSelection.guiMain0);
            GL11.glColor4f(0.0F, 0.6F, 1.0F, 1);
            this.drawTexturedModalRect(LHS + 4, TOP, 83, 12, 0, 477, 83, 12, false, false);
            if (!this.mapMode) {
                if (!this.selectedBody.getReachable() || (this.possibleBodies != null && !this.possibleBodies.contains(this.selectedBody)) || (this.selectedBody instanceof Satellite && this.selectedStationOwner.equals(""))) {
                    GL11.glColor4f(1.0F, 0.0F, 0.0F, 1);
                } else {
                    GL11.glColor4f(0.0F, 1.0F, 0.0F, 1);
                }
                this.mc.renderEngine.bindTexture(GuiCelestialSelection.guiMain0);
                this.drawTexturedModalRect(RHS - 74, TOP, 74, 11, 0, 392, 148, 22, true, false);
                str = GCCoreUtil.translate("gui.message.launch.name").toUpperCase();
                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                this.fontRendererObj.drawString(str, RHS - 40 - fontRendererObj.getStringWidth(str) / 2, TOP + 2, WHITE);
            }
            if (this.selectionState == EnumSelection.SELECTED && !(this.selectedBody instanceof Satellite)) {
                handledSliderPos = true;
                int sliderPos = this.zoomTooltipPos;
                if (zoomTooltipPos != 38) {
                    sliderPos = Math.min(this.ticksSinceSelection * 2, 38);
                    this.zoomTooltipPos = sliderPos;
                }
                GL11.glColor4f(0.0F, 0.6F, 1.0F, 1);
                this.mc.renderEngine.bindTexture(GuiCelestialSelection.guiMain0);
                this.drawTexturedModalRect(RHS - 182, height - GuiCelestialSelection.BORDER_SIZE - GuiCelestialSelection.BORDER_EDGE_SIZE - sliderPos, 83, 38, 512 - 166, 512 - 76, 166, 76, true, false);
                boolean flag0 = GalaxyRegistry.getSatellitesForCelestialBody(this.selectedBody).size() > 0;
                boolean flag1 = this.selectedBody instanceof Planet && GalaxyRegistry.getMoonsForPlanet((Planet) this.selectedBody).size() > 0;
                if (flag0 && flag1) {
                    this.drawSplitString(GCCoreUtil.translate("gui.message.click_again.0.name"), RHS - 182 + 41, height - GuiCelestialSelection.BORDER_SIZE - GuiCelestialSelection.BORDER_EDGE_SIZE + 2 - sliderPos, 79, GREY5, false, false);
                } else if (!flag0 && flag1) {
                    this.drawSplitString(GCCoreUtil.translate("gui.message.click_again.1.name"), RHS - 182 + 41, height - GuiCelestialSelection.BORDER_SIZE - GuiCelestialSelection.BORDER_EDGE_SIZE + 6 - sliderPos, 79, GREY5, false, false);
                } else if (flag0) {
                    this.drawSplitString(GCCoreUtil.translate("gui.message.click_again.2.name"), RHS - 182 + 41, height - GuiCelestialSelection.BORDER_SIZE - GuiCelestialSelection.BORDER_EDGE_SIZE + 6 - sliderPos, 79, GREY5, false, false);
                } else {
                    this.drawSplitString(GCCoreUtil.translate("gui.message.click_again.3.name"), RHS - 182 + 41, height - GuiCelestialSelection.BORDER_SIZE - GuiCelestialSelection.BORDER_EDGE_SIZE + 11 - sliderPos, 79, GREY5, false, false);
                }
            }
            if (this.selectedBody instanceof Satellite && renamingSpaceStation) {
                this.drawDefaultBackground();
                GL11.glColor4f(0.0F, 0.6F, 1.0F, 1);
                this.mc.renderEngine.bindTexture(GuiCelestialSelection.guiMain1);
                this.drawTexturedModalRect(width / 2 - 90, this.height / 2 - 38, 179, 67, 159, 0, 179, 67, false, false);
                this.drawTexturedModalRect(width / 2 - 90 + 4, this.height / 2 - 38 + 2, 171, 10, 159, 92, 171, 10, false, false);
                this.drawTexturedModalRect(width / 2 - 90 + 8, this.height / 2 - 38 + 18, 161, 13, 159, 67, 161, 13, false, false);
                this.drawTexturedModalRect(width / 2 - 90 + 17, this.height / 2 - 38 + 59, 72, 12, 159, 80, 72, 12, true, false);
                this.drawTexturedModalRect(width / 2, this.height / 2 - 38 + 59, 72, 12, 159, 80, 72, 12, false, false);
                str = GCCoreUtil.translate("gui.message.assign_name.name");
                this.fontRendererObj.drawString(str, width / 2 - this.fontRendererObj.getStringWidth(str) / 2, this.height / 2 - 35, WHITE);
                str = GCCoreUtil.translate("gui.message.apply.name");
                this.fontRendererObj.drawString(str, width / 2 - this.fontRendererObj.getStringWidth(str) / 2 - 36, this.height / 2 + 23, WHITE);
                str = GCCoreUtil.translate("gui.message.cancel.name");
                this.fontRendererObj.drawString(str, width / 2 + 36 - this.fontRendererObj.getStringWidth(str) / 2, this.height / 2 + 23, WHITE);
                if (this.renamingString == null) {
                    Satellite selectedSatellite = (Satellite) this.selectedBody;
                    String playerName = PlayerUtil.getName(this.mc.thePlayer);
                    this.renamingString = this.spaceStationMap.get(getSatelliteParentID(selectedSatellite)).get(playerName).getStationName();
                    if (this.renamingString == null) {
                        this.renamingString = this.spaceStationMap.get(getSatelliteParentID(selectedSatellite)).get(playerName.toLowerCase()).getStationName();
                    }
                    if (this.renamingString == null) {
                        this.renamingString = "";
                    }
                }
                str = this.renamingString;
                String str0 = this.renamingString;
                if ((this.ticksSinceMenuOpen / 10) % 2 == 0) {
                    str0 += "_";
                }
                this.fontRendererObj.drawString(str0, width / 2 - this.fontRendererObj.getStringWidth(str) / 2, this.height / 2 - 17, WHITE);
            }
        // this.mc.renderEngine.bindTexture(GuiCelestialSelection.guiMain0);
        // GL11.glColor4f(0.0F, 0.6F, 1.0F, 1);
        }
    }
    if (!handledSliderPos) {
        this.zoomTooltipPos = 0;
    }
}
Also used : SpaceStationRecipe(micdoodle8.mods.galacticraft.api.recipe.SpaceStationRecipe) ItemStack(net.minecraft.item.ItemStack)

Aggregations

CelestialBody (micdoodle8.mods.galacticraft.api.galaxies.CelestialBody)5 Vector3f (org.lwjgl.util.vector.Vector3f)5 CelestialBodyRenderEvent (micdoodle8.mods.galacticraft.api.event.client.CelestialBodyRenderEvent)3 Vector3 (micdoodle8.mods.galacticraft.api.vector.Vector3)3 SpaceStationWorldData (micdoodle8.mods.galacticraft.core.dimension.SpaceStationWorldData)3 ItemStack (net.minecraft.item.ItemStack)3 GameProfile (com.mojang.authlib.GameProfile)2 Property (com.mojang.authlib.properties.Property)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 SolarSystem (micdoodle8.mods.galacticraft.api.galaxies.SolarSystem)2 ISchematicPage (micdoodle8.mods.galacticraft.api.recipe.ISchematicPage)2 SpaceStationRecipe (micdoodle8.mods.galacticraft.api.recipe.SpaceStationRecipe)2 ITileClientUpdates (micdoodle8.mods.galacticraft.api.tile.ITileClientUpdates)2 IGalacticraftWorldProvider (micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider)2 SpaceRace (micdoodle8.mods.galacticraft.core.dimension.SpaceRace)2 EntityBuggy (micdoodle8.mods.galacticraft.core.entities.EntityBuggy)2 IControllableEntity (micdoodle8.mods.galacticraft.core.entities.IControllableEntity)2 FlagData (micdoodle8.mods.galacticraft.core.wrappers.FlagData)2 Footprint (micdoodle8.mods.galacticraft.core.wrappers.Footprint)2