diff --git a/src/main/java/net/PeytonPlayz585/shadow/Config.java b/src/main/java/net/PeytonPlayz585/shadow/Config.java index c58610f..2d3700b 100644 --- a/src/main/java/net/PeytonPlayz585/shadow/Config.java +++ b/src/main/java/net/PeytonPlayz585/shadow/Config.java @@ -137,6 +137,14 @@ public class Config { public static int getUpdatesPerFrame() { return Minecraft.getMinecraft().gameSettings.ofChunkUpdates; } + + public static boolean isCloudsFancy() { + return Minecraft.getMinecraft().gameSettings.ofClouds != 0 ? Minecraft.getMinecraft().gameSettings.ofClouds == 2 : Minecraft.getMinecraft().gameSettings.fancyGraphics; + } + + public static boolean isCloudsOff() { + return Minecraft.getMinecraft().gameSettings.ofClouds != 0 ? Minecraft.getMinecraft().gameSettings.ofClouds == 3 : false; + } public static int limit(int p_limit_0_, int p_limit_1_, int p_limit_2_) { return p_limit_0_ < p_limit_1_ ? p_limit_1_ : (p_limit_0_ > p_limit_2_ ? p_limit_2_ : p_limit_0_); diff --git a/src/main/java/net/PeytonPlayz585/shadow/gui/GuiDetails.java b/src/main/java/net/PeytonPlayz585/shadow/gui/GuiDetails.java new file mode 100644 index 0000000..13fcb14 --- /dev/null +++ b/src/main/java/net/PeytonPlayz585/shadow/gui/GuiDetails.java @@ -0,0 +1,71 @@ +package net.PeytonPlayz585.shadow.gui; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiOptionButton; +import net.minecraft.client.gui.GuiOptionSlider; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.settings.GameSettings; + +public class GuiDetails extends GuiScreen { + private GuiScreen prevScreen; + protected String title; + private GameSettings settings; + //private static GameSettings.Options[] enumOptions = new GameSettings.Options[] {GameSettings.Options.CLOUDS, GameSettings.Options.CLOUD_HEIGHT, GameSettings.Options.TREES, GameSettings.Options.RAIN, GameSettings.Options.SKY, GameSettings.Options.STARS, GameSettings.Options.SUN_MOON, GameSettings.Options.SHOW_CAPES, GameSettings.Options.TRANSLUCENT_BLOCKS, GameSettings.Options.HELD_ITEM_TOOLTIPS, GameSettings.Options.DROPPED_ITEMS, GameSettings.Options.ENTITY_SHADOWS, GameSettings.Options.VIGNETTE, GameSettings.Options.DYNAMIC_FOV}; + private static GameSettings.Options[] enumOptions = new GameSettings.Options[] { GameSettings.Options.CLOUDS, GameSettings.Options.CLOUD_HEIGHT}; + + public GuiDetails(GuiScreen p_i47_1_) { + this.prevScreen = p_i47_1_; + this.settings = Minecraft.getMinecraft().gameSettings; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() { + this.title = I18n.format("Detail Settings", new Object[0]); + this.buttonList.clear(); + + for (int i = 0; i < enumOptions.length; ++i) { + GameSettings.Options gamesettings$options = enumOptions[i]; + int j = width / 2 - 155 + i % 2 * 160; + int k = height / 6 + 21 * (i / 2) - 12; + + if (!gamesettings$options.getEnumFloat()) { + this.buttonList.add(new GuiOptionButton(gamesettings$options.returnEnumOrdinal(), j, k, gamesettings$options, this.settings.getKeyBinding(gamesettings$options))); + } else { + this.buttonList.add(new GuiOptionSlider(gamesettings$options.returnEnumOrdinal(), j, k, gamesettings$options)); + } + } + + this.buttonList.add(new GuiButton(200, width / 2 - 100, height / 6 + 168 + 11, I18n.format("gui.done", new Object[0]))); + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) { + if (button.enabled) { + if (button.id < 200 && button instanceof GuiOptionButton) { + this.settings.setOptionValue(((GuiOptionButton)button).returnEnumOptions(), 1); + button.displayString = this.settings.getKeyBinding(GameSettings.Options.getEnumOptions(button.id)); + } + + if (button.id == 200) { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(this.prevScreen); + } + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRendererObj, this.title, width / 2, 15, 16777215); + super.drawScreen(mouseX, mouseY, partialTicks); + } +} \ No newline at end of file diff --git a/src/main/java/net/PeytonPlayz585/shadow/gui/GuiPerformance.java b/src/main/java/net/PeytonPlayz585/shadow/gui/GuiPerformance.java index 80ebec7..6de9f60 100644 --- a/src/main/java/net/PeytonPlayz585/shadow/gui/GuiPerformance.java +++ b/src/main/java/net/PeytonPlayz585/shadow/gui/GuiPerformance.java @@ -24,7 +24,7 @@ public class GuiPerformance extends GuiScreen { * window resizes, the buttonList is cleared beforehand. */ public void initGui() { - this.title = I18n.format("of.options.performanceTitle", new Object[0]); + this.title = I18n.format("Performance Settings", new Object[0]); this.buttonList.clear(); for (int i = 0; i < enumOptions.length; ++i) { diff --git a/src/main/java/net/PeytonPlayz585/shadow/other/CloudRenderer.java b/src/main/java/net/PeytonPlayz585/shadow/other/CloudRenderer.java new file mode 100644 index 0000000..ea6b0db --- /dev/null +++ b/src/main/java/net/PeytonPlayz585/shadow/other/CloudRenderer.java @@ -0,0 +1,89 @@ +package net.PeytonPlayz585.shadow.other; + +import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU; +import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager; +import net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GLAllocation; +import net.minecraft.entity.Entity; + +public class CloudRenderer { + private Minecraft mc; + private boolean updated = false; + private boolean renderFancy = false; + int cloudTickCounter; + float partialTicks; + private int glListClouds = -1; + private int cloudTickCounterUpdate = 0; + private double cloudPlayerX = 0.0D; + private double cloudPlayerY = 0.0D; + private double cloudPlayerZ = 0.0D; + + public CloudRenderer(Minecraft p_i28_1_) { + this.mc = p_i28_1_; + this.glListClouds = GLAllocation.generateDisplayLists(); + } + + public void prepareToRender(boolean p_prepareToRender_1_, int p_prepareToRender_2_, float p_prepareToRender_3_) { + if (this.renderFancy != p_prepareToRender_1_) { + this.updated = false; + } + + this.renderFancy = p_prepareToRender_1_; + this.cloudTickCounter = p_prepareToRender_2_; + this.partialTicks = p_prepareToRender_3_; + } + + public boolean shouldUpdateGlList() { + if (!this.updated) { + return true; + } else if (this.cloudTickCounter >= this.cloudTickCounterUpdate + 20) { + return true; + } else { + Entity entity = this.mc.getRenderViewEntity(); + boolean flag = this.cloudPlayerY + (double)entity.getEyeHeight() < 128.0D + (double)(this.mc.gameSettings.ofCloudsHeight * 128.0F); + boolean flag1 = entity.prevPosY + (double)entity.getEyeHeight() < 128.0D + (double)(this.mc.gameSettings.ofCloudsHeight * 128.0F); + return flag1 != flag; + } + } + + public void startUpdateGlList() { + EaglercraftGPU.glNewList(this.glListClouds, RealOpenGLEnums.GL_COMPILE); + } + + public void endUpdateGlList() { + EaglercraftGPU.glEndList(); + this.cloudTickCounterUpdate = this.cloudTickCounter; + this.cloudPlayerX = this.mc.getRenderViewEntity().prevPosX; + this.cloudPlayerY = this.mc.getRenderViewEntity().prevPosY; + this.cloudPlayerZ = this.mc.getRenderViewEntity().prevPosZ; + this.updated = true; + GlStateManager.resetColor(); + } + + public void renderGlList() { + Entity entity = this.mc.getRenderViewEntity(); + double d0 = entity.prevPosX + (entity.posX - entity.prevPosX) * (double)this.partialTicks; + double d1 = entity.prevPosY + (entity.posY - entity.prevPosY) * (double)this.partialTicks; + double d2 = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * (double)this.partialTicks; + double d3 = (double)((float)(this.cloudTickCounter - this.cloudTickCounterUpdate) + this.partialTicks); + float f = (float)(d0 - this.cloudPlayerX + d3 * 0.03D); + float f1 = (float)(d1 - this.cloudPlayerY); + float f2 = (float)(d2 - this.cloudPlayerZ); + GlStateManager.pushMatrix(); + + if (this.renderFancy) { + GlStateManager.translate(-f / 12.0F, -f1, -f2 / 12.0F); + } else { + GlStateManager.translate(-f, -f1, -f2); + } + + GlStateManager.callList(this.glListClouds); + GlStateManager.popMatrix(); + GlStateManager.resetColor(); + } + + public void reset() { + this.updated = false; + } +} \ No newline at end of file diff --git a/src/main/java/net/minecraft/client/gui/GuiVideoSettings.java b/src/main/java/net/minecraft/client/gui/GuiVideoSettings.java index f09a8a5..b192d5e 100644 --- a/src/main/java/net/minecraft/client/gui/GuiVideoSettings.java +++ b/src/main/java/net/minecraft/client/gui/GuiVideoSettings.java @@ -140,6 +140,10 @@ public class GuiVideoSettings extends GuiScreen { if(parGuiButton.id == 212) { this.mc.displayGuiScreen(new GuiPerformance(this)); } + + if(parGuiButton.id == 201) { + this.mc.displayGuiScreen(new GuiDetails(this)); + } if (this.guiGameSettings.guiScale != i) { ScaledResolution scaledresolution = new ScaledResolution(this.mc); diff --git a/src/main/java/net/minecraft/client/renderer/EntityRenderer.java b/src/main/java/net/minecraft/client/renderer/EntityRenderer.java index baf01f7..62ec655 100644 --- a/src/main/java/net/minecraft/client/renderer/EntityRenderer.java +++ b/src/main/java/net/minecraft/client/renderer/EntityRenderer.java @@ -174,6 +174,7 @@ public class EntityRenderer implements IResourceManagerReloadListener { private GameOverlayFramebuffer overlayFramebuffer; private float eagPartialTicks = 0.0f; public boolean fogStandard = false; + private float clipDistance = 128.0F; public EntityRenderer(Minecraft mcIn, IResourceManager resourceManagerIn) { this.useShader = false; @@ -598,16 +599,24 @@ public class EntityRenderer implements IResourceManagerReloadListener { if (this.mc.gameSettings.anaglyph) { GlStateManager.translate((float) (-(pass * 2 - 1)) * f, 0.0F, 0.0F); } + + this.clipDistance = this.farPlaneDistance * 2.0F; + + if (this.clipDistance < 173.0F) { + this.clipDistance = 173.0F; + } + + if (this.mc.theWorld.provider.getDimensionId() == 1) { + this.clipDistance = 256.0F; + } if (this.cameraZoom != 1.0D) { GlStateManager.translate((float) this.cameraYaw, (float) (-this.cameraPitch), 0.0F); GlStateManager.scale(this.cameraZoom, this.cameraZoom, 1.0D); } - float farPlane = this.farPlaneDistance * 2.0f * MathHelper.SQRT_2; - GlStateManager.gluPerspective(this.getFOVModifier(partialTicks, true), - (float) this.mc.displayWidth / (float) this.mc.displayHeight, 0.05F, farPlane); - DeferredStateManager.setGBufferNearFarPlanes(0.05f, farPlane); + GlStateManager.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.clipDistance); + DeferredStateManager.setGBufferNearFarPlanes(0.05f, clipDistance); GlStateManager.matrixMode(GL_MODELVIEW); GlStateManager.loadIdentity(); if (this.mc.gameSettings.anaglyph) { @@ -1159,23 +1168,20 @@ public class EntityRenderer implements IResourceManagerReloadListener { this.mc.mcProfiler.endStartSection("sky"); GlStateManager.matrixMode(GL_PROJECTION); GlStateManager.loadIdentity(); - GlStateManager.gluPerspective(this.getFOVModifier(partialTicks, true), - (float) this.mc.displayWidth / (float) this.mc.displayHeight, 0.05F, this.farPlaneDistance * 4.0F); + GlStateManager.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.clipDistance); GlStateManager.matrixMode(GL_MODELVIEW); renderglobal.renderSky(partialTicks, pass); GlStateManager.matrixMode(GL_PROJECTION); GlStateManager.loadIdentity(); - GlStateManager.gluPerspective(this.getFOVModifier(partialTicks, true), - (float) this.mc.displayWidth / (float) this.mc.displayHeight, 0.05F, - this.farPlaneDistance * MathHelper.SQRT_2); + GlStateManager.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.clipDistance); GlStateManager.matrixMode(GL_MODELVIEW); } this.setupFog(0, partialTicks); GlStateManager.shadeModel(GL_SMOOTH); - if (entity.posY + (double) entity.getEyeHeight() < 128.0D) { - this.renderCloudsCheck(renderglobal, partialTicks, pass); - } + if (entity.posY + (double)entity.getEyeHeight() < 128.0D + (double)(this.mc.gameSettings.ofCloudsHeight * 128.0F)) { + this.renderCloudsCheck(renderglobal, partialTicks, pass); + } this.mc.mcProfiler.endStartSection("prepareterrain"); this.setupFog(0, partialTicks); @@ -1280,10 +1286,10 @@ public class EntityRenderer implements IResourceManagerReloadListener { GlStateManager.enableCull(); GlStateManager.disableBlend(); GlStateManager.disableFog(); - if (entity.posY + (double) entity.getEyeHeight() >= 128.0D) { - this.mc.mcProfiler.endStartSection("aboveClouds"); - this.renderCloudsCheck(renderglobal, partialTicks, pass); - } + if (entity.posY + (double)entity.getEyeHeight() >= 128.0D + (double)(this.mc.gameSettings.ofCloudsHeight * 128.0F)) { + this.mc.mcProfiler.endStartSection("aboveClouds"); + this.renderCloudsCheck(renderglobal, partialTicks, pass); + } this.mc.mcProfiler.endStartSection("hand"); Shadow.moduleManager.onRender(); @@ -1296,26 +1302,22 @@ public class EntityRenderer implements IResourceManagerReloadListener { } private void renderCloudsCheck(RenderGlobal renderGlobalIn, float partialTicks, int pass) { - if (this.mc.gameSettings.func_181147_e() != 0) { - this.mc.mcProfiler.endStartSection("clouds"); - GlStateManager.matrixMode(GL_PROJECTION); - GlStateManager.loadIdentity(); - GlStateManager.gluPerspective(this.getFOVModifier(partialTicks, true), - (float) this.mc.displayWidth / (float) this.mc.displayHeight, 0.05F, this.farPlaneDistance * 4.0F); - GlStateManager.matrixMode(GL_MODELVIEW); - GlStateManager.pushMatrix(); - this.setupFog(0, partialTicks); - renderGlobalIn.renderClouds(partialTicks, pass); - GlStateManager.disableFog(); - GlStateManager.popMatrix(); - GlStateManager.matrixMode(GL_PROJECTION); - GlStateManager.loadIdentity(); - GlStateManager.gluPerspective(this.getFOVModifier(partialTicks, true), - (float) this.mc.displayWidth / (float) this.mc.displayHeight, 0.05F, - this.farPlaneDistance * MathHelper.SQRT_2); - GlStateManager.matrixMode(GL_MODELVIEW); - } - + if (this.mc.gameSettings.renderDistanceChunks >= 4 && !Config.isCloudsOff()) { + this.mc.mcProfiler.endStartSection("clouds"); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + GlStateManager.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.clipDistance * 4.0F); + GlStateManager.matrixMode(5888); + GlStateManager.pushMatrix(); + this.setupFog(0, partialTicks); + renderGlobalIn.renderClouds(partialTicks, pass); + GlStateManager.disableFog(); + GlStateManager.popMatrix(); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + GlStateManager.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.clipDistance); + GlStateManager.matrixMode(5888); + } } private void addRainParticles() { diff --git a/src/main/java/net/minecraft/client/renderer/RenderGlobal.java b/src/main/java/net/minecraft/client/renderer/RenderGlobal.java index 37ea88d..0ee842e 100644 --- a/src/main/java/net/minecraft/client/renderer/RenderGlobal.java +++ b/src/main/java/net/minecraft/client/renderer/RenderGlobal.java @@ -13,6 +13,7 @@ import java.util.Map; import net.PeytonPlayz585.shadow.Config; import net.PeytonPlayz585.shadow.CustomSky; import net.PeytonPlayz585.shadow.opengl.OpenGLManager; +import net.PeytonPlayz585.shadow.other.CloudRenderer; import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom; import net.lax1dude.eaglercraft.v1_8.HString; import net.lax1dude.eaglercraft.v1_8.Keyboard; @@ -190,8 +191,10 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene public Set chunksToResortTransparency = new LinkedHashSet(); public Set chunksToUpdateForced = new LinkedHashSet(); + private CloudRenderer cloudRenderer; public RenderGlobal(Minecraft mcIn) { + this.cloudRenderer = new CloudRenderer(mcIn); this.mc = mcIn; this.renderManager = mcIn.getRenderManager(); this.renderEngine = mcIn.getTextureManager(); @@ -1488,79 +1491,73 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene } public void renderClouds(float partialTicks, int pass) { - if (this.mc.theWorld.provider.isSurfaceWorld()) { - if (this.mc.gameSettings.func_181147_e() == 2) { - this.renderCloudsFancy(partialTicks, pass); - } else { - GlStateManager.disableCull(); - float f = (float) (this.mc.getRenderViewEntity().lastTickPosY - + (this.mc.getRenderViewEntity().posY - this.mc.getRenderViewEntity().lastTickPosY) - * (double) partialTicks); - boolean flag = true; - boolean flag1 = true; - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - this.renderEngine.bindTexture(locationCloudsPng); - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, 1, 0); - Vec3 vec3 = this.theWorld.getCloudColour(partialTicks); - float f1 = (float) vec3.xCoord; - float f2 = (float) vec3.yCoord; - float f3 = (float) vec3.zCoord; - if (pass != 2) { - float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F; - float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F; - float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F; - f1 = f4; - f2 = f5; - f3 = f6; - } + if (!Config.isCloudsOff()) { + if (this.mc.theWorld.provider.isSurfaceWorld()) { + if (Config.isCloudsFancy()) { + this.renderCloudsFancy(partialTicks, pass); + } else { + this.cloudRenderer.prepareToRender(false, this.cloudTickCounter, partialTicks); + partialTicks = 0.0F; + GlStateManager.disableCull(); + float f9 = (float)(this.mc.getRenderViewEntity().lastTickPosY + (this.mc.getRenderViewEntity().posY - this.mc.getRenderViewEntity().lastTickPosY) * (double)partialTicks); + boolean flag = true; + boolean flag1 = true; + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + this.renderEngine.bindTexture(locationCloudsPng); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - float f10 = 4.8828125E-4F; - double d2 = (double) ((float) this.cloudTickCounter + partialTicks); - double d0 = this.mc.getRenderViewEntity().prevPosX - + (this.mc.getRenderViewEntity().posX - this.mc.getRenderViewEntity().prevPosX) - * (double) partialTicks - + d2 * 0.029999999329447746D; - double d1 = this.mc.getRenderViewEntity().prevPosZ - + (this.mc.getRenderViewEntity().posZ - this.mc.getRenderViewEntity().prevPosZ) - * (double) partialTicks; - int i = MathHelper.floor_double(d0 / 2048.0D); - int j = MathHelper.floor_double(d1 / 2048.0D); - d0 = d0 - (double) (i * 2048); - d1 = d1 - (double) (j * 2048); - float f7 = this.theWorld.provider.getCloudHeight() - f + 0.33F; - float f8 = (float) (d0 * 4.8828125E-4D); - float f9 = (float) (d1 * 4.8828125E-4D); - worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + if (this.cloudRenderer.shouldUpdateGlList()) { + this.cloudRenderer.startUpdateGlList(); + Vec3 vec3 = this.theWorld.getCloudColour(partialTicks); + float f = (float)vec3.xCoord; + float f1 = (float)vec3.yCoord; + float f2 = (float)vec3.zCoord; - for (int k = -256; k < 256; k += 32) { - for (int l = -256; l < 256; l += 32) { - worldrenderer.pos((double) (k + 0), (double) f7, (double) (l + 32)) - .tex((double) ((float) (k + 0) * 4.8828125E-4F + f8), - (double) ((float) (l + 32) * 4.8828125E-4F + f9)) - .color(f1, f2, f3, 0.8F).endVertex(); - worldrenderer.pos((double) (k + 32), (double) f7, (double) (l + 32)) - .tex((double) ((float) (k + 32) * 4.8828125E-4F + f8), - (double) ((float) (l + 32) * 4.8828125E-4F + f9)) - .color(f1, f2, f3, 0.8F).endVertex(); - worldrenderer.pos((double) (k + 32), (double) f7, (double) (l + 0)) - .tex((double) ((float) (k + 32) * 4.8828125E-4F + f8), - (double) ((float) (l + 0) * 4.8828125E-4F + f9)) - .color(f1, f2, f3, 0.8F).endVertex(); - worldrenderer.pos((double) (k + 0), (double) f7, (double) (l + 0)) - .tex((double) ((float) (k + 0) * 4.8828125E-4F + f8), - (double) ((float) (l + 0) * 4.8828125E-4F + f9)) - .color(f1, f2, f3, 0.8F).endVertex(); - } - } + if (pass != 2) { + float f3 = (f * 30.0F + f1 * 59.0F + f2 * 11.0F) / 100.0F; + float f4 = (f * 30.0F + f1 * 70.0F) / 100.0F; + float f5 = (f * 30.0F + f2 * 70.0F) / 100.0F; + f = f3; + f1 = f4; + f2 = f5; + } - tessellator.draw(); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.disableBlend(); - GlStateManager.enableCull(); - } - } + float f10 = 4.8828125E-4F; + double d2 = (double)((float)this.cloudTickCounter + partialTicks); + double d0 = this.mc.getRenderViewEntity().prevPosX + (this.mc.getRenderViewEntity().posX - this.mc.getRenderViewEntity().prevPosX) * (double)partialTicks + d2 * 0.029999999329447746D; + double d1 = this.mc.getRenderViewEntity().prevPosZ + (this.mc.getRenderViewEntity().posZ - this.mc.getRenderViewEntity().prevPosZ) * (double)partialTicks; + int i = MathHelper.floor_double(d0 / 2048.0D); + int j = MathHelper.floor_double(d1 / 2048.0D); + d0 = d0 - (double)(i * 2048); + d1 = d1 - (double)(j * 2048); + float f6 = this.theWorld.provider.getCloudHeight() - f9 + 0.33F; + f6 = f6 + this.mc.gameSettings.ofCloudsHeight * 128.0F; + float f7 = (float)(d0 * 4.8828125E-4D); + float f8 = (float)(d1 * 4.8828125E-4D); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + + for (int k = -256; k < 256; k += 32) { + for (int l = -256; l < 256; l += 32) { + worldrenderer.pos((double)(k + 0), (double)f6, (double)(l + 32)).tex((double)((float)(k + 0) * 4.8828125E-4F + f7), (double)((float)(l + 32) * 4.8828125E-4F + f8)).color(f, f1, f2, 0.8F).endVertex(); + worldrenderer.pos((double)(k + 32), (double)f6, (double)(l + 32)).tex((double)((float)(k + 32) * 4.8828125E-4F + f7), (double)((float)(l + 32) * 4.8828125E-4F + f8)).color(f, f1, f2, 0.8F).endVertex(); + worldrenderer.pos((double)(k + 32), (double)f6, (double)(l + 0)).tex((double)((float)(k + 32) * 4.8828125E-4F + f7), (double)((float)(l + 0) * 4.8828125E-4F + f8)).color(f, f1, f2, 0.8F).endVertex(); + worldrenderer.pos((double)(k + 0), (double)f6, (double)(l + 0)).tex((double)((float)(k + 0) * 4.8828125E-4F + f7), (double)((float)(l + 0) * 4.8828125E-4F + f8)).color(f, f1, f2, 0.8F).endVertex(); + } + } + + tessellator.draw(); + this.cloudRenderer.endUpdateGlList(); + } + + this.cloudRenderer.renderGlList(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.disableBlend(); + GlStateManager.enableCull(); + } + } + } } /**+ @@ -1571,250 +1568,151 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene } private void renderCloudsFancy(float partialTicks, int pass) { - GlStateManager.disableCull(); - float f = (float) (this.mc.getRenderViewEntity().lastTickPosY - + (this.mc.getRenderViewEntity().posY - this.mc.getRenderViewEntity().lastTickPosY) - * (double) partialTicks); - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - float f1 = 12.0F; - float f2 = 4.0F; - double d0 = (double) ((float) this.cloudTickCounter + partialTicks); - double d1 = (this.mc.getRenderViewEntity().prevPosX - + (this.mc.getRenderViewEntity().posX - this.mc.getRenderViewEntity().prevPosX) * (double) partialTicks - + d0 * 0.029999999329447746D) / 12.0D; - double d2 = (this.mc.getRenderViewEntity().prevPosZ - + (this.mc.getRenderViewEntity().posZ - this.mc.getRenderViewEntity().prevPosZ) * (double) partialTicks) - / 12.0D + 0.33000001311302185D; - float f3 = this.theWorld.provider.getCloudHeight() - f + 0.33F; - int i = MathHelper.floor_double(d1 / 2048.0D); - int j = MathHelper.floor_double(d2 / 2048.0D); - d1 = d1 - (double) (i * 2048); - d2 = d2 - (double) (j * 2048); - this.renderEngine.bindTexture(locationCloudsPng); - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, 1, 0); - Vec3 vec3 = this.theWorld.getCloudColour(partialTicks); - float f4 = (float) vec3.xCoord; - float f5 = (float) vec3.yCoord; - float f6 = (float) vec3.zCoord; - if (pass != 2) { - float f7 = (f4 * 30.0F + f5 * 59.0F + f6 * 11.0F) / 100.0F; - float f8 = (f4 * 30.0F + f5 * 70.0F) / 100.0F; - float f9 = (f4 * 30.0F + f6 * 70.0F) / 100.0F; - f4 = f7; - f5 = f8; - f6 = f9; - } + this.cloudRenderer.prepareToRender(true, this.cloudTickCounter, partialTicks); + partialTicks = 0.0F; + GlStateManager.disableCull(); + float f = (float)(this.mc.getRenderViewEntity().lastTickPosY + (this.mc.getRenderViewEntity().posY - this.mc.getRenderViewEntity().lastTickPosY) * (double)partialTicks); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + float f1 = 12.0F; + float f2 = 4.0F; + double d0 = (double)((float)this.cloudTickCounter + partialTicks); + double d1 = (this.mc.getRenderViewEntity().prevPosX + (this.mc.getRenderViewEntity().posX - this.mc.getRenderViewEntity().prevPosX) * (double)partialTicks + d0 * 0.029999999329447746D) / 12.0D; + double d2 = (this.mc.getRenderViewEntity().prevPosZ + (this.mc.getRenderViewEntity().posZ - this.mc.getRenderViewEntity().prevPosZ) * (double)partialTicks) / 12.0D + 0.33000001311302185D; + float f3 = this.theWorld.provider.getCloudHeight() - f + 0.33F; + f3 = f3 + this.mc.gameSettings.ofCloudsHeight * 128.0F; + int i = MathHelper.floor_double(d1 / 2048.0D); + int j = MathHelper.floor_double(d2 / 2048.0D); + d1 = d1 - (double)(i * 2048); + d2 = d2 - (double)(j * 2048); + this.renderEngine.bindTexture(locationCloudsPng); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + Vec3 vec3 = this.theWorld.getCloudColour(partialTicks); + float f4 = (float)vec3.xCoord; + float f5 = (float)vec3.yCoord; + float f6 = (float)vec3.zCoord; - float f26 = f4 * 0.9F; - float f27 = f5 * 0.9F; - float f28 = f6 * 0.9F; - float f10 = f4 * 0.7F; - float f11 = f5 * 0.7F; - float f12 = f6 * 0.7F; - float f13 = f4 * 0.8F; - float f14 = f5 * 0.8F; - float f15 = f6 * 0.8F; - float f16 = 0.00390625F; - float f17 = (float) MathHelper.floor_double(d1) * 0.00390625F; - float f18 = (float) MathHelper.floor_double(d2) * 0.00390625F; - float f19 = (float) (d1 - (double) MathHelper.floor_double(d1)); - float f20 = (float) (d2 - (double) MathHelper.floor_double(d2)); - boolean flag = true; - boolean flag1 = true; - float f21 = 9.765625E-4F; - GlStateManager.scale(12.0F, 1.0F, 12.0F); + if (pass != 2) { + float f7 = (f4 * 30.0F + f5 * 59.0F + f6 * 11.0F) / 100.0F; + float f8 = (f4 * 30.0F + f5 * 70.0F) / 100.0F; + float f9 = (f4 * 30.0F + f6 * 70.0F) / 100.0F; + f4 = f7; + f5 = f8; + f6 = f9; + } - for (int k = 0; k < 2; ++k) { - if (k == 0) { - GlStateManager.colorMask(false, false, false, false); - } else { - switch (pass) { - case 0: - GlStateManager.colorMask(false, true, true, true); - break; - case 1: - GlStateManager.colorMask(true, false, false, true); - break; - case 2: - GlStateManager.colorMask(true, true, true, true); - } - } + float f26 = f4 * 0.9F; + float f27 = f5 * 0.9F; + float f28 = f6 * 0.9F; + float f10 = f4 * 0.7F; + float f11 = f5 * 0.7F; + float f12 = f6 * 0.7F; + float f13 = f4 * 0.8F; + float f14 = f5 * 0.8F; + float f15 = f6 * 0.8F; + float f16 = 0.00390625F; + float f17 = (float)MathHelper.floor_double(d1) * 0.00390625F; + float f18 = (float)MathHelper.floor_double(d2) * 0.00390625F; + float f19 = (float)(d1 - (double)MathHelper.floor_double(d1)); + float f20 = (float)(d2 - (double)MathHelper.floor_double(d2)); + boolean flag = true; + boolean flag1 = true; + float f21 = 9.765625E-4F; + GlStateManager.scale(12.0F, 1.0F, 12.0F); - for (int l = -3; l <= 4; ++l) { - for (int i1 = -3; i1 <= 4; ++i1) { - worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL); - float f22 = (float) (l * 8); - float f23 = (float) (i1 * 8); - float f24 = f22 - f19; - float f25 = f23 - f20; - if (f3 > -5.0F) { - worldrenderer.pos((double) (f24 + 0.0F), (double) (f3 + 0.0F), (double) (f25 + 8.0F)) - .tex((double) ((f22 + 0.0F) * 0.00390625F + f17), - (double) ((f23 + 8.0F) * 0.00390625F + f18)) - .color(f10, f11, f12, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex(); - worldrenderer.pos((double) (f24 + 8.0F), (double) (f3 + 0.0F), (double) (f25 + 8.0F)) - .tex((double) ((f22 + 8.0F) * 0.00390625F + f17), - (double) ((f23 + 8.0F) * 0.00390625F + f18)) - .color(f10, f11, f12, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex(); - worldrenderer.pos((double) (f24 + 8.0F), (double) (f3 + 0.0F), (double) (f25 + 0.0F)) - .tex((double) ((f22 + 8.0F) * 0.00390625F + f17), - (double) ((f23 + 0.0F) * 0.00390625F + f18)) - .color(f10, f11, f12, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex(); - worldrenderer.pos((double) (f24 + 0.0F), (double) (f3 + 0.0F), (double) (f25 + 0.0F)) - .tex((double) ((f22 + 0.0F) * 0.00390625F + f17), - (double) ((f23 + 0.0F) * 0.00390625F + f18)) - .color(f10, f11, f12, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex(); - } + for (int k = 0; k < 2; ++k) { + if (k == 0) { + GlStateManager.colorMask(false, false, false, false); + } else { + switch (pass) { + case 0: + GlStateManager.colorMask(false, true, true, true); + break; - if (f3 <= 5.0F) { - worldrenderer - .pos((double) (f24 + 0.0F), (double) (f3 + 4.0F - 9.765625E-4F), (double) (f25 + 8.0F)) - .tex((double) ((f22 + 0.0F) * 0.00390625F + f17), - (double) ((f23 + 8.0F) * 0.00390625F + f18)) - .color(f4, f5, f6, 0.8F).normal(0.0F, 1.0F, 0.0F).endVertex(); - worldrenderer - .pos((double) (f24 + 8.0F), (double) (f3 + 4.0F - 9.765625E-4F), (double) (f25 + 8.0F)) - .tex((double) ((f22 + 8.0F) * 0.00390625F + f17), - (double) ((f23 + 8.0F) * 0.00390625F + f18)) - .color(f4, f5, f6, 0.8F).normal(0.0F, 1.0F, 0.0F).endVertex(); - worldrenderer - .pos((double) (f24 + 8.0F), (double) (f3 + 4.0F - 9.765625E-4F), (double) (f25 + 0.0F)) - .tex((double) ((f22 + 8.0F) * 0.00390625F + f17), - (double) ((f23 + 0.0F) * 0.00390625F + f18)) - .color(f4, f5, f6, 0.8F).normal(0.0F, 1.0F, 0.0F).endVertex(); - worldrenderer - .pos((double) (f24 + 0.0F), (double) (f3 + 4.0F - 9.765625E-4F), (double) (f25 + 0.0F)) - .tex((double) ((f22 + 0.0F) * 0.00390625F + f17), - (double) ((f23 + 0.0F) * 0.00390625F + f18)) - .color(f4, f5, f6, 0.8F).normal(0.0F, 1.0F, 0.0F).endVertex(); - } + case 1: + GlStateManager.colorMask(true, false, false, true); + break; - if (l > -1) { - for (int j1 = 0; j1 < 8; ++j1) { - worldrenderer - .pos((double) (f24 + (float) j1 + 0.0F), (double) (f3 + 0.0F), - (double) (f25 + 8.0F)) - .tex((double) ((f22 + (float) j1 + 0.5F) * 0.00390625F + f17), - (double) ((f23 + 8.0F) * 0.00390625F + f18)) - .color(f26, f27, f28, 0.8F).normal(-1.0F, 0.0F, 0.0F).endVertex(); - worldrenderer - .pos((double) (f24 + (float) j1 + 0.0F), (double) (f3 + 4.0F), - (double) (f25 + 8.0F)) - .tex((double) ((f22 + (float) j1 + 0.5F) * 0.00390625F + f17), - (double) ((f23 + 8.0F) * 0.00390625F + f18)) - .color(f26, f27, f28, 0.8F).normal(-1.0F, 0.0F, 0.0F).endVertex(); - worldrenderer - .pos((double) (f24 + (float) j1 + 0.0F), (double) (f3 + 4.0F), - (double) (f25 + 0.0F)) - .tex((double) ((f22 + (float) j1 + 0.5F) * 0.00390625F + f17), - (double) ((f23 + 0.0F) * 0.00390625F + f18)) - .color(f26, f27, f28, 0.8F).normal(-1.0F, 0.0F, 0.0F).endVertex(); - worldrenderer - .pos((double) (f24 + (float) j1 + 0.0F), (double) (f3 + 0.0F), - (double) (f25 + 0.0F)) - .tex((double) ((f22 + (float) j1 + 0.5F) * 0.00390625F + f17), - (double) ((f23 + 0.0F) * 0.00390625F + f18)) - .color(f26, f27, f28, 0.8F).normal(-1.0F, 0.0F, 0.0F).endVertex(); - } - } + case 2: + GlStateManager.colorMask(true, true, true, true); + } + } - if (l <= 1) { - for (int k1 = 0; k1 < 8; ++k1) { - worldrenderer - .pos((double) (f24 + (float) k1 + 1.0F - 9.765625E-4F), (double) (f3 + 0.0F), - (double) (f25 + 8.0F)) - .tex((double) ((f22 + (float) k1 + 0.5F) * 0.00390625F + f17), - (double) ((f23 + 8.0F) * 0.00390625F + f18)) - .color(f26, f27, f28, 0.8F).normal(1.0F, 0.0F, 0.0F).endVertex(); - worldrenderer - .pos((double) (f24 + (float) k1 + 1.0F - 9.765625E-4F), (double) (f3 + 4.0F), - (double) (f25 + 8.0F)) - .tex((double) ((f22 + (float) k1 + 0.5F) * 0.00390625F + f17), - (double) ((f23 + 8.0F) * 0.00390625F + f18)) - .color(f26, f27, f28, 0.8F).normal(1.0F, 0.0F, 0.0F).endVertex(); - worldrenderer - .pos((double) (f24 + (float) k1 + 1.0F - 9.765625E-4F), (double) (f3 + 4.0F), - (double) (f25 + 0.0F)) - .tex((double) ((f22 + (float) k1 + 0.5F) * 0.00390625F + f17), - (double) ((f23 + 0.0F) * 0.00390625F + f18)) - .color(f26, f27, f28, 0.8F).normal(1.0F, 0.0F, 0.0F).endVertex(); - worldrenderer - .pos((double) (f24 + (float) k1 + 1.0F - 9.765625E-4F), (double) (f3 + 0.0F), - (double) (f25 + 0.0F)) - .tex((double) ((f22 + (float) k1 + 0.5F) * 0.00390625F + f17), - (double) ((f23 + 0.0F) * 0.00390625F + f18)) - .color(f26, f27, f28, 0.8F).normal(1.0F, 0.0F, 0.0F).endVertex(); - } - } + this.cloudRenderer.renderGlList(); + } - if (i1 > -1) { - for (int l1 = 0; l1 < 8; ++l1) { - worldrenderer - .pos((double) (f24 + 0.0F), (double) (f3 + 4.0F), - (double) (f25 + (float) l1 + 0.0F)) - .tex((double) ((f22 + 0.0F) * 0.00390625F + f17), - (double) ((f23 + (float) l1 + 0.5F) * 0.00390625F + f18)) - .color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, -1.0F).endVertex(); - worldrenderer - .pos((double) (f24 + 8.0F), (double) (f3 + 4.0F), - (double) (f25 + (float) l1 + 0.0F)) - .tex((double) ((f22 + 8.0F) * 0.00390625F + f17), - (double) ((f23 + (float) l1 + 0.5F) * 0.00390625F + f18)) - .color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, -1.0F).endVertex(); - worldrenderer - .pos((double) (f24 + 8.0F), (double) (f3 + 0.0F), - (double) (f25 + (float) l1 + 0.0F)) - .tex((double) ((f22 + 8.0F) * 0.00390625F + f17), - (double) ((f23 + (float) l1 + 0.5F) * 0.00390625F + f18)) - .color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, -1.0F).endVertex(); - worldrenderer - .pos((double) (f24 + 0.0F), (double) (f3 + 0.0F), - (double) (f25 + (float) l1 + 0.0F)) - .tex((double) ((f22 + 0.0F) * 0.00390625F + f17), - (double) ((f23 + (float) l1 + 0.5F) * 0.00390625F + f18)) - .color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, -1.0F).endVertex(); - } - } + if (this.cloudRenderer.shouldUpdateGlList()) { + this.cloudRenderer.startUpdateGlList(); - if (i1 <= 1) { - for (int i2 = 0; i2 < 8; ++i2) { - worldrenderer - .pos((double) (f24 + 0.0F), (double) (f3 + 4.0F), - (double) (f25 + (float) i2 + 1.0F - 9.765625E-4F)) - .tex((double) ((f22 + 0.0F) * 0.00390625F + f17), - (double) ((f23 + (float) i2 + 0.5F) * 0.00390625F + f18)) - .color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, 1.0F).endVertex(); - worldrenderer - .pos((double) (f24 + 8.0F), (double) (f3 + 4.0F), - (double) (f25 + (float) i2 + 1.0F - 9.765625E-4F)) - .tex((double) ((f22 + 8.0F) * 0.00390625F + f17), - (double) ((f23 + (float) i2 + 0.5F) * 0.00390625F + f18)) - .color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, 1.0F).endVertex(); - worldrenderer - .pos((double) (f24 + 8.0F), (double) (f3 + 0.0F), - (double) (f25 + (float) i2 + 1.0F - 9.765625E-4F)) - .tex((double) ((f22 + 8.0F) * 0.00390625F + f17), - (double) ((f23 + (float) i2 + 0.5F) * 0.00390625F + f18)) - .color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, 1.0F).endVertex(); - worldrenderer - .pos((double) (f24 + 0.0F), (double) (f3 + 0.0F), - (double) (f25 + (float) i2 + 1.0F - 9.765625E-4F)) - .tex((double) ((f22 + 0.0F) * 0.00390625F + f17), - (double) ((f23 + (float) i2 + 0.5F) * 0.00390625F + f18)) - .color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, 1.0F).endVertex(); - } - } + for (int j1 = -3; j1 <= 4; ++j1) { + for (int l = -3; l <= 4; ++l) { + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL); + float f22 = (float)(j1 * 8); + float f23 = (float)(l * 8); + float f24 = f22 - f19; + float f25 = f23 - f20; - tessellator.draw(); - } - } - } + if (f3 > -5.0F) { + worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 0.0F), (double)(f25 + 8.0F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f10, f11, f12, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex(); + worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 0.0F), (double)(f25 + 8.0F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f10, f11, f12, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex(); + worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 0.0F), (double)(f25 + 0.0F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f10, f11, f12, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex(); + worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 0.0F), (double)(f25 + 0.0F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f10, f11, f12, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex(); + } - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.disableBlend(); - GlStateManager.enableCull(); + if (f3 <= 5.0F) { + worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 4.0F - 9.765625E-4F), (double)(f25 + 8.0F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f4, f5, f6, 0.8F).normal(0.0F, 1.0F, 0.0F).endVertex(); + worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 4.0F - 9.765625E-4F), (double)(f25 + 8.0F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f4, f5, f6, 0.8F).normal(0.0F, 1.0F, 0.0F).endVertex(); + worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 4.0F - 9.765625E-4F), (double)(f25 + 0.0F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f4, f5, f6, 0.8F).normal(0.0F, 1.0F, 0.0F).endVertex(); + worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 4.0F - 9.765625E-4F), (double)(f25 + 0.0F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f4, f5, f6, 0.8F).normal(0.0F, 1.0F, 0.0F).endVertex(); + } + + if (j1 > -1) { + for (int i1 = 0; i1 < 8; ++i1) { + worldrenderer.pos((double)(f24 + (float)i1 + 0.0F), (double)(f3 + 0.0F), (double)(f25 + 8.0F)).tex((double)((f22 + (float)i1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f26, f27, f28, 0.8F).normal(-1.0F, 0.0F, 0.0F).endVertex(); + worldrenderer.pos((double)(f24 + (float)i1 + 0.0F), (double)(f3 + 4.0F), (double)(f25 + 8.0F)).tex((double)((f22 + (float)i1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f26, f27, f28, 0.8F).normal(-1.0F, 0.0F, 0.0F).endVertex(); + worldrenderer.pos((double)(f24 + (float)i1 + 0.0F), (double)(f3 + 4.0F), (double)(f25 + 0.0F)).tex((double)((f22 + (float)i1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f26, f27, f28, 0.8F).normal(-1.0F, 0.0F, 0.0F).endVertex(); + worldrenderer.pos((double)(f24 + (float)i1 + 0.0F), (double)(f3 + 0.0F), (double)(f25 + 0.0F)).tex((double)((f22 + (float)i1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f26, f27, f28, 0.8F).normal(-1.0F, 0.0F, 0.0F).endVertex(); + } + } + + if (j1 <= 1) { + for (int k1 = 0; k1 < 8; ++k1) { + worldrenderer.pos((double)(f24 + (float)k1 + 1.0F - 9.765625E-4F), (double)(f3 + 0.0F), (double)(f25 + 8.0F)).tex((double)((f22 + (float)k1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f26, f27, f28, 0.8F).normal(1.0F, 0.0F, 0.0F).endVertex(); + worldrenderer.pos((double)(f24 + (float)k1 + 1.0F - 9.765625E-4F), (double)(f3 + 4.0F), (double)(f25 + 8.0F)).tex((double)((f22 + (float)k1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f26, f27, f28, 0.8F).normal(1.0F, 0.0F, 0.0F).endVertex(); + worldrenderer.pos((double)(f24 + (float)k1 + 1.0F - 9.765625E-4F), (double)(f3 + 4.0F), (double)(f25 + 0.0F)).tex((double)((f22 + (float)k1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f26, f27, f28, 0.8F).normal(1.0F, 0.0F, 0.0F).endVertex(); + worldrenderer.pos((double)(f24 + (float)k1 + 1.0F - 9.765625E-4F), (double)(f3 + 0.0F), (double)(f25 + 0.0F)).tex((double)((f22 + (float)k1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f26, f27, f28, 0.8F).normal(1.0F, 0.0F, 0.0F).endVertex(); + } + } + + if (l > -1) { + for (int l1 = 0; l1 < 8; ++l1) { + worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 4.0F), (double)(f25 + (float)l1 + 0.0F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + (float)l1 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, -1.0F).endVertex(); + worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 4.0F), (double)(f25 + (float)l1 + 0.0F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + (float)l1 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, -1.0F).endVertex(); + worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 0.0F), (double)(f25 + (float)l1 + 0.0F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + (float)l1 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, -1.0F).endVertex(); + worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 0.0F), (double)(f25 + (float)l1 + 0.0F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + (float)l1 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, -1.0F).endVertex(); + } + } + + if (l <= 1) { + for (int i2 = 0; i2 < 8; ++i2) { + worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 4.0F), (double)(f25 + (float)i2 + 1.0F - 9.765625E-4F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + (float)i2 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, 1.0F).endVertex(); + worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 4.0F), (double)(f25 + (float)i2 + 1.0F - 9.765625E-4F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + (float)i2 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, 1.0F).endVertex(); + worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 0.0F), (double)(f25 + (float)i2 + 1.0F - 9.765625E-4F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + (float)i2 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, 1.0F).endVertex(); + worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 0.0F), (double)(f25 + (float)i2 + 1.0F - 9.765625E-4F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + (float)i2 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, 1.0F).endVertex(); + } + } + + tessellator.draw(); + } + } + + this.cloudRenderer.endUpdateGlList(); + } + + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.disableBlend(); + GlStateManager.enableCull(); } public void updateChunks(long finishTimeNano) { @@ -2599,6 +2497,10 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene this.field_181024_n.addAll(parCollection2); } } + + public void resetClouds() { + this.cloudRenderer.reset(); + } class ContainerLocalRenderInformation { final RenderChunk renderChunk; diff --git a/src/main/java/net/minecraft/client/settings/GameSettings.java b/src/main/java/net/minecraft/client/settings/GameSettings.java index 9974821..7b81613 100644 --- a/src/main/java/net/minecraft/client/settings/GameSettings.java +++ b/src/main/java/net/minecraft/client/settings/GameSettings.java @@ -82,10 +82,6 @@ public class GameSettings { public boolean anaglyph; public boolean fboEnable = true; public int limitFramerate = 260; - /**+ - * Clouds flag - */ - public int clouds = 1; public boolean fancyGraphics = false; /**+ * Smooth Lighting @@ -200,6 +196,12 @@ public class GameSettings { public boolean ofClearWater = false; public int ofBetterGrass = 3; + //Detail Settings + /** Clouds flag */ + public int clouds = 2; + public int ofClouds = 0; + public float ofCloudsHeight = 0.0F; + //Optifine Animations public int ofAnimatedWater = 0; public int ofAnimatedLava = 0; @@ -347,6 +349,11 @@ public class GameSettings { this.ofAoLevel = parFloat1; this.mc.renderGlobal.loadRenderers(); } + + if (parOptions == GameSettings.Options.CLOUD_HEIGHT) { + this.ofCloudsHeight = parFloat1; + this.mc.renderGlobal.resetClouds(); + } } /**+ @@ -370,10 +377,6 @@ public class GameSettings { this.viewBobbing = !this.viewBobbing; } - if (parOptions == GameSettings.Options.RENDER_CLOUDS) { - this.clouds = (this.clouds + parInt1) % 3; - } - if (parOptions == GameSettings.Options.FORCE_UNICODE_FONT) { this.forceUnicodeFont = !this.forceUnicodeFont; this.mc.fontRendererObj @@ -635,6 +638,17 @@ public class GameSettings { this.ofChunkUpdates = 1; } } + + if (parOptions == GameSettings.Options.CLOUDS) { + ++this.ofClouds; + + if (this.ofClouds > 3) { + this.ofClouds = 0; + } + + this.updateRenderClouds(); + this.mc.renderGlobal.resetClouds(); + } this.saveOptions(); } @@ -653,7 +667,8 @@ public class GameSettings { : (parOptions == GameSettings.Options.MIPMAP_LEVELS ? (float) this.mipmapLevels : (parOptions == GameSettings.Options.RENDER_DISTANCE ? (float) this.renderDistanceChunks : (parOptions == GameSettings.Options.AO_LEVEL ? this.ofAoLevel - : 0.0F)))))))))))); + : (parOptions == GameSettings.Options.CLOUD_HEIGHT ? this.ofCloudsHeight + : 0.0F))))))))))))); } public boolean getOptionOrdinalValue(GameSettings.Options parOptions) { @@ -738,7 +753,6 @@ public class GameSettings { return parOptions == GameSettings.Options.SENSITIVITY ? (f == 0.0F ? s + I18n.format("options.sensitivity.min", new Object[0]) : (f == 1.0F ? s + I18n.format("options.sensitivity.max", new Object[0]) : s + (int) (f * 200.0F) + "%")) : (parOptions == GameSettings.Options.FOV ? (f1 == 70.0F ? s + I18n.format("options.fov.min", new Object[0]) : (f1 == 110.0F ? s + I18n.format("options.fov.max", new Object[0]) : s + (int) f1)) : (parOptions == GameSettings.Options.FRAMERATE_LIMIT ? (f1 == parOptions.valueMax ? s + I18n.format("options.framerateLimit.max", new Object[0]) : s + (int) f1 + " fps") - : (parOptions == GameSettings.Options.RENDER_CLOUDS ? (f1 == parOptions.valueMin ? s + I18n.format("options.cloudHeight.min", new Object[0]) : s + ((int) f1 + 128)) : (parOptions == GameSettings.Options.GAMMA ? (f == 0.0F ? s + I18n.format("options.gamma.min", new Object[0]) : (f == 1.0F ? s + I18n.format("options.gamma.max", new Object[0]) : s + "+" + (int) (f * 100.0F) + "%")) : (parOptions == GameSettings.Options.SATURATION ? s + (int) (f * 400.0F) + "%" : (parOptions == GameSettings.Options.CHAT_OPACITY ? s + (int) (f * 90.0F + 10.0F) + "%" @@ -749,6 +763,7 @@ public class GameSettings { : (parOptions == GameSettings.Options.RENDER_DISTANCE ? s + (int) f1 + (f1 == 1.0F ? " chunk" : " chunks") : (parOptions == GameSettings.Options.MIPMAP_LEVELS ? (f == 0.0F ? s + I18n.format("options.off", new Object[0]) : s + (int) (f * 100.0F) + "%") : (parOptions == GameSettings.Options.AO_LEVEL ? (f == 0.0F ? s + I18n.format("options.off", new Object[0]) : s + (int) (f * 100.0F) + "%") + : (parOptions == GameSettings.Options.CLOUD_HEIGHT ? (f == 0.0F ? s + I18n.format("options.off", new Object[0]) : s + (int) (f * 100.0F) + "%") : "yee"))))))))))))); } else if (parOptions.getEnumBoolean()) { boolean flag = this.getOptionOrdinalValue(parOptions); @@ -761,8 +776,6 @@ public class GameSettings { return s + getTranslation(PARTICLES, this.particleSetting); } else if (parOptions == GameSettings.Options.AMBIENT_OCCLUSION) { return s + getTranslation(AMBIENT_OCCLUSIONS, this.ambientOcclusion); - } else if (parOptions == GameSettings.Options.RENDER_CLOUDS) { - return s + getTranslation(field_181149_aW, this.clouds); } else if (parOptions == GameSettings.Options.GRAPHICS) { if (this.fancyGraphics) { return s + I18n.format("options.graphics.fancy", new Object[0]); @@ -883,6 +896,20 @@ public class GameSettings { return this.ofSmoothFps ? s + "ON" : s + "OFF"; } else if (parOptions == GameSettings.Options.CHUNK_UPDATES) { return s + this.ofChunkUpdates; + } else if (parOptions == GameSettings.Options.CLOUDS) { + switch (this.ofClouds) { + case 1: + return s + "Fast"; + + case 2: + return s + "Fancy"; + + case 3: + return s + "OFF"; + + default: + return s + "Default"; + } } else { return s; } @@ -973,16 +1000,6 @@ public class GameSettings { } } - if (astring[0].equals("renderClouds")) { - if (astring[1].equals("true")) { - this.clouds = 2; - } else if (astring[1].equals("false")) { - this.clouds = 0; - } else if (astring[1].equals("fast")) { - this.clouds = 1; - } - } - if (astring[0].equals("resourcePacks")) { this.resourcePacks.clear(); for (Object o : (new JSONArray(s.substring(s.indexOf(58) + 1))).toList()) { @@ -1294,6 +1311,17 @@ public class GameSettings { this.ofChunkUpdates = Integer.valueOf(astring[1]).intValue(); this.ofChunkUpdates = Config.limit(this.ofChunkUpdates, 1, 5); } + + if (astring[0].equals("ofClouds") && astring.length >= 2) { + this.ofClouds = Integer.valueOf(astring[1]).intValue(); + this.ofClouds = Config.limit(this.ofClouds, 0, 3); + this.updateRenderClouds(); + } + + if (astring[0].equals("ofCloudsHeight") && astring.length >= 2) { + this.ofCloudsHeight = Float.valueOf(astring[1]).floatValue(); + this.ofCloudsHeight = Config.limit(this.ofCloudsHeight, 0.0F, 1.0F); + } Keyboard.setFunctionKeyModifier(keyBindFunction.getKeyCode()); @@ -1351,17 +1379,6 @@ public class GameSettings { printwriter.println("difficulty:" + this.difficulty.getDifficultyId()); printwriter.println("fancyGraphics:" + this.fancyGraphics); printwriter.println("ao:" + this.ambientOcclusion); - switch (this.clouds) { - case 0: - printwriter.println("renderClouds:false"); - break; - case 1: - printwriter.println("renderClouds:fast"); - break; - case 2: - printwriter.println("renderClouds:true"); - } - printwriter.println("resourcePacks:" + toJSONArray(this.resourcePacks)); printwriter.println("incompatibleResourcePacks:" + toJSONArray(this.field_183018_l)); printwriter.println("lastServer:" + this.lastServer); @@ -1440,6 +1457,8 @@ public class GameSettings { } printwriter.println("ofSmoothFps:" + this.ofSmoothFps); printwriter.println("ofChunkUpdates:" + this.ofChunkUpdates); + printwriter.println("ofClouds:" + this.ofClouds); + printwriter.println("ofCloudsHeight:" + this.ofCloudsHeight); for (KeyBinding keybinding : this.keyBindings) { printwriter.println("key_" + keybinding.getKeyDescription() + ":" + keybinding.getKeyCode()); @@ -1521,11 +1540,7 @@ public class GameSettings { this.sendSettingsToServer(); } - - public int func_181147_e() { - return this.renderDistanceChunks >= 4 ? this.clouds : 0; - } - + public boolean func_181148_f() { return this.field_181150_U; } @@ -1548,8 +1563,7 @@ public class GameSettings { VIEW_BOBBING("options.viewBobbing", false, true), ANAGLYPH("options.anaglyph", false, true), FRAMERATE_LIMIT("options.framerateLimit", true, false, 10.0F, 260.0F, 10.0F), - FBO_ENABLE("options.fboEnable", false, true), - RENDER_CLOUDS("options.renderClouds", false, false), + FBO_ENABLE("options.fboEnable", false, true), GRAPHICS("options.graphics", false, false), AMBIENT_OCCLUSION("options.ao", false, false), GUI_SCALE("options.guiScale", false, false), @@ -1609,7 +1623,9 @@ public class GameSettings { FOG_START("Fog Start", false, false), SHADER_PROFILE("Profile", false, false), SMOOTH_FPS("Smooth FPS", false, false), - CHUNK_UPDATES("Chunk Updates", false, false); + CHUNK_UPDATES("Chunk Updates", false, false), + CLOUDS("Clouds", false, false), + CLOUD_HEIGHT("Cloud Height", true, false); private final boolean enumFloat; private final boolean enumBoolean; @@ -1714,4 +1730,27 @@ public class GameSettings { private void updateWaterOpacity() { ClearWater.updateWaterOpacity(this, this.mc.theWorld); } + + private void updateRenderClouds() { + switch (this.ofClouds) { + case 1: + this.clouds = 1; + break; + + case 2: + this.clouds = 2; + break; + + case 3: + this.clouds = 0; + break; + + default: + if (this.fancyGraphics) { + this.clouds = 2; + } else { + this.clouds = 1; + } + } + } } \ No newline at end of file