Search in sources :

Example 6 with Moon

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

the class GuiCelestialSelection method drawCircles.

public void drawCircles() {
    GL11.glColor4f(1, 1, 1, 1);
    GL11.glLineWidth(3);
    int count = 0;
    final float theta = (float) (2 * Math.PI / 90);
    final float cos = (float) Math.cos(theta);
    final float sin = (float) Math.sin(theta);
    for (Planet planet : GalaxyRegistry.getRegisteredPlanets().values()) {
        if (planet.getParentSolarSystem() != null) {
            Vector3f systemOffset = this.getCelestialBodyPosition(planet.getParentSolarSystem().getMainStar());
            float x = this.getScale(planet);
            float y = 0;
            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) && !(this.selectedBody instanceof Satellite)) {
                    alpha = 1.0F - Math.min(this.ticksSinceSelection / 25.0F, 1.0F);
                } else {
                    alpha = 0.0F;
                }
            }
            if (alpha != 0) {
                switch(count % 2) {
                    case 0:
                        GL11.glColor4f(0.0F / 1.4F, 0.6F / 1.4F, 1.0F / 1.4F, alpha / 1.4F);
                        break;
                    case 1:
                        GL11.glColor4f(0.3F / 1.4F, 0.8F / 1.4F, 1.0F / 1.4F, alpha / 1.4F);
                        break;
                }
                CelestialBodyRenderEvent.CelestialRingRenderEvent.Pre preEvent = new CelestialBodyRenderEvent.CelestialRingRenderEvent.Pre(planet, systemOffset);
                MinecraftForge.EVENT_BUS.post(preEvent);
                if (!preEvent.isCanceled()) {
                    GL11.glTranslatef(systemOffset.x, systemOffset.y, systemOffset.z);
                    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();
                    GL11.glTranslatef(-systemOffset.x, -systemOffset.y, -systemOffset.z);
                    count++;
                }
                CelestialBodyRenderEvent.CelestialRingRenderEvent.Post postEvent = new CelestialBodyRenderEvent.CelestialRingRenderEvent.Post(planet);
                MinecraftForge.EVENT_BUS.post(postEvent);
            }
        }
    }
    count = 0;
    if (this.selectedBody != null) {
        Vector3f planetPos = this.getCelestialBodyPosition(this.selectedBody);
        if (this.selectedBody instanceof IChildBody) {
            planetPos = this.getCelestialBodyPosition(((IChildBody) this.selectedBody).getParentPlanet());
        } else if (this.selectedBody instanceof Satellite) {
            planetPos = this.getCelestialBodyPosition(((Satellite) this.selectedBody).getParentPlanet());
        }
        GL11.glTranslatef(planetPos.x, planetPos.y, 0);
        for (Moon moon : GalaxyRegistry.getRegisteredMoons().values()) {
            if ((moon.getParentPlanet() == this.selectedBody && this.selectionState != EnumSelection.SELECTED) || moon == this.selectedBody || getSiblings(this.selectedBody).contains(moon)) {
                if (this.drawCircle(moon, count, sin, cos)) {
                    count++;
                }
            }
        }
        for (Satellite satellite : GalaxyRegistry.getRegisteredSatellites().values()) {
            if (this.possibleBodies != null && this.possibleBodies.contains(satellite)) {
                if ((satellite.getParentPlanet() == this.selectedBody && this.selectionState != EnumSelection.SELECTED) && this.ticksSinceSelection > 24 || satellite == this.selectedBody || this.lastSelectedBody instanceof IChildBody) {
                    if (this.drawCircle(satellite, count, sin, cos)) {
                        count++;
                    }
                }
            }
        }
    }
    GL11.glLineWidth(1);
}
Also used : CelestialBodyRenderEvent(micdoodle8.mods.galacticraft.api.event.client.CelestialBodyRenderEvent) Vector3f(org.lwjgl.util.vector.Vector3f)

Example 7 with Moon

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

the class PlayerClient method updateFeet.

private void updateFeet(EntityPlayerSP player, double motionX, double motionZ) {
    GCPlayerStatsClient stats = GCPlayerStatsClient.get(player);
    double motionSqrd = motionX * motionX + motionZ * motionZ;
    // If the player is on the moon, not airbourne and not riding anything
    if (motionSqrd > 0.001 && player.worldObj != null && player.worldObj.provider instanceof WorldProviderMoon && player.ridingEntity == null && !player.capabilities.isFlying) {
        int iPosX = MathHelper.floor_double(player.posX);
        int iPosY = MathHelper.floor_double(player.posY - 0.05);
        int iPosZ = MathHelper.floor_double(player.posZ);
        BlockPos pos1 = new BlockPos(iPosX, iPosY, iPosZ);
        IBlockState state = player.worldObj.getBlockState(pos1);
        // If the block below is the moon block
        if (state.getBlock() == GCBlocks.blockMoon) {
            // And is the correct metadata (moon turf)
            if (state.getValue(BlockBasicMoon.BASIC_TYPE_MOON) == BlockBasicMoon.EnumBlockBasicMoon.MOON_TURF) {
                // If it has been long enough since the last step
                if (stats.getDistanceSinceLastStep() > 0.35) {
                    Vector3 pos = new Vector3(player);
                    // Set the footprint position to the block below and add random number to stop z-fighting
                    pos.y = MathHelper.floor_double(player.posY) + player.getRNG().nextFloat() / 100.0F;
                    // Adjust footprint to left or right depending on step count
                    switch(stats.getLastStep()) {
                        case 0:
                            pos.translate(new Vector3(Math.sin(Math.toRadians(-player.rotationYaw + 90)) * 0.25, 0, Math.cos(Math.toRadians(-player.rotationYaw + 90)) * 0.25));
                            break;
                        case 1:
                            pos.translate(new Vector3(Math.sin(Math.toRadians(-player.rotationYaw - 90)) * 0.25, 0, Math.cos(Math.toRadians(-player.rotationYaw - 90)) * 0.25));
                            break;
                    }
                    pos = WorldUtil.getFootprintPosition(player.worldObj, player.rotationYaw - 180, pos, new BlockVec3(player));
                    long chunkKey = ChunkCoordIntPair.chunkXZ2Int(pos.intX() >> 4, pos.intZ() >> 4);
                    FootprintRenderer.addFootprint(chunkKey, GCCoreUtil.getDimensionID(player.worldObj), pos, player.rotationYaw, player.getName());
                    // Increment and cap step counter at 1
                    stats.setLastStep((stats.getLastStep() + 1) % 2);
                    stats.setDistanceSinceLastStep(0);
                } else {
                    stats.setDistanceSinceLastStep(stats.getDistanceSinceLastStep() + motionSqrd);
                }
            }
        }
    }
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) WorldProviderMoon(micdoodle8.mods.galacticraft.core.dimension.WorldProviderMoon) Vector3(micdoodle8.mods.galacticraft.api.vector.Vector3) BlockVec3(micdoodle8.mods.galacticraft.api.vector.BlockVec3)

Example 8 with Moon

use of micdoodle8.mods.galacticraft.api.galaxies.Moon 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 9 with Moon

use of micdoodle8.mods.galacticraft.api.galaxies.Moon in project MorePlanets by SteveKunG.

the class CelestialRegistryUtils method createMoon.

public static Moon createMoon(String name, Planet planet, float phaseShift, float distance, float orbitTime, float size, int tier, int id, Class<? extends WorldProvider> provider) {
    Moon moon = new Moon(name).setParentPlanet(planet);
    moon.setDimensionInfo(id, provider);
    moon.setPhaseShift(phaseShift);
    moon.setRelativeDistanceFromCenter(new ScalableDistance(distance, distance));
    moon.setRelativeOrbitTime(orbitTime);
    moon.setRelativeSize(size);
    moon.setTierRequired(tier);
    moon.setBodyIcon(new ResourceLocation("moreplanets:textures/gui/celestialbodies/" + name + ".png"));
    return moon;
}
Also used : ScalableDistance(micdoodle8.mods.galacticraft.api.galaxies.CelestialBody.ScalableDistance) ResourceLocation(net.minecraft.util.ResourceLocation)

Example 10 with Moon

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

the class SkyProviderOverworld method render.

@Override
public void render(float partialTicks, WorldClient world, Minecraft mc) {
    if (!ClientProxyCore.overworldTextureRequestSent) {
        GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(PacketSimple.EnumSimplePacket.S_REQUEST_OVERWORLD_IMAGE, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] {}));
        ClientProxyCore.overworldTextureRequestSent = true;
    }
    double zoom = 0.0;
    double yaw = 0.0;
    double pitch = 0.0;
    Method m = null;
    if (!optifinePresent) {
        try {
            Class<?> c = mc.entityRenderer.getClass();
            zoom = mc.entityRenderer.cameraZoom;
            yaw = mc.entityRenderer.cameraYaw;
            pitch = mc.entityRenderer.cameraPitch;
            GL11.glMatrixMode(GL11.GL_PROJECTION);
            GL11.glLoadIdentity();
            if (zoom != 1.0D) {
                GL11.glTranslatef((float) yaw, (float) (-pitch), 0.0F);
                GL11.glScaled(zoom, zoom, 1.0D);
            }
            Project.gluPerspective(mc.gameSettings.fovSetting, (float) mc.displayWidth / (float) mc.displayHeight, 0.05F, 1400.0F);
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glLoadIdentity();
            mc.entityRenderer.orientCamera(partialTicks);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    float theta = MathHelper.sqrt_float(((float) (mc.thePlayer.posY) - Constants.OVERWORLD_SKYPROVIDER_STARTHEIGHT) / 1000.0F);
    final float var21 = Math.max(1.0F - theta * 4.0F, 0.0F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    final Vec3 var2 = this.minecraft.theWorld.getSkyColor(this.minecraft.getRenderViewEntity(), partialTicks);
    float i = (float) var2.xCoord * var21;
    float x = (float) var2.yCoord * var21;
    float var5 = (float) var2.zCoord * var21;
    float z;
    if (this.minecraft.gameSettings.anaglyph) {
        final float y = (i * 30.0F + x * 59.0F + var5 * 11.0F) / 100.0F;
        final float var7 = (i * 30.0F + x * 70.0F) / 100.0F;
        z = (i * 30.0F + var5 * 70.0F) / 100.0F;
        i = y;
        x = var7;
        var5 = z;
    }
    GL11.glColor3f(i, x, var5);
    final Tessellator var23 = Tessellator.getInstance();
    WorldRenderer worldRenderer = var23.getWorldRenderer();
    GL11.glDepthMask(false);
    GL11.glEnable(GL11.GL_FOG);
    GL11.glColor3f(i, x, var5);
    if (mc.thePlayer.posY < 214) {
        GL11.glCallList(this.glSkyList);
    }
    GL11.glDisable(GL11.GL_FOG);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    RenderHelper.disableStandardItemLighting();
    final float[] costh = this.minecraft.theWorld.provider.calcSunriseSunsetColors(this.minecraft.theWorld.getCelestialAngle(partialTicks), partialTicks);
    float var9;
    float size;
    float rand1;
    float r;
    if (costh != null) {
        final float sunsetModInv = Math.min(1.0F, Math.max(1.0F - theta * 50.0F, 0.0F));
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glShadeModel(GL11.GL_SMOOTH);
        GL11.glPushMatrix();
        GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(MathHelper.sin(this.minecraft.theWorld.getCelestialAngleRadians(partialTicks)) < 0.0F ? 180.0F : 0.0F, 0.0F, 0.0F, 1.0F);
        GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
        z = costh[0] * sunsetModInv;
        var9 = costh[1] * sunsetModInv;
        size = costh[2] * sunsetModInv;
        float rand3;
        if (this.minecraft.gameSettings.anaglyph) {
            rand1 = (z * 30.0F + var9 * 59.0F + size * 11.0F) / 100.0F;
            r = (z * 30.0F + var9 * 70.0F) / 100.0F;
            rand3 = (z * 30.0F + size * 70.0F) / 100.0F;
            z = rand1;
            var9 = r;
            size = rand3;
        }
        worldRenderer.begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION_COLOR);
        worldRenderer.pos(0.0D, 100.0D, 0.0D).color(z * sunsetModInv, var9 * sunsetModInv, size * sunsetModInv, costh[3]).endVertex();
        final byte phi = 16;
        for (int var27 = 0; var27 <= phi; ++var27) {
            rand3 = var27 * Constants.twoPI / phi;
            final float xx = MathHelper.sin(rand3);
            final float rand5 = MathHelper.cos(rand3);
            worldRenderer.pos(xx * 120.0F, rand5 * 120.0F, -rand5 * 40.0F * costh[3]).color(costh[0] * sunsetModInv, costh[1] * sunsetModInv, costh[2] * sunsetModInv, 0.0F).endVertex();
        }
        var23.draw();
        GL11.glPopMatrix();
        GL11.glShadeModel(GL11.GL_FLAT);
    }
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
    GL11.glPushMatrix();
    z = 1.0F - this.minecraft.theWorld.getRainStrength(partialTicks);
    var9 = 0.0F;
    size = 0.0F;
    rand1 = 0.0F;
    GL11.glColor4f(1.0F, 1.0F, 1.0F, z);
    GL11.glTranslatef(var9, size, rand1);
    GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(this.minecraft.theWorld.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F);
    double playerHeight = this.minecraft.thePlayer.posY;
    // Draw stars
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    float threshold;
    Vec3 vec = TransformerHooks.getFogColorHook(this.minecraft.theWorld);
    threshold = Math.max(0.1F, (float) vec.lengthVector() - 0.1F);
    float var20 = ((float) playerHeight - Constants.OVERWORLD_SKYPROVIDER_STARTHEIGHT) / 1000.0F;
    var20 = MathHelper.sqrt_float(var20);
    float bright1 = Math.min(0.9F, var20 * 3);
    // float bright5 = Math.min(0.7F, var20 * 0.75F);
    if (bright1 > threshold) {
        GL11.glColor4f(bright1, bright1, bright1, 1.0F);
        GL11.glCallList(this.starGLCallList);
    }
    // if (bright2 > threshold)
    // {
    // GL11.glColor4f(bright2, bright2, bright2, 1.0F);
    // GL11.glCallList(this.starGLCallList + 1);
    // }
    // if (bright3 > threshold)
    // {
    // GL11.glColor4f(bright3, bright3, bright3, 1.0F);
    GL11.glCallList(this.starGLCallList + 2);
    // }
    // if (bright4 > threshold)
    // {
    // GL11.glColor4f(bright4, bright4, bright4, 1.0F);
    GL11.glCallList(this.starGLCallList + 3);
    // }
    // if (bright5 > threshold)
    // {
    // GL11.glColor4f(bright5, bright5, bright5, 1.0F);
    GL11.glCallList(this.starGLCallList + 4);
    // }
    // Draw sun
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
    r = 30.0F;
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.minecraft.renderEngine.bindTexture(SkyProviderOverworld.sunTexture);
    worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    worldRenderer.pos(-r, 100.0D, -r).tex(0.0D, 0.0D).endVertex();
    worldRenderer.pos(r, 100.0D, -r).tex(1.0D, 0.0D).endVertex();
    worldRenderer.pos(r, 100.0D, r).tex(1.0D, 1.0D).endVertex();
    worldRenderer.pos(-r, 100.0D, r).tex(0.0D, 1.0D).endVertex();
    var23.draw();
    // Draw moon
    r = 40.0F;
    this.minecraft.renderEngine.bindTexture(SkyProviderOverworld.moonTexture);
    float sinphi = this.minecraft.theWorld.getMoonPhase();
    final int cosphi = (int) (sinphi % 4);
    final int var29 = (int) (sinphi / 4 % 2);
    final float yy = (cosphi) / 4.0F;
    final float rand7 = (var29) / 2.0F;
    final float zz = (cosphi + 1) / 4.0F;
    final float rand9 = (var29 + 1) / 2.0F;
    worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    worldRenderer.pos(-r, -100.0D, r).tex(zz, rand9).endVertex();
    worldRenderer.pos(r, -100.0D, r).tex(yy, rand9).endVertex();
    worldRenderer.pos(r, -100.0D, -r).tex(yy, rand7).endVertex();
    worldRenderer.pos(-r, -100.0D, -r).tex(zz, rand7).endVertex();
    var23.draw();
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_FOG);
    GL11.glPopMatrix();
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glColor3f(0.0F, 0.0F, 0.0F);
    // TODO get exact height figure here
    double var25 = playerHeight - 64;
    if (var25 > this.minecraft.gameSettings.renderDistanceChunks * 16) {
        theta *= 400.0F;
        final float sinth = Math.max(Math.min(theta / 100.0F - 0.2F, 0.5F), 0.0F);
        GL11.glPushMatrix();
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_FOG);
        float scale = 850 * (0.25F - theta / 10000.0F);
        scale = Math.max(scale, 0.2F);
        GL11.glScalef(scale, 1.0F, scale);
        GL11.glTranslatef(0.0F, -(float) mc.thePlayer.posY, 0.0F);
        double cornerB = 1.0D;
        // if (ClientProxyCore.overworldTextureLocal != null)
        // {
        // GL11.glBindTexture(GL11.GL_TEXTURE_2D, ClientProxyCore.overworldTextureLocal.getGlTextureId());
        // }
        // else
        {
            this.minecraft.renderEngine.bindTexture(this.planetToRender);
            // Overworld texture is 48x48 in a 64x64 .png file, and same for other celestial bodies
            cornerB = 0.75D;
        }
        size = 1.0F;
        GL11.glColor4f(sinth, sinth, sinth, 1.0F);
        worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
        // float zoomIn = (1F - (float) var25 / 768F) / 5.86F;
        // if (zoomIn < 0F) zoomIn = 0F;
        double zoomIn = 0.0D;
        cornerB -= zoomIn;
        worldRenderer.pos(-size, 0, size).tex(zoomIn, cornerB).endVertex();
        worldRenderer.pos(size, 0, size).tex(cornerB, cornerB).endVertex();
        worldRenderer.pos(size, 0, -size).tex(cornerB, zoomIn).endVertex();
        worldRenderer.pos(-size, 0, -size).tex(zoomIn, zoomIn).endVertex();
        var23.draw();
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glPopMatrix();
    }
    GL11.glColor3f(0.0f, 0.0f, 0.0f);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDepthMask(true);
    if (!optifinePresent) {
        try {
            GL11.glMatrixMode(GL11.GL_PROJECTION);
            GL11.glLoadIdentity();
            if (zoom != 1.0D) {
                GL11.glTranslatef((float) yaw, (float) (-pitch), 0.0F);
                GL11.glScaled(zoom, zoom, 1.0D);
            }
            Project.gluPerspective(mc.gameSettings.fovSetting, (float) mc.displayWidth / (float) mc.displayHeight, 0.05F, this.minecraft.gameSettings.renderDistanceChunks * 16 * 2.0F);
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glLoadIdentity();
            mc.entityRenderer.orientCamera(partialTicks);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_BLEND);
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) PacketSimple(micdoodle8.mods.galacticraft.core.network.PacketSimple) Method(java.lang.reflect.Method) WorldRenderer(net.minecraft.client.renderer.WorldRenderer) Vec3(net.minecraft.util.Vec3)

Aggregations

Vector3f (org.lwjgl.util.vector.Vector3f)5 Vector3 (micdoodle8.mods.galacticraft.api.vector.Vector3)4 CelestialBodyRenderEvent (micdoodle8.mods.galacticraft.api.event.client.CelestialBodyRenderEvent)3 ItemStack (net.minecraft.item.ItemStack)3 ResourceLocation (net.minecraft.util.ResourceLocation)3 ScalableDistance (micdoodle8.mods.galacticraft.api.galaxies.CelestialBody.ScalableDistance)2 SpaceStationRecipe (micdoodle8.mods.galacticraft.api.recipe.SpaceStationRecipe)2 BlockVec3 (micdoodle8.mods.galacticraft.api.vector.BlockVec3)2 IGalacticraftWorldProvider (micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider)2 WorldProviderMoon (micdoodle8.mods.galacticraft.core.dimension.WorldProviderMoon)2 PacketSimple (micdoodle8.mods.galacticraft.core.network.PacketSimple)2 IBlockState (net.minecraft.block.state.IBlockState)2 PotionEffect (net.minecraft.potion.PotionEffect)2 WorldProvider (net.minecraft.world.WorldProvider)2 PacketSimpleMP (stevekung.mods.moreplanets.network.PacketSimpleMP)2 IOException (java.io.IOException)1 Method (java.lang.reflect.Method)1 FloatBuffer (java.nio.FloatBuffer)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1