Search in sources :

Example 1 with WorldProviderSpace

use of micdoodle8.mods.galacticraft.api.prefab.world.gen.WorldProviderSpace in project MorePlanets by SteveKunG.

the class GuiCelestialSelection method drawScreen.

@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
    List<String> infoList = new LinkedList<>();
    if (this.selectionList != null) {
        this.selectionList.drawScreen(mouseX, mouseY, partialTicks);
        this.drawCenteredString(this.fontRenderer, "Select Celestial", this.width / 2, 12, 16777215);
        this.drawCenteredString(this.fontRenderer, LangUtils.translate("fml.menu.mods.search"), this.width / 2 - 173, this.height - 21, 16777215);
        for (int i = 0; i < this.selectionList.getSize(); ++i) {
            if (this.selectionList.isSelected(i)) {
                CelestialBody celestial = this.selectionList.getSelectedCelestial().getCelestialBody();
                infoList.add(ColorUtils.stringToRGB("149, 200, 237").toColoredFont() + "Basic Information:");
                try {
                    if (celestial.getDimensionID() != -1) {
                        WorldProvider provider = WorldUtil.getProviderForDimensionClient(celestial.getDimensionID());
                        if (provider instanceof WorldProviderSpace) {
                            WorldProviderSpace space = (WorldProviderSpace) provider;
                            String thermal = "";
                            try {
                                thermal = String.valueOf(String.format("%.2f", 1.8F * space.getThermalLevelModifier() * 32)) + "\u2103";
                            } catch (Exception e) {
                                thermal = TextFormatting.RED + "Unknown";
                            }
                            if (space.getDayLength() <= 0) {
                                infoList.add(this.format(ColorUtils.stringToRGB("135, 242, 230").toColoredFont() + "Day-night Cycle:", "No day-night cycle"));
                            } else {
                                double dayDouble = space.getDayLength() / 24000;
                                if (dayDouble % 1 == 0) {
                                    int dayInt = (int) (space.getDayLength() / 24000);
                                    infoList.add(this.format(ColorUtils.stringToRGB("135, 242, 230").toColoredFont() + "Day-night Cycle:", dayInt + (dayInt == 1 ? " Day" : " Days") + " / " + dayInt * 24 + " hours"));
                                } else {
                                    infoList.add(this.format(ColorUtils.stringToRGB("135, 242, 230").toColoredFont() + "Day-night Cycle:", dayDouble + (dayDouble <= 1 ? " Day" : " Days") + " / " + dayDouble * 24 + " hours"));
                                }
                            }
                            infoList.add(this.format(ColorUtils.stringToRGB("135, 242, 230").toColoredFont() + "Gravity:", String.valueOf(space.getGravity()) + "g"));
                            infoList.add(this.format(ColorUtils.stringToRGB("135, 242, 230").toColoredFont() + "Wind:", String.valueOf(String.format("%.1f", space.getWindLevel() * 100.0F)) + "%"));
                            infoList.add(this.format(ColorUtils.stringToRGB("135, 242, 230").toColoredFont() + "Thermal:", thermal));
                            infoList.add(this.format(ColorUtils.stringToRGB("135, 242, 230").toColoredFont() + "Breathable Atmosphere:", space.hasBreathableAtmosphere()));
                            infoList.add(this.format(ColorUtils.stringToRGB("135, 242, 230").toColoredFont() + "Corrode Armor:", space.shouldCorrodeArmor()));
                            infoList.add(this.format(ColorUtils.stringToRGB("135, 242, 230").toColoredFont() + "Sound Reduction:", String.valueOf(space.getSoundVolReductionAmount() / 1.0F) + "%"));
                        }
                        if (provider instanceof ISolarLevel) {
                            ISolarLevel solar = (ISolarLevel) provider;
                            infoList.add(this.format(ColorUtils.stringToRGB("135, 242, 230").toColoredFont() + "Solar Level:", String.valueOf(String.format("%.1f", solar.getSolarEnergyMultiplier() * 100.0D)) + "%"));
                        }
                        if (provider instanceof IDarkEnergyProvider) {
                            IDarkEnergyProvider space = (IDarkEnergyProvider) provider;
                            String darkEnergy = "";
                            try {
                                darkEnergy = String.valueOf(space.getDarkEnergyMultiplier(null, null)) + "%";
                            } catch (Exception e) {
                                darkEnergy = TextFormatting.RED + "Unstable Dark Energy";
                            }
                            infoList.add(this.format(ColorUtils.stringToRGB("135, 242, 230").toColoredFont() + "Dark Energy Level:", darkEnergy));
                        }
                        if (celestial instanceof Planet) {
                            Planet planet = (Planet) celestial;
                            if (!planet.atmosphere.composition.isEmpty()) {
                                infoList.add(this.format(ColorUtils.stringToRGB("135, 242, 230").toColoredFont() + "Gas:", String.valueOf(planet.atmosphere.composition)));
                            }
                            infoList.add(this.format(ColorUtils.stringToRGB("135, 242, 230").toColoredFont() + "Solar System:", planet.getParentSolarSystem().getLocalizedName()));
                            infoList.add(this.format(ColorUtils.stringToRGB("135, 242, 230").toColoredFont() + "Galaxy:", planet.getParentSolarSystem().getLocalizedParentGalaxyName()));
                            if (!GalaxyRegistry.getMoonsForPlanet(planet).isEmpty()) {
                                infoList.add(this.format(ColorUtils.stringToRGB("135, 242, 230").toColoredFont() + "Number of Moons:", String.valueOf(GalaxyRegistry.getMoonsForPlanet(planet).size())));
                            }
                        } else if (celestial instanceof Moon) {
                            Moon moon = (Moon) celestial;
                            if (!moon.atmosphere.composition.isEmpty()) {
                                infoList.add(this.format(ColorUtils.stringToRGB("135, 242, 230").toColoredFont() + "Gas:", String.valueOf(moon.atmosphere.composition)));
                            }
                            infoList.add(this.format(ColorUtils.stringToRGB("135, 242, 230").toColoredFont() + "Solar System:", moon.getParentPlanet().getParentSolarSystem().getLocalizedName()));
                            infoList.add(this.format(ColorUtils.stringToRGB("135, 242, 230").toColoredFont() + "Galaxy:", moon.getParentPlanet().getParentSolarSystem().getLocalizedParentGalaxyName()));
                            infoList.add(this.format(ColorUtils.stringToRGB("135, 242, 230").toColoredFont() + "Parent Planet:", moon.getParentPlanet().getLocalizedName()));
                        }
                    } else {
                        infoList.add(TextFormatting.RED + "No Basic Celestial Info");
                    }
                } catch (Exception e) {
                }
                for (int textSize = 0; textSize < infoList.size(); textSize++) {
                    String text = infoList.get(textSize);
                    int fontHeight = this.fontRenderer.FONT_HEIGHT + 2;
                    int y = 54 + fontHeight * textSize;
                    this.fontRenderer.drawString(text, this.width / 2 - 24, y, 16777215);
                }
            }
        }
    }
    this.searchField.drawTextBox();
    super.drawScreen(mouseX, mouseY, partialTicks);
}
Also used : Moon(micdoodle8.mods.galacticraft.api.galaxies.Moon) LinkedList(java.util.LinkedList) IOException(java.io.IOException) CelestialBody(micdoodle8.mods.galacticraft.api.galaxies.CelestialBody) WorldProvider(net.minecraft.world.WorldProvider) ISolarLevel(micdoodle8.mods.galacticraft.api.world.ISolarLevel) IDarkEnergyProvider(stevekung.mods.moreplanets.utils.dimension.IDarkEnergyProvider) Planet(micdoodle8.mods.galacticraft.api.galaxies.Planet) WorldProviderSpace(micdoodle8.mods.galacticraft.api.prefab.world.gen.WorldProviderSpace)

Example 2 with WorldProviderSpace

use of micdoodle8.mods.galacticraft.api.prefab.world.gen.WorldProviderSpace in project Galacticraft by micdoodle8.

the class TileEntityGasLiquefier method getAirProducts.

public int getAirProducts() {
    WorldProvider WP = this.world.provider;
    if (WP instanceof WorldProviderSpace) {
        int result = 0;
        ArrayList<EnumAtmosphericGas> atmos = ((WorldProviderSpace) WP).getCelestialBody().atmosphere.composition;
        if (atmos.size() > 0) {
            result = this.getIdFromName(atmos.get(0).name().toLowerCase()) + 1;
        }
        if (atmos.size() > 1) {
            result += 16 * (this.getIdFromName(atmos.get(1).name().toLowerCase()) + 1);
        }
        if (atmos.size() > 2) {
            result += 256 * (this.getIdFromName(atmos.get(2).name().toLowerCase()) + 1);
        }
        return result;
    }
    return 35;
}
Also used : EnumAtmosphericGas(micdoodle8.mods.galacticraft.api.world.EnumAtmosphericGas) WorldProvider(net.minecraft.world.WorldProvider) WorldProviderSpace(micdoodle8.mods.galacticraft.api.prefab.world.gen.WorldProviderSpace)

Aggregations

WorldProviderSpace (micdoodle8.mods.galacticraft.api.prefab.world.gen.WorldProviderSpace)2 WorldProvider (net.minecraft.world.WorldProvider)2 IOException (java.io.IOException)1 LinkedList (java.util.LinkedList)1 CelestialBody (micdoodle8.mods.galacticraft.api.galaxies.CelestialBody)1 Moon (micdoodle8.mods.galacticraft.api.galaxies.Moon)1 Planet (micdoodle8.mods.galacticraft.api.galaxies.Planet)1 EnumAtmosphericGas (micdoodle8.mods.galacticraft.api.world.EnumAtmosphericGas)1 ISolarLevel (micdoodle8.mods.galacticraft.api.world.ISolarLevel)1 IDarkEnergyProvider (stevekung.mods.moreplanets.utils.dimension.IDarkEnergyProvider)1