@Override public void drawButton(Minecraft mc, int mx, int my) { if (this.visible) { ManualUtils.bindTexture(gui.texture); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.field_146123_n = mx >= this.xPosition && mx < (this.xPosition + this.width) && my >= this.yPosition && my < (this.yPosition + this.height); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); int u = type == 5 ? 46 : type == 4 || type == 6 ? 36 : (type < 2 ? 0 : type < 3 ? 16 : 26) + (type > 1 ? (10 - width) : type == 1 ? (16 - width) : 0); int v = 216 + (type == 0 ? 0 : type == 1 ? 10 : type == 2 ? (16 - height) : type == 3 ? 0 : type == 4 || type == 5 ? 10 : 0); if (field_146123_n) v += 20; this.drawTexturedModalRect(this.xPosition, this.yPosition, u, v, width, height); this.mouseDragged(mc, mx, my); } }
/** Rotate and blurs the skybox view in the main menu */ private void rotateAndBlurSkybox(float par1) { this.mc.getTextureManager().bindTexture(this.field_110351_G); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, 256, 256); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glColorMask(true, true, true, false); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); GL11.glDisable(GL11.GL_ALPHA_TEST); byte b0 = 3; for (int i = 0; i < b0; ++i) { tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F / (float) (i + 1)); int j = this.width; int k = this.height; float f1 = (float) (i - b0 / 2) / 256.0F; tessellator.addVertexWithUV( (double) j, (double) k, (double) this.zLevel, (double) (0.0F + f1), 1.0D); tessellator.addVertexWithUV( (double) j, 0.0D, (double) this.zLevel, (double) (1.0F + f1), 1.0D); tessellator.addVertexWithUV(0.0D, 0.0D, (double) this.zLevel, (double) (1.0F + f1), 0.0D); tessellator.addVertexWithUV( 0.0D, (double) k, (double) this.zLevel, (double) (0.0F + f1), 0.0D); } tessellator.draw(); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glColorMask(true, true, true, true); }
private static void drawGradientRect( int p_73733_1_, int p_73733_2_, int p_73733_3_, int p_73733_4_, int p_73733_5_, int p_73733_6_, float zLevel) { float f = (float) (p_73733_5_ >> 24 & 255) / 255.0F; float f1 = (float) (p_73733_5_ >> 16 & 255) / 255.0F; float f2 = (float) (p_73733_5_ >> 8 & 255) / 255.0F; float f3 = (float) (p_73733_5_ & 255) / 255.0F; float f4 = (float) (p_73733_6_ >> 24 & 255) / 255.0F; float f5 = (float) (p_73733_6_ >> 16 & 255) / 255.0F; float f6 = (float) (p_73733_6_ >> 8 & 255) / 255.0F; float f7 = (float) (p_73733_6_ & 255) / 255.0F; GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glShadeModel(GL11.GL_SMOOTH); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.setColorRGBA_F(f1, f2, f3, f); tessellator.addVertex((double) p_73733_3_, (double) p_73733_2_, (double) zLevel); tessellator.addVertex((double) p_73733_1_, (double) p_73733_2_, (double) zLevel); tessellator.setColorRGBA_F(f5, f6, f7, f4); tessellator.addVertex((double) p_73733_1_, (double) p_73733_4_, (double) zLevel); tessellator.addVertex((double) p_73733_3_, (double) p_73733_4_, (double) zLevel); tessellator.draw(); GL11.glShadeModel(GL11.GL_FLAT); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); }
/** Rotate and blurs the skybox view in the main menu */ private void rotateAndBlurSkybox(float p_73968_1_) { this.mc.getTextureManager().bindTexture(this.field_110351_G); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, 256, 256); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glColorMask(true, true, true, false); Tessellator var2 = Tessellator.instance; var2.startDrawingQuads(); GL11.glDisable(GL11.GL_ALPHA_TEST); byte var3 = 3; for (int var4 = 0; var4 < var3; ++var4) { var2.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F / (float) (var4 + 1)); int var5 = this.width; int var6 = this.height; float var7 = (float) (var4 - var3 / 2) / 256.0F; var2.addVertexWithUV( (double) var5, (double) var6, (double) this.zLevel, (double) (0.0F + var7), 1.0D); var2.addVertexWithUV((double) var5, 0.0D, (double) this.zLevel, (double) (1.0F + var7), 1.0D); var2.addVertexWithUV(0.0D, 0.0D, (double) this.zLevel, (double) (1.0F + var7), 0.0D); var2.addVertexWithUV(0.0D, (double) var6, (double) this.zLevel, (double) (0.0F + var7), 0.0D); } var2.draw(); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glColorMask(true, true, true, true); }
@Override public void renderTileEntityAt(TileEntity var1, double xd, double yd, double zd, float partial) { SculptureEntity se = (SculptureEntity) var1; RenderHelper.disableStandardItemLighting(); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); if (!se.getRender().ready() && !se.getRender().hasContext()) { int lightX = (int) (OpenGlHelper.lastBrightnessX); int lightY = (int) (OpenGlHelper.lastBrightnessY); int light = lightY * 65536 + lightX; se.getRender().initFromSculptureAndLight(se.sculpture(), light); } else se.updateRender(); GL11.glPushMatrix(); GL11.glTranslated(xd, yd, zd); GL11.glCallList(se.getRender().glDisplayList); GL11.glPopMatrix(); GL11.glDisable(GL11.GL_BLEND); GL11.glShadeModel(GL11.GL_FLAT); RenderHelper.enableStandardItemLighting(); }
@Override public void drawButton(Minecraft minecraft, int x, int y) { if (this.visible) { minecraft.getTextureManager().bindTexture(GuiBooklet.resLoc); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.field_146123_n = x >= this.xPosition && y >= this.yPosition && x < this.xPosition + this.width && y < this.yPosition + this.height; int k = this.getHoverState(this.field_146123_n); if (k == 0) { k = 1; } GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); this.drawTexturedModalRect( this.xPosition, this.yPosition, this.texturePosX, this.texturePosY - this.height + k * this.height, this.width, this.height); this.mouseDragged(minecraft, x, y); } }
private void renderGlintSlot(int x, int y, int width, int height) { for (int j1 = 0; j1 < 2; ++j1) { OpenGlHelper.glBlendFunc(772, 1, 0, 0); float f = 0.00390625F; float f1 = 0.00390625F; float f2 = (float) (Minecraft.getSystemTime() % (long) (3000 + j1 * 1873)) / (3000.0F + (float) (j1 * 1873)) * 256.0F; float f3 = 0.0F; Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); float f4 = 4.0F; if (j1 == 1) { f4 = -1.0F; } tessellator.getWorldRenderer().startDrawingQuads(); tessellator .getWorldRenderer() .addVertexWithUV( (double) (x), (double) (y + height), (double) itemRender.zLevel, (double) ((f2 + (float) height * f4) * f), (double) ((f3 + (float) height) * f1)); tessellator .getWorldRenderer() .addVertexWithUV( (double) (x + width), (double) (y + height), (double) itemRender.zLevel, (double) ((f2 + (float) width + (float) height * f4) * f), (double) ((f3 + (float) height) * f1)); tessellator .getWorldRenderer() .addVertexWithUV( (double) (x + width), (double) (y), (double) itemRender.zLevel, (double) ((f2 + (float) width) * f), (double) ((f3 + 0.0F) * f1)); tessellator .getWorldRenderer() .addVertexWithUV( (double) (x), (double) (y), (double) itemRender.zLevel, (double) ((f2 + 0.0F) * f), (double) ((f3 + 0.0F) * f1)); tessellator.draw(); } }
protected void renderHUDText(int width, int height) { mc.mcProfiler.startSection("forgeHudText"); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); ArrayList<String> listL = new ArrayList<String>(); ArrayList<String> listR = new ArrayList<String>(); if (mc.isDemo()) { long time = mc.theWorld.getTotalWorldTime(); if (time >= 120500L) { listR.add(I18n.format("demo.demoExpired")); } else { listR.add( I18n.format( "demo.remainingTime", StringUtils.ticksToElapsedTime((int) (120500L - time)))); } } if (this.mc.gameSettings.showDebugInfo && !pre(DEBUG)) { listL.addAll(debugOverlay.getLeft()); listR.addAll(debugOverlay.getRight()); post(DEBUG); } RenderGameOverlayEvent.Text event = new RenderGameOverlayEvent.Text(eventParent, listL, listR); if (!MinecraftForge.EVENT_BUS.post(event)) { int top = 2; for (String msg : listL) { if (msg == null) continue; drawRect( 1, top - 1, 2 + fontrenderer.getStringWidth(msg) + 1, top + fontrenderer.FONT_HEIGHT - 1, -1873784752); fontrenderer.drawString(msg, 2, top, 14737632); top += fontrenderer.FONT_HEIGHT; } top = 2; for (String msg : listR) { if (msg == null) continue; int w = fontrenderer.getStringWidth(msg); int left = width - 2 - w; drawRect(left - 1, top - 1, left + w + 1, top + fontrenderer.FONT_HEIGHT - 1, -1873784752); fontrenderer.drawString(msg, left, top, 14737632); top += fontrenderer.FONT_HEIGHT; } } mc.mcProfiler.endSection(); post(TEXT); }
@SideOnly(Side.CLIENT) private static void renderEnderSky() { TextureManager renderEngine = Minecraft.getMinecraft().getTextureManager(); GL11.glDisable(GL11.GL_FOG); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); RenderHelper.disableStandardItemLighting(); GL11.glDepthMask(false); renderEngine.bindTexture(locationEndSkyPng); Tessellator tessellator = Tessellator.instance; for (int i = 0; i < 6; ++i) { GL11.glPushMatrix(); if (i == 1) { GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); } if (i == 2) { GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F); } if (i == 3) { GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F); } if (i == 4) { GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F); } if (i == 5) { GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F); } tessellator.startDrawingQuads(); tessellator.setColorOpaque_I(2631720); tessellator.addVertexWithUV(-100.0D, -100.0D, -100.0D, 0.0D, 0.0D); tessellator.addVertexWithUV(-100.0D, -100.0D, 100.0D, 0.0D, 16.0D); tessellator.addVertexWithUV(100.0D, -100.0D, 100.0D, 16.0D, 16.0D); tessellator.addVertexWithUV(100.0D, -100.0D, -100.0D, 16.0D, 0.0D); tessellator.draw(); GL11.glPopMatrix(); } GL11.glDepthMask(true); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_ALPHA_TEST); }
@Override public void drawButton(Minecraft minecraft, int mouseX, int mouseY) { if (this.visible) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); this.mouseDragged(minecraft, mouseX, mouseY); int textOffsetX = 0; if (this.chap != null) { if (this.chap.displayStack != null) { GL11.glPushMatrix(); BookletPage.renderItem( this.gui, this.chap.displayStack, this.xPosition - 4, this.yPosition, 0.725F); GL11.glPopMatrix(); textOffsetX = 10; } } if (this.field_146123_n) { GL11.glPushMatrix(); AssetUtil.drawHorizontalGradientRect( this.xPosition + textOffsetX - 1, this.yPosition + this.height - 1, this.xPosition + this.gui.getFontRenderer().getStringWidth(this.displayString) + textOffsetX + 1, this.yPosition + this.height, 0x80 << 24 | 22271, 22271); GL11.glPopMatrix(); } this.gui .getFontRenderer() .drawString( this.displayString, this.xPosition + textOffsetX, this.yPosition + (this.height - 8) / 2, 0); } }
private void renderEffectSlot(TextureManager manager, int x, int y) { GL11.glDepthFunc(GL11.GL_EQUAL); // GL11.glDisable(GL11.GL_LIGHTING); GL11.glDepthMask(false); manager.bindTexture(RES_ITEM_GLINT); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F); // this.renderGlintSlot(x * 431278612 + y * 32178161, x - 2, y - 2, 20, 20); this.renderGlintSlot(x, y, 150, 20); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glDepthMask(true); // GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); }
@Override public void drawButton(Minecraft mc, int p_146112_2_, int p_146112_3_) { if (this.visible) { FontRenderer fontrenderer = mc.fontRenderer; mc.getTextureManager().bindTexture(buttonTextures); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.field_146123_n = p_146112_2_ >= this.xPosition && p_146112_3_ >= this.yPosition && p_146112_2_ < this.xPosition + this.width && p_146112_3_ < this.yPosition + this.height; GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); this.drawTexturedModalRect( this.xPosition, this.yPosition, this.xOffset, this.yOffset, this.width, this.height); } }
public void drawButton(Minecraft mc, int mouseX, int mouseY) { if (this.visible) { this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; int flag1 = this.getHoverState(this.field_146123_n) - 1; mc.getTextureManager().bindTexture(buttonTextures); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); this.drawTexturedModalRect( this.xPosition, this.yPosition, flag1 * this.width, 26, this.width, this.height); this.mouseDragged(mc, mouseX, mouseY); } }
public void renderStabilizerSphere(TileParticleGenerator tile) { GL11.glPushMatrix(); // GL11.glColor4f(0.5F, 0.0F, 0.0F, 1F); GL11.glColor4f(0.0F, 2.0F, 0.0F, 1F); GL11.glTranslated(0.5, 0, 0.5); GL11.glScalef(0.4F, 0.4F, 0.4F); if (!tile.stabalizerMode) { float red = (float) tile.beam_red / 255F; float green = (float) tile.beam_green / 255F; float blue = (float) tile.beam_blue / 255F; GL11.glColor4f(red, green, blue, 1F); GL11.glScalef(tile.beam_scale, tile.beam_scale, tile.beam_scale); } OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 200, 200); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); FMLClientHandler.instance().getClient().getTextureManager().bindTexture(modelTexture); GL11.glRotatef(tile.rotation, 0F, 1F, 0F); stabilizerSphereModel.renderAll(); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 200, 200); GL11.glRotatef(tile.rotation * 2, 0F, -1F, 0F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDepthMask(false); GL11.glColor4f(0.0F, 1.0F, 1.0F, 0.5F); if (!tile.stabalizerMode) { float red = (float) tile.beam_red / 255F; float green = (float) tile.beam_green / 255F; float blue = (float) tile.beam_blue / 255F; GL11.glColor4f(red, green, blue, 0.5F); } GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glScalef(1.3F, 1.3F, 1.3F); stabilizerSphereModel.renderAll(); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); GL11.glPopMatrix(); }
/** Draws this button to the screen. */ public void drawButton(Minecraft p_146112_1_, int p_146112_2_, int p_146112_3_) { if (this.visible) { FontRenderer fontrenderer = p_146112_1_.fontRenderer; p_146112_1_.getTextureManager().bindTexture(buttonTextures); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.field_146123_n = p_146112_2_ >= this.xPosition && p_146112_3_ >= this.yPosition && p_146112_2_ < this.xPosition + this.width && p_146112_3_ < this.yPosition + this.height; int k = this.getHoverState(this.field_146123_n); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); this.drawTexturedModalRect( this.xPosition, this.yPosition, 0, 46 + k * 20, this.width / 2, this.height); this.drawTexturedModalRect( this.xPosition + this.width / 2, this.yPosition, 200 - this.width / 2, 46 + k * 20, this.width / 2, this.height); this.mouseDragged(p_146112_1_, p_146112_2_, p_146112_3_); int l = 14737632; if (packedFGColour != 0) { l = packedFGColour; } else if (!this.enabled) { l = 10526880; } else if (this.field_146123_n) { l = 16777120; } this.drawCenteredString( fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, l); } }
@Override public void drawButton(Minecraft minecraft, int x, int y) { if (this.visible) { minecraft.getTextureManager().bindTexture(GuiBooklet.resLoc); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.field_146123_n = x >= this.xPosition && y >= this.yPosition && x < this.xPosition + this.width && y < this.yPosition + this.height; int k = this.getHoverState(this.field_146123_n); if (k == 0) { k = 1; } GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); int renderHeight = 25; this.drawTexturedModalRect( this.xPosition, this.yPosition, 146 + (this.assignedEntry == null ? 0 : 16), 194 - renderHeight + k * renderHeight, this.width, renderHeight); this.mouseDragged(minecraft, x, y); if (this.assignedEntry != null) { GL11.glPushMatrix(); BookletPage.renderItem( booklet, this.assignedChapter != null && this.assignedChapter.displayStack != null ? this.assignedChapter.displayStack : new ItemStack(InitItems.itemLexicon), this.xPosition + 2, this.yPosition + 1, 0.725F); GL11.glPopMatrix(); } } }
@Override public void drawButton(Minecraft mc, int mouseX, int mouseY) { if (this.visible) { mc.getTextureManager().bindTexture(buttonTexture); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; int k = this.getHoverState(this.hovered); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); this.drawTexturedModalRect(this.xPosition, this.yPosition, 26 * k, 228, 26, 26); GL11.glDisable(GL11.GL_BLEND); this.mouseDragged(mc, mouseX, mouseY); mc.renderEngine.bindTexture(textureMap); this.drawTexturedModalRect(this.xPosition + 4, this.yPosition + 4, dx, dy, 18, 18); } }
/** Draws the main menu panorama */ private void drawPanorama(int p_73970_1_, int p_73970_2_, float p_73970_3_) { Tessellator var4 = Tessellator.instance; GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix(); GL11.glLoadIdentity(); Project.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDepthMask(false); OpenGlHelper.glBlendFunc(770, 771, 1, 0); byte var5 = 8; for (int var6 = 0; var6 < var5 * var5; ++var6) { GL11.glPushMatrix(); float var7 = ((float) (var6 % var5) / (float) var5 - 0.5F) / 64.0F; float var8 = ((float) (var6 / var5) / (float) var5 - 0.5F) / 64.0F; float var9 = 0.0F; GL11.glTranslatef(var7, var8, var9); GL11.glRotatef( MathHelper.sin(((float) this.panoramaTimer + p_73970_3_) / 400.0F) * 25.0F + 20.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(-((float) this.panoramaTimer + p_73970_3_) * 0.1F, 0.0F, 1.0F, 0.0F); for (int var10 = 0; var10 < 6; ++var10) { GL11.glPushMatrix(); if (var10 == 1) { GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); } if (var10 == 2) { GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); } if (var10 == 3) { GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); } if (var10 == 4) { GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); } if (var10 == 5) { GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F); } this.mc.getTextureManager().bindTexture(titlePanoramaPaths[var10]); var4.startDrawingQuads(); var4.setColorRGBA_I(16777215, 255 / (var6 + 1)); float var11 = 0.0F; var4.addVertexWithUV(-1.0D, -1.0D, 1.0D, (double) (0.0F + var11), (double) (0.0F + var11)); var4.addVertexWithUV(1.0D, -1.0D, 1.0D, (double) (1.0F - var11), (double) (0.0F + var11)); var4.addVertexWithUV(1.0D, 1.0D, 1.0D, (double) (1.0F - var11), (double) (1.0F - var11)); var4.addVertexWithUV(-1.0D, 1.0D, 1.0D, (double) (0.0F + var11), (double) (1.0F - var11)); var4.draw(); GL11.glPopMatrix(); } GL11.glPopMatrix(); GL11.glColorMask(true, true, true, false); } var4.setTranslation(0.0D, 0.0D, 0.0D); GL11.glColorMask(true, true, true, true); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPopMatrix(); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_DEPTH_TEST); }
public static void renderAllIEConnections(float partial) { if (connectionsRendered) return; GL11.glPushMatrix(); GL11.glDisable(GL11.GL_CULL_FACE); // GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glShadeModel(GL11.GL_SMOOTH); RenderHelper.enableStandardItemLighting(); Tessellator.instance.startDrawing(GL11.GL_QUADS); EntityLivingBase viewer = ClientUtils.mc().renderViewEntity; double dx = viewer.lastTickPosX + (viewer.posX - viewer.lastTickPosX) * partial; // (double)event.partialTicks; double dy = viewer.lastTickPosY + (viewer.posY - viewer.lastTickPosY) * partial; // (double)event.partialTicks; double dz = viewer.lastTickPosZ + (viewer.posZ - viewer.lastTickPosZ) * partial; // (double)event.partialTicks; for (Object o : ClientUtils.mc().renderGlobal.tileEntities) if (o instanceof IImmersiveConnectable) { TileEntity tile = (TileEntity) o; // int lb = tile.getWorldObj().getLightBrightnessForSkyBlocks(tile.xCoord, tile.yCoord, // tile.zCoord, 0); // int lb_j = lb % 65536; // int lb_k = lb / 65536; // OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)lb_j / // 1.0F, (float)lb_k / 1.0F); Tessellator.instance.setTranslation(tile.xCoord - dx, tile.yCoord - dy, tile.zCoord - dz); // GL11.glTranslated((tile.xCoord+.5-dx), (tile.yCoord+.5-dy), (tile.zCoord+.5-dz)); ClientUtils.renderAttachedConnections((TileEntity) tile); // GL11.glTranslated(-(tile.xCoord+.5-dx), -(tile.yCoord+.5-dy), -(tile.zCoord+.5-dz)); } Iterator<ImmersiveNetHandler.Connection> it = skyhookGrabableConnections.iterator(); World world = viewer.worldObj; while (it.hasNext()) { ImmersiveNetHandler.Connection con = it.next(); Tessellator.instance.setTranslation( con.start.posX - dx, con.start.posY - dy, con.start.posZ - dz); double r = con.cableType.getRenderDiameter() / 2; ClientUtils.drawConnection( con, Utils.toIIC(con.start, world), Utils.toIIC(con.end, world), 0x00ff99, 128, r * 1.75); } Tessellator.instance.setTranslation(0, 0, 0); Tessellator.instance.draw(); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glPopMatrix(); connectionsRendered = true; }
public static void renderItem(EntityLivingBase entity, ItemStack itemStack, int renderPass) { TextureManager texturemanager = FMLClientHandler.instance().getClient().getTextureManager(); Item item = itemStack.getItem(); Block block = Block.getBlockFromItem(item); GL11.glPushMatrix(); if (itemStack.getItemSpriteNumber() == 0 && item instanceof ItemBlock && RenderBlocks.renderItemIn3d(block.getRenderType())) { texturemanager.bindTexture(texturemanager.getResourceLocation(0)); if (itemStack != null && block != null && block.getRenderBlockPass() != 0) { GL11.glDepthMask(false); RenderHelper.BLOCK_RENDERER.renderBlockAsItem(block, itemStack.getItemDamage(), 1.0F); GL11.glDepthMask(true); } else { RenderHelper.BLOCK_RENDERER.renderBlockAsItem(block, itemStack.getItemDamage(), 1.0F); } } else { IIcon iicon = entity.getItemIcon(itemStack, renderPass); if (iicon == null) { GL11.glPopMatrix(); return; } texturemanager.bindTexture( texturemanager.getResourceLocation(itemStack.getItemSpriteNumber())); TextureUtil.func_152777_a(false, false, 1.0F); Tessellator tessellator = Tessellator.instance; float minU = iicon.getMinU(); float maxU = iicon.getMaxU(); float minV = iicon.getMinV(); float maxV = iicon.getMaxV(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glTranslatef(0.0F, -0.3F, 0.0F); GL11.glScalef(1.5F, 1.5F, 1.5F); GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F); ItemRenderer.renderItemIn2D( tessellator, maxU, minV, minU, maxV, iicon.getIconWidth(), iicon.getIconHeight(), 0.0625F); if (itemStack.hasEffect(renderPass)) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); texturemanager.bindTexture(RenderHelper.RES_ITEM_GLINT); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(768, 1, 1, 0); GL11.glColor4f(0.38F, 0.19F, 0.608F, 1.0F); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glPushMatrix(); GL11.glScalef(0.125F, 0.125F, 0.125F); float animOffset = Minecraft.getSystemTime() % 3000L / 3000.0F * 8.0F; GL11.glTranslatef(animOffset, 0.0F, 0.0F); GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(0.125F, 0.125F, 0.125F); animOffset = Minecraft.getSystemTime() % 4873L / 4873.0F * 8.0F; GL11.glTranslatef(-animOffset, 0.0F, 0.0F); GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); texturemanager.bindTexture( texturemanager.getResourceLocation(itemStack.getItemSpriteNumber())); TextureUtil.func_147945_b(); } if (itemStack != null && block != null && block.getRenderBlockPass() != 0) { GL11.glDisable(GL11.GL_BLEND); } GL11.glPopMatrix(); }
private void renderBeam(Tessellator tess, TileParticleGenerator tile, float f) { int x = 0; int y = 0; int z = 0; double length = tile.beam_length; float red = (float) tile.beam_red / 255F; float green = (float) tile.beam_green / 255F; float blue = (float) tile.beam_blue / 255F; GL11.glPushMatrix(); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); bindTexture(beamTexture); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); OpenGlHelper.glBlendFunc(770, 1, 1, 0); // float time = (float)tile.getWorldObj().getTotalWorldTime() + f; float time = tile.rotation + f; float upMot = -time * 0.2F - (float) MathHelper.floor_float(-time * 0.1F); float rotValue = tile.beam_rotation * (tile.rotation + f * 0.5F); double rotation = rotValue; tess.startDrawingQuads(); tess.setBrightness(200); tess.setColorRGBA(tile.beam_red, tile.beam_green, tile.beam_blue, 32); double scale = (double) tile.beam_scale * 0.2D; double d7 = 0.5D + Math.cos(rotation + 2.356194490192345D) * scale; // x point 1 double d9 = 0.5D + Math.sin(rotation + 2.356194490192345D) * scale; // z point 1 double d11 = 0.5D + Math.cos(rotation + (Math.PI / 4D)) * scale; // x point 2 double d13 = 0.5D + Math.sin(rotation + (Math.PI / 4D)) * scale; // z point 2 double d15 = 0.5D + Math.cos(rotation + 3.9269908169872414D) * scale; // Dist from x-3 double d17 = 0.5D + Math.sin(rotation + 3.9269908169872414D) * scale; double d19 = 0.5D + Math.cos(rotation + 5.497787143782138D) * scale; double d21 = 0.5D + Math.sin(rotation + 5.497787143782138D) * scale; double height = (double) (length); double texXMin = 0.0D; double texXMax = 1.0D; double d28 = (double) (-1.0F + upMot); double texHeight = (double) (length) * (0.5D / scale) + d28; tess.addVertexWithUV(x + d7, y + height, z + d9, texXMax, texHeight); tess.addVertexWithUV(x + d7, y, z + d9, texXMax, d28); tess.addVertexWithUV(x + d11, y, z + d13, texXMin, d28); tess.addVertexWithUV(x + d11, y + height, z + d13, texXMin, texHeight); tess.addVertexWithUV(x + d19, y + height, z + d21, texXMax, texHeight); tess.addVertexWithUV(x + d19, y, z + d21, texXMax, d28); tess.addVertexWithUV(x + d15, y, z + d17, texXMin, d28); tess.addVertexWithUV(x + d15, y + height, z + d17, texXMin, texHeight); tess.addVertexWithUV(x + d11, y + height, z + d13, texXMax, texHeight); tess.addVertexWithUV(x + d11, y, z + d13, texXMax, d28); tess.addVertexWithUV(x + d19, y, z + d21, texXMin, d28); tess.addVertexWithUV(x + d19, y + height, z + d21, texXMin, texHeight); tess.addVertexWithUV(x + d15, y + height, z + d17, texXMax, texHeight); tess.addVertexWithUV(x + d15, y, z + d17, texXMax, d28); tess.addVertexWithUV(x + d7, y, z + d9, texXMin, d28); tess.addVertexWithUV(x + d7, y + height, z + d9, texXMin, texHeight); rotation += 0.77f; d7 = 0.5D + Math.cos(rotation + 2.356194490192345D) * scale; d9 = 0.5D + Math.sin(rotation + 2.356194490192345D) * scale; d11 = 0.5D + Math.cos(rotation + (Math.PI / 4D)) * scale; d13 = 0.5D + Math.sin(rotation + (Math.PI / 4D)) * scale; d15 = 0.5D + Math.cos(rotation + 3.9269908169872414D) * scale; d17 = 0.5D + Math.sin(rotation + 3.9269908169872414D) * scale; d19 = 0.5D + Math.cos(rotation + 5.497787143782138D) * scale; d21 = 0.5D + Math.sin(rotation + 5.497787143782138D) * scale; d28 = (-1F + (upMot * 1)); texHeight = (double) (length) * (0.5D / scale) + d28; tess.setColorRGBA_F(red, green, blue, 1f); tess.addVertexWithUV(x + d7, y + height, z + d9, texXMax, texHeight); tess.addVertexWithUV(x + d7, y, z + d9, texXMax, d28); tess.addVertexWithUV(x + d11, y, z + d13, texXMin, d28); tess.addVertexWithUV(x + d11, y + height, z + d13, texXMin, texHeight); tess.addVertexWithUV(x + d19, y + height, z + d21, texXMax, texHeight); tess.addVertexWithUV(x + d19, y, z + d21, texXMax, d28); tess.addVertexWithUV(x + d15, y, z + d17, texXMin, d28); tess.addVertexWithUV(x + d15, y + height, z + d17, texXMin, texHeight); tess.addVertexWithUV(x + d11, y + height, z + d13, texXMax, texHeight); tess.addVertexWithUV(x + d11, y, z + d13, texXMax, d28); tess.addVertexWithUV(x + d19, y, z + d21, texXMin, d28); tess.addVertexWithUV(x + d19, y + height, z + d21, texXMin, texHeight); tess.addVertexWithUV(x + d15, y + height, z + d17, texXMax, texHeight); tess.addVertexWithUV(x + d15, y, z + d17, texXMax, d28); tess.addVertexWithUV(x + d7, y, z + d9, texXMin, d28); tess.addVertexWithUV(x + d7, y + height, z + d9, texXMin, texHeight); tess.draw(); GL11.glPushMatrix(); // GL11.glTranslated(0, 0.4, 0); // length -= 0.5F; GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glDepthMask(false); GL11.glTranslated(0.5, 0, 0.5); GL11.glScalef(tile.beam_scale, 1f, tile.beam_scale); GL11.glTranslated(-0.5, -0, -0.5); tess.startDrawingQuads(); tess.setColorRGBA(tile.beam_red, tile.beam_green, tile.beam_blue, 32); double d30 = 0.2D; double d4 = 0.2D; double d6 = 0.8D; double d8 = 0.2D; double d10 = 0.2D; double d12 = 0.8D; double d14 = 0.8D; double d16 = 0.8D; double d18 = (double) (length); double d20 = 0.0D; double d22 = 1D; double d24 = (double) (-1.0F + upMot); double d26 = (double) (length) + d24; tess.addVertexWithUV(x + d30, y + d18, z + d4, d22, d26); tess.addVertexWithUV(x + d30, y, z + d4, d22, d24); tess.addVertexWithUV(x + d6, y, z + d8, d20, d24); tess.addVertexWithUV(x + d6, y + d18, z + d8, d20, d26); tess.addVertexWithUV(x + d14, y + d18, z + d16, d22, d26); tess.addVertexWithUV(x + d14, y, z + d16, d22, d24); tess.addVertexWithUV(x + d10, y, z + d12, d20, d24); tess.addVertexWithUV(x + d10, y + d18, z + d12, d20, d26); tess.addVertexWithUV(x + d6, y + d18, z + d8, d22, d26); tess.addVertexWithUV(x + d6, y, z + d8, d22, d24); tess.addVertexWithUV(x + d14, y, z + d16, d20, d24); tess.addVertexWithUV(x + d14, y + d18, z + d16, d20, d26); tess.addVertexWithUV(x + d10, y + d18, z + d12, d22, d26); tess.addVertexWithUV(x + d10, y, z + d12, d22, d24); tess.addVertexWithUV(x + d30, y, z + d4, d20, d24); tess.addVertexWithUV(x + d30, y + d18, z + d4, d20, d26); tess.draw(); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(true); // // GL11.glEnable(GL11.GL_LIGHTING); // GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); }
/** Draws the main menu panorama */ private void drawPanorama(int par1, int par2, float par3) { Tessellator tessellator = Tessellator.instance; GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix(); GL11.glLoadIdentity(); Project.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDepthMask(false); OpenGlHelper.glBlendFunc(770, 771, 1, 0); byte b0 = 8; for (int k = 0; k < b0 * b0; ++k) { GL11.glPushMatrix(); float f1 = ((float) (k % b0) / (float) b0 - 0.5F) / 64.0F; float f2 = ((float) (k / b0) / (float) b0 - 0.5F) / 64.0F; float f3 = 0.0F; GL11.glTranslatef(f1, f2, f3); GL11.glRotatef( MathHelper.sin(((float) this.panoramaTimer + par3) / 400.0F) * 25.0F + 20.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(-((float) this.panoramaTimer + par3) * 0.1F, 0.0F, 1.0F, 0.0F); for (int l = 0; l < 6; ++l) { GL11.glPushMatrix(); if (l == 1) { GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); } if (l == 2) { GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); } if (l == 3) { GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); } if (l == 4) { GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); } if (l == 5) { GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F); } this.mc.getTextureManager().bindTexture(titlePanoramaPaths[l]); tessellator.startDrawingQuads(); tessellator.setColorRGBA_I(16777215, 255 / (k + 1)); float f4 = 0.0F; tessellator.addVertexWithUV(-1.0D, -1.0D, 1.0D, (double) (0.0F + f4), (double) (0.0F + f4)); tessellator.addVertexWithUV(1.0D, -1.0D, 1.0D, (double) (1.0F - f4), (double) (0.0F + f4)); tessellator.addVertexWithUV(1.0D, 1.0D, 1.0D, (double) (1.0F - f4), (double) (1.0F - f4)); tessellator.addVertexWithUV(-1.0D, 1.0D, 1.0D, (double) (0.0F + f4), (double) (1.0F - f4)); tessellator.draw(); GL11.glPopMatrix(); } GL11.glPopMatrix(); GL11.glColorMask(true, true, true, false); } tessellator.setTranslation(0.0D, 0.0D, 0.0D); GL11.glColorMask(true, true, true, true); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPopMatrix(); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_DEPTH_TEST); }
protected void doRenderItem( ItemRenderType type, ItemStack item, Item iconItem, FluidStack fluid) { IIcon icon = iconItem.getIcon(item, 0); IIcon mask = iconItem.getIcon(item, 1); boolean hasFluid = fluid != null; IIcon fluidIcon = hasFluid ? fluid.getFluid().getIcon(fluid) : mask; int fluidSheet = hasFluid ? fluid.getFluid().getSpriteNumber() : 0; int colorMult = hasFluid ? fluid.getFluid().getColor(fluid) : 0xFFFFFF; boolean isFloaty = hasFluid ? fluid.getFluid().getDensity(fluid) < 0 : false; if (fluid == null) { fluidIcon = Blocks.flowing_lava.getIcon(2, 0); fluidSheet = 0; colorMult = 0x3F3F3F; } GL11.glPushMatrix(); Tessellator tessellator = Tessellator.instance; float iconMinX = icon.getMinU(); float iconMaxX = icon.getMaxU(); float iconMinY = icon.getMinV(); float iconMaxY = icon.getMaxV(); float maskMinX = mask.getMinU(); float maskMaxX = mask.getMaxU(); float maskMinY = mask.getMinV(); float maskMaxY = mask.getMaxV(); float fluidMinX = fluidIcon.getMinU(); float fluidMaxX = fluidIcon.getMaxU(); float fluidMinY = fluidIcon.getMinV(); float fluidMaxY = fluidIcon.getMaxV(); if (isFloaty && canFlip) { iconMaxY = icon.getMinV(); iconMinY = icon.getMaxV(); maskMaxY = mask.getMinV(); maskMinY = mask.getMaxV(); fluidMaxY = fluidIcon.getMinV(); fluidMinY = fluidIcon.getMaxV(); } GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); OpenGlHelper.glBlendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); int texture = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D); if (type == ItemRenderType.INVENTORY) { GL11.glDisable(GL11.GL_LIGHTING); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(0, 16, 0, iconMinX, iconMaxY); tessellator.addVertexWithUV(16, 16, 0, iconMaxX, iconMaxY); tessellator.addVertexWithUV(16, 0, 0, iconMaxX, iconMinY); tessellator.addVertexWithUV(0, 0, 0, iconMinX, iconMinY); tessellator.draw(); if (hasFluid) { tessellator.startDrawingQuads(); tessellator.addVertexWithUV(0, 16, 0.001, maskMinX, maskMaxY); tessellator.addVertexWithUV(16, 16, 0.001, maskMaxX, maskMaxY); tessellator.addVertexWithUV(16, 0, 0.001, maskMaxX, maskMinY); tessellator.addVertexWithUV(0, 0, 0.001, maskMinX, maskMinY); tessellator.draw(); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDepthMask(false); GL11.glMatrixMode(GL11.GL_TEXTURE); bindTexture(RenderHelper.engine(), fluidSheet); OpenGlHelper.glBlendFunc(GL11.GL_ONE, GL11.GL_ZERO, GL11.GL_ONE, GL11.GL_ZERO); tessellator.startDrawingQuads(); tessellator.setColorOpaque_I(colorMult); tessellator.addVertexWithUV(0, 16, 0.001, fluidMinX, fluidMaxY); tessellator.addVertexWithUV(16, 16, 0.001, fluidMaxX, fluidMaxY); tessellator.addVertexWithUV(16, 0, 0.001, fluidMaxX, fluidMinY); tessellator.addVertexWithUV(0, 0, 0.001, fluidMinX, fluidMinY); tessellator.draw(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDepthMask(true); GL11.glDepthFunc(GL11.GL_LEQUAL); } GL11.glEnable(GL11.GL_LIGHTING); } else { GL11.glEnable(GL12.GL_RESCALE_NORMAL); if (type == ItemRenderType.ENTITY) { GL11.glTranslatef(0.5f, 4 / -16f, 0); GL11.glRotatef(180, 0, 1, 0); } ItemRenderer.renderItemIn2D( tessellator, iconMaxX, iconMinY, iconMinX, iconMaxY, icon.getIconWidth(), icon.getIconHeight(), 0.0625F); if (hasFluid) { tessellator.startDrawingQuads(); tessellator.setNormal(0, 0, 1); tessellator.addVertexWithUV(0, 0, 0.001, maskMaxX, maskMaxY); tessellator.addVertexWithUV(1, 0, 0.001, maskMinX, maskMaxY); tessellator.addVertexWithUV(1, 1, 0.001, maskMinX, maskMinY); tessellator.addVertexWithUV(0, 1, 0.001, maskMaxX, maskMinY); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0, 0, -1); tessellator.addVertexWithUV(0, 1, -0.0635, maskMinX, maskMinY); tessellator.addVertexWithUV(1, 1, -0.0635, maskMaxX, maskMinY); tessellator.addVertexWithUV(1, 0, -0.0635, maskMaxX, maskMaxY); tessellator.addVertexWithUV(0, 0, -0.0635, maskMinX, maskMaxY); tessellator.draw(); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDepthMask(false); bindTexture(RenderHelper.engine(), fluidSheet); OpenGlHelper.glBlendFunc(GL11.GL_ONE, GL11.GL_ZERO, GL11.GL_ONE, GL11.GL_ZERO); tessellator.startDrawingQuads(); tessellator.setNormal(0, 0, 1); tessellator.setColorOpaque_I(colorMult); tessellator.addVertexWithUV(0, 0, 0.001, fluidMaxX, fluidMaxY); tessellator.addVertexWithUV(1, 0, 0.001, fluidMinX, fluidMaxY); tessellator.addVertexWithUV(1, 1, 0.001, fluidMinX, fluidMinY); tessellator.addVertexWithUV(0, 1, 0.001, fluidMaxX, fluidMinY); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0, 0, -1); tessellator.setColorOpaque_I(colorMult); tessellator.addVertexWithUV(0, 1, -0.0635, fluidMinX, fluidMinY); tessellator.addVertexWithUV(1, 1, -0.0635, fluidMaxX, fluidMinY); tessellator.addVertexWithUV(1, 0, -0.0635, fluidMaxX, fluidMaxY); tessellator.addVertexWithUV(0, 0, -0.0635, fluidMinX, fluidMaxY); tessellator.draw(); GL11.glDepthMask(true); GL11.glDepthFunc(GL11.GL_LEQUAL); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); } GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture); OpenGlHelper.glBlendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glPopMatrix(); }
// public static ArrayListMultimap<ChunkCoordinates, AxisAlignedBB> additionalBlockBounds = // ArrayListMultimap.create(); // public static void addAdditionalBlockBounds(ChunkCoordinates cc, AxisAlignedBB aabb) // { // for(AxisAlignedBB aabb1 : additionalBlockBounds.get(cc)) // if(aabb1.toString().equals(aabb.toString())) // return; // additionalBlockBounds.put(cc, aabb); // } @SubscribeEvent() public void renderAdditionalBlockBounds(DrawBlockHighlightEvent event) { if (event.subID == 0 && event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { float f1 = 0.002F; double d0 = event.player.lastTickPosX + (event.player.posX - event.player.lastTickPosX) * (double) event.partialTicks; double d1 = event.player.lastTickPosY + (event.player.posY - event.player.lastTickPosY) * (double) event.partialTicks; double d2 = event.player.lastTickPosZ + (event.player.posZ - event.player.lastTickPosZ) * (double) event.partialTicks; // if(additionalBlockBounds.containsKey(new // ChunkCoordinates(event.target.blockX,event.target.blockY,event.target.blockZ))) if (event.player.worldObj.getBlock( event.target.blockX, event.target.blockY, event.target.blockZ) instanceof IEBlockInterfaces.ICustomBoundingboxes) { ChunkCoordinates cc = new ChunkCoordinates(event.target.blockX, event.target.blockY, event.target.blockZ); IEBlockInterfaces.ICustomBoundingboxes block = (IEBlockInterfaces.ICustomBoundingboxes) event.player.worldObj.getBlock( event.target.blockX, event.target.blockY, event.target.blockZ); Set<AxisAlignedBB> set = block.addCustomSelectionBoxesToList( event.player.worldObj, cc.posX, cc.posY, cc.posZ, event.player); if (!set.isEmpty()) { // // if(!(event.player.worldObj.getTileEntity(event.target.blockX,event.target.blockY,event.target.blockZ) instanceof IEBlockInterfaces.ICustomBoundingboxes)) // { // additionalBlockBounds.removeAll(cc); // return; // } GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.4F); GL11.glLineWidth(2.0F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(false); for (AxisAlignedBB aabb : set) // for(AxisAlignedBB aabb : additionalBlockBounds.get(cc)) if (aabb != null) RenderGlobal.drawOutlinedBoundingBox( aabb.getOffsetBoundingBox(cc.posX, cc.posY, cc.posZ) .expand((double) f1, (double) f1, (double) f1) .getOffsetBoundingBox(-d0, -d1, -d2), -1); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); event.setCanceled(true); } } ItemStack stack = event.player.getCurrentEquippedItem(); World world = event.player.worldObj; if (stack != null && stack.getItem() instanceof ItemDrill && ((ItemDrill) stack.getItem()) .isEffective( world .getBlock(event.target.blockX, event.target.blockY, event.target.blockZ) .getMaterial())) { ItemStack head = ((ItemDrill) stack.getItem()).getHead(stack); if (head != null) { int side = event.target.sideHit; int diameter = ((IDrillHead) head.getItem()).getMiningSize(head) + ((ItemDrill) stack.getItem()).getUpgrades(stack).getInteger("size"); int depth = ((IDrillHead) head.getItem()).getMiningDepth(head) + ((ItemDrill) stack.getItem()).getUpgrades(stack).getInteger("depth"); int startX = event.target.blockX; int startY = event.target.blockY; int startZ = event.target.blockZ; if (diameter % 2 == 0) // even numbers { float hx = (float) event.target.hitVec.xCoord - event.target.blockX; float hy = (float) event.target.hitVec.yCoord - event.target.blockY; float hz = (float) event.target.hitVec.zCoord - event.target.blockZ; if ((side < 2 && hx < .5) || (side < 4 && hx < .5)) startX -= diameter / 2; if (side > 1 && hy < .5) startY -= diameter / 2; if ((side < 2 && hz < .5) || (side > 3 && hz < .5)) startZ -= diameter / 2; } else // odd numbers { startX -= (side == 4 || side == 5 ? 0 : diameter / 2); startY -= (side == 0 || side == 1 ? 0 : diameter / 2); startZ -= (side == 2 || side == 3 ? 0 : diameter / 2); } GL11.glColor4f(0.1F, 0.1F, 0.1F, 0.4F); GL11.glLineWidth(1F); GL11.glDisable(GL11.GL_TEXTURE_2D); // AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(startX,startY,startZ, // startX+(side==4||side==5?1:diameter),startY+(side==0||side==1?1:diameter),startZ+(side==2||side==3?1: diameter)); // RenderGlobal.drawOutlinedBoundingBox(aabb.expand((double)f1, (double)f1, // (double)f1).getOffsetBoundingBox(-d0, -d1, -d2), -1); for (int dd = 0; dd < depth; dd++) for (int dw = 0; dw < diameter; dw++) for (int dh = 0; dh < diameter; dh++) { int x = startX + (side == 4 || side == 5 ? dd : dw); int y = startY + (side == 0 || side == 1 ? dd : dh); int z = startZ + (side == 0 || side == 1 ? dh : side == 4 || side == 5 ? dw : dd); Block block = event.player.worldObj.getBlock(x, y, z); if (block != null && !block.isAir(world, x, y, z) && block.getPlayerRelativeBlockHardness(event.player, world, x, y, z) != 0) { if (!((ItemDrill) stack.getItem()) .canBreakExtraBlock( world, block, x, y, z, world.getBlockMetadata(x, y, z), event.player, stack, head, false)) continue; AxisAlignedBB aabb = block.getSelectedBoundingBoxFromPool(event.player.worldObj, x, y, z); if (aabb != null) { RenderGlobal.drawOutlinedBoundingBox( aabb.expand((double) f1, (double) f1, (double) f1) .getOffsetBoundingBox(-d0, -d1, -d2), -1); } } } GL11.glDepthMask(true); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); } } } }
@SideOnly(Side.CLIENT) public static void renderClouds( GenericWorldProvider provider, DimensionInformation information, float partialTicks) { GL11.glDisable(GL11.GL_CULL_FACE); Minecraft mc = Minecraft.getMinecraft(); TextureManager renderEngine = mc.getTextureManager(); float f1 = (float) (mc.renderViewEntity.lastTickPosY + (mc.renderViewEntity.posY - mc.renderViewEntity.lastTickPosY) * partialTicks); Tessellator tessellator = Tessellator.instance; float f2 = 12.0F; float f3 = 4.0F; RenderGlobal renderGlobal = mc.renderGlobal; double d0 = (CloudRenderAccessHelper.getCloudTickCounter(renderGlobal) + partialTicks); double entityX = mc.renderViewEntity.prevPosX + (mc.renderViewEntity.posX - mc.renderViewEntity.prevPosX) * partialTicks; double entityZ = mc.renderViewEntity.prevPosZ + (mc.renderViewEntity.posZ - mc.renderViewEntity.prevPosZ) * partialTicks; double d1 = (entityX + d0 * 0.029999999329447746D) / f2; double d2 = entityZ / f2 + 0.33000001311302185D; float y = provider.getCloudHeight() - f1 + 0.33F; int i = MathHelper.floor_double(d1 / 2048.0D); int j = MathHelper.floor_double(d2 / 2048.0D); d1 -= (i * 2048); d2 -= (j * 2048); renderEngine.bindTexture(locationCloudsPng); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); Vec3 vec3 = provider.worldObj.getCloudColour(partialTicks); float red = (float) vec3.xCoord; float green = (float) vec3.yCoord; float blue = (float) vec3.zCoord; float f8; float f9; float f10; if (mc.gameSettings.anaglyph) { f8 = (red * 30.0F + green * 59.0F + blue * 11.0F) / 100.0F; f9 = (red * 30.0F + green * 70.0F) / 100.0F; f10 = (red * 30.0F + blue * 70.0F) / 100.0F; red = f8; green = f9; blue = f10; } f10 = 0.00390625F; f8 = MathHelper.floor_double(d1) * f10; f9 = MathHelper.floor_double(d2) * f10; float f11 = (float) (d1 - MathHelper.floor_double(d1)); float f12 = (float) (d2 - MathHelper.floor_double(d2)); byte b0 = 8; byte b1 = 4; float f13 = 9.765625E-4F; GL11.glScalef(f2, 1.0F, f2); float cr = information.getSkyDescriptor().getCloudColorFactorR(); float cg = information.getSkyDescriptor().getCloudColorFactorG(); float cb = information.getSkyDescriptor().getCloudColorFactorB(); boolean randomColors = information.isPatreonBitSet(Patreons.PATREON_KENNEY); for (int k = 0; k < 2; ++k) { if (k == 0) { GL11.glColorMask(false, false, false, false); } else if (mc.gameSettings.anaglyph) { if (EntityRenderer.anaglyphField == 0) { GL11.glColorMask(false, true, true, true); } else { GL11.glColorMask(true, false, false, true); } } else { GL11.glColorMask(true, true, true, true); } for (int l = -b1 + 1; l <= b1; ++l) { for (int i1 = -b1 + 1; i1 <= b1; ++i1) { tessellator.startDrawingQuads(); float u = (l * b0); float v = (i1 * b0); float x = u - f11; float z = v - f12; if (randomColors) { // cr = (float) ((u % 10.0f) / 10.0f); // cg = (float) (((u + v) % 10.0f) / 10.0f); // cb = (float) ((v % 10.0f) / 10.0f); cr = x % 1.0f; cg = (x + z) % 1.0f; cb = z % 1.0f; } if (y > -f3 - 1.0F) { tessellator.setColorRGBA_F(red * 0.7F * cr, green * 0.7F * cg, blue * 0.7F * cb, 0.8F); tessellator.setNormal(0.0F, -1.0F, 0.0F); tessellator.addVertexWithUV( (x + 0.0F), (y + 0.0F), (z + b0), ((u + 0.0F) * f10 + f8), ((v + b0) * f10 + f9)); tessellator.addVertexWithUV( (x + b0), (y + 0.0F), (z + b0), ((u + b0) * f10 + f8), ((v + b0) * f10 + f9)); tessellator.addVertexWithUV( (x + b0), (y + 0.0F), (z + 0.0F), ((u + b0) * f10 + f8), ((v + 0.0F) * f10 + f9)); tessellator.addVertexWithUV( (x + 0.0F), (y + 0.0F), (z + 0.0F), ((u + 0.0F) * f10 + f8), ((v + 0.0F) * f10 + f9)); } if (y <= f3 + 1.0F) { tessellator.setColorRGBA_F(red * cr, green * cg, blue * cb, 0.8F); tessellator.setNormal(0.0F, 1.0F, 0.0F); tessellator.addVertexWithUV( (x + 0.0F), (y + f3 - f13), (z + b0), ((u + 0.0F) * f10 + f8), ((v + b0) * f10 + f9)); tessellator.addVertexWithUV( (x + b0), (y + f3 - f13), (z + b0), ((u + b0) * f10 + f8), ((v + b0) * f10 + f9)); tessellator.addVertexWithUV( (x + b0), (y + f3 - f13), (z + 0.0F), ((u + b0) * f10 + f8), ((v + 0.0F) * f10 + f9)); tessellator.addVertexWithUV( (x + 0.0F), (y + f3 - f13), (z + 0.0F), ((u + 0.0F) * f10 + f8), ((v + 0.0F) * f10 + f9)); } tessellator.setColorRGBA_F(red * 0.9F * cr, green * 0.9F * cg, blue * 0.9F * cb, 0.8F); int j1; if (l > -1) { tessellator.setNormal(-1.0F, 0.0F, 0.0F); for (j1 = 0; j1 < b0; ++j1) { tessellator.addVertexWithUV( (x + j1 + 0.0F), (y + 0.0F), (z + b0), ((u + j1 + 0.5F) * f10 + f8), ((v + b0) * f10 + f9)); tessellator.addVertexWithUV( (x + j1 + 0.0F), (y + f3), (z + b0), ((u + j1 + 0.5F) * f10 + f8), ((v + b0) * f10 + f9)); tessellator.addVertexWithUV( (x + j1 + 0.0F), (y + f3), (z + 0.0F), ((u + j1 + 0.5F) * f10 + f8), ((v + 0.0F) * f10 + f9)); tessellator.addVertexWithUV( (x + j1 + 0.0F), (y + 0.0F), (z + 0.0F), ((u + j1 + 0.5F) * f10 + f8), ((v + 0.0F) * f10 + f9)); } } if (l <= 1) { tessellator.setNormal(1.0F, 0.0F, 0.0F); for (j1 = 0; j1 < b0; ++j1) { tessellator.addVertexWithUV( (x + j1 + 1.0F - f13), (y + 0.0F), (z + b0), ((u + j1 + 0.5F) * f10 + f8), ((v + b0) * f10 + f9)); tessellator.addVertexWithUV( (x + j1 + 1.0F - f13), (y + f3), (z + b0), ((u + j1 + 0.5F) * f10 + f8), ((v + b0) * f10 + f9)); tessellator.addVertexWithUV( (x + j1 + 1.0F - f13), (y + f3), (z + 0.0F), ((u + j1 + 0.5F) * f10 + f8), ((v + 0.0F) * f10 + f9)); tessellator.addVertexWithUV( (x + j1 + 1.0F - f13), (y + 0.0F), (z + 0.0F), ((u + j1 + 0.5F) * f10 + f8), ((v + 0.0F) * f10 + f9)); } } tessellator.setColorRGBA_F(red * 0.8F * cr, green * 0.8F * cg, blue * 0.8F * cb, 0.8F); if (i1 > -1) { tessellator.setNormal(0.0F, 0.0F, -1.0F); for (j1 = 0; j1 < b0; ++j1) { tessellator.addVertexWithUV( (x + 0.0F), (y + f3), (z + j1 + 0.0F), ((u + 0.0F) * f10 + f8), ((v + j1 + 0.5F) * f10 + f9)); tessellator.addVertexWithUV( (x + b0), (y + f3), (z + j1 + 0.0F), ((u + b0) * f10 + f8), ((v + j1 + 0.5F) * f10 + f9)); tessellator.addVertexWithUV( (x + b0), (y + 0.0F), (z + j1 + 0.0F), ((u + b0) * f10 + f8), ((v + j1 + 0.5F) * f10 + f9)); tessellator.addVertexWithUV( (x + 0.0F), (y + 0.0F), (z + j1 + 0.0F), ((u + 0.0F) * f10 + f8), ((v + j1 + 0.5F) * f10 + f9)); } } if (i1 <= 1) { tessellator.setNormal(0.0F, 0.0F, 1.0F); for (j1 = 0; j1 < b0; ++j1) { tessellator.addVertexWithUV( (x + 0.0F), (y + f3), (z + j1 + 1.0F - f13), ((u + 0.0F) * f10 + f8), ((v + j1 + 0.5F) * f10 + f9)); tessellator.addVertexWithUV( (x + b0), (y + f3), (z + j1 + 1.0F - f13), ((u + b0) * f10 + f8), ((v + j1 + 0.5F) * f10 + f9)); tessellator.addVertexWithUV( (x + b0), (y + 0.0F), (z + j1 + 1.0F - f13), ((u + b0) * f10 + f8), ((v + j1 + 0.5F) * f10 + f9)); tessellator.addVertexWithUV( (x + 0.0F), (y + 0.0F), (z + j1 + 1.0F - f13), ((u + 0.0F) * f10 + f8), ((v + j1 + 0.5F) * f10 + f9)); } } tessellator.draw(); } } } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_CULL_FACE); }
private static void renderCelestialBodies( float partialTickTime, DimensionInformation information, WorldClient world, TextureManager renderEngine, Tessellator tessellator) { List<CelestialBodyDescriptor> celestialBodies = information.getCelestialBodyDescriptors(); GL11.glEnable(GL11.GL_TEXTURE_2D); OpenGlHelper.glBlendFunc(770, 1, 1, 0); GL11.glPushMatrix(); float f6 = 1.0F - world.getRainStrength(partialTickTime); ResourceLocation sun = getSun(information); ResourceLocation moon = getMoon(information); if (celestialBodies.isEmpty()) { GL11.glColor4f(1.0F, 1.0F, 1.0F, f6); GL11.glTranslatef(0.0F, 0.0F, 0.0F); GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(world.getCelestialAngle(partialTickTime) * 360.0F, 1.0F, 0.0F, 0.0F); float f10 = 30.0F; renderEngine.bindTexture(sun); tessellator.startDrawingQuads(); tessellator.addVertexWithUV((-f10), 100.0D, (-f10), 0.0D, 0.0D); tessellator.addVertexWithUV(f10, 100.0D, (-f10), 1.0D, 0.0D); tessellator.addVertexWithUV(f10, 100.0D, f10, 1.0D, 1.0D); tessellator.addVertexWithUV((-f10), 100.0D, f10, 0.0D, 1.0D); tessellator.draw(); f10 = 20.0F; float f14, f15, f16, f17; renderEngine.bindTexture(moon); if (!moon.equals(locationMoonPhasesPng)) { f14 = 0.0f; f15 = 0.0f; f16 = 1.0f; f17 = 1.0f; } else { int k = world.getMoonPhase(); int l = k % 4; int i1 = k / 4 % 2; f14 = (l + 0) / 4.0F; f15 = (i1 + 0) / 2.0F; f16 = (l + 1) / 4.0F; f17 = (i1 + 1) / 2.0F; } tessellator.startDrawingQuads(); tessellator.addVertexWithUV((-f10), -100.0D, f10, f16, f17); tessellator.addVertexWithUV(f10, -100.0D, f10, f14, f17); tessellator.addVertexWithUV(f10, -100.0D, (-f10), f14, f15); tessellator.addVertexWithUV((-f10), -100.0D, (-f10), f16, f15); tessellator.draw(); } else { Random random = new Random(world.getSeed()); for (CelestialBodyDescriptor body : celestialBodies) { float offset = 0.0f; float factor = 1.0f; float yangle = -90.0f; if (!body.isMain()) { offset = random.nextFloat() * 200.0f; factor = random.nextFloat() * 3.0f; yangle = random.nextFloat() * 180.0f; } switch (body.getType()) { case BODY_NONE: break; case BODY_SUN: GL11.glColor4f(1.0F, 1.0F, 1.0F, f6); renderSun( partialTickTime, world, renderEngine, tessellator, offset, factor, yangle, 30.0F, sun); break; case BODY_LARGESUN: GL11.glColor4f(1.0F, 1.0F, 1.0F, f6); renderSun( partialTickTime, world, renderEngine, tessellator, offset, factor, yangle, 80.0F, sun); break; case BODY_SMALLSUN: GL11.glColor4f(1.0F, 1.0F, 1.0F, f6); renderSun( partialTickTime, world, renderEngine, tessellator, offset, factor, yangle, 10.0F, sun); break; case BODY_REDSUN: GL11.glColor4f(1.0F, 0.0F, 0.0F, f6); renderSun( partialTickTime, world, renderEngine, tessellator, offset, factor, yangle, 30.0F, sun); break; case BODY_MOON: GL11.glColor4f(1.0F, 1.0F, 1.0F, f6); renderMoon( partialTickTime, world, renderEngine, tessellator, offset, factor, yangle, 20.0F, moon); break; case BODY_LARGEMOON: GL11.glColor4f(1.0F, 1.0F, 1.0F, f6); renderMoon( partialTickTime, world, renderEngine, tessellator, offset, factor, yangle, 60.0F, moon); break; case BODY_SMALLMOON: GL11.glColor4f(1.0F, 1.0F, 1.0F, f6); renderMoon( partialTickTime, world, renderEngine, tessellator, offset, factor, yangle, 10.0F, moon); break; case BODY_REDMOON: GL11.glColor4f(1.0F, 0.0F, 0.0F, f6); renderMoon( partialTickTime, world, renderEngine, tessellator, offset, factor, yangle, 20.0F, moon); break; case BODY_PLANET: GL11.glColor4f(1.0F, 1.0F, 1.0F, f6); renderPlanet( partialTickTime, world, renderEngine, tessellator, offset, factor, yangle, 10.0F); break; case BODY_LARGEPLANET: GL11.glColor4f(1.0F, 1.0F, 1.0F, f6); renderPlanet( partialTickTime, world, renderEngine, tessellator, offset, factor, yangle, 30.0F); break; } } } GL11.glDisable(GL11.GL_TEXTURE_2D); float f18 = world.getStarBrightness(partialTickTime) * f6; if (f18 > 0.0F) { GL11.glColor4f(f18, f18, f18, f18); GL11.glCallList(starGLCallList); } 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); }
/** Renders the sky with the partial tick time. Args: partialTickTime */ @SideOnly(Side.CLIENT) private static void renderSky(float partialTickTime, DimensionInformation information) { initialize(); EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer; WorldClient world = Minecraft.getMinecraft().theWorld; TextureManager renderEngine = Minecraft.getMinecraft().getTextureManager(); GL11.glDisable(GL11.GL_TEXTURE_2D); Vec3 vec3 = world.getSkyColor(player, partialTickTime); float skyRed = (float) vec3.xCoord; float skyGreen = (float) vec3.yCoord; float skyBlue = (float) vec3.zCoord; float f6; boolean anaglyph = Minecraft.getMinecraft().gameSettings.anaglyph; if (anaglyph) { float f4 = (skyRed * 30.0F + skyGreen * 59.0F + skyBlue * 11.0F) / 100.0F; float f5 = (skyRed * 30.0F + skyGreen * 70.0F) / 100.0F; f6 = (skyRed * 30.0F + skyBlue * 70.0F) / 100.0F; skyRed = f4; skyGreen = f5; skyBlue = f6; } GL11.glColor3f(skyRed, skyGreen, skyBlue); Tessellator tessellator = Tessellator.instance; GL11.glDepthMask(false); GL11.glEnable(GL11.GL_FOG); GL11.glColor3f(skyRed, skyGreen, skyBlue); GL11.glCallList(glSkyList); GL11.glDisable(GL11.GL_FOG); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); RenderHelper.disableStandardItemLighting(); float[] sunsetColors = world.provider.calcSunriseSunsetColors( world.getCelestialAngle(partialTickTime), partialTickTime); float f7; float f8; float f9; float f10; if (sunsetColors != null) { 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(world.getCelestialAngleRadians(partialTickTime)) < 0.0F ? 180.0F : 0.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F); f6 = sunsetColors[0]; f7 = sunsetColors[1]; f8 = sunsetColors[2]; float f11; if (anaglyph) { f9 = (f6 * 30.0F + f7 * 59.0F + f8 * 11.0F) / 100.0F; f10 = (f6 * 30.0F + f7 * 70.0F) / 100.0F; f11 = (f6 * 30.0F + f8 * 70.0F) / 100.0F; f6 = f9; f7 = f10; f8 = f11; } tessellator.startDrawing(6); tessellator.setColorRGBA_F(f6, f7, f8, sunsetColors[3]); tessellator.addVertex(0.0D, 100.0D, 0.0D); byte b0 = 16; tessellator.setColorRGBA_F(sunsetColors[0], sunsetColors[1], sunsetColors[2], 0.0F); for (int j = 0; j <= b0; ++j) { f11 = j * (float) Math.PI * 2.0F / b0; float f12 = MathHelper.sin(f11); float f13 = MathHelper.cos(f11); tessellator.addVertex((f12 * 120.0F), (f13 * 120.0F), (-f13 * 40.0F * sunsetColors[3])); } tessellator.draw(); GL11.glPopMatrix(); GL11.glShadeModel(GL11.GL_FLAT); } renderCelestialBodies(partialTickTime, information, world, renderEngine, tessellator); GL11.glColor3f(0.0F, 0.0F, 0.0F); double d0 = player.getPosition(partialTickTime).yCoord - world.getHorizon(); if (d0 < 0.0D) { GL11.glPushMatrix(); GL11.glTranslatef(0.0F, 12.0F, 0.0F); GL11.glCallList(glSkyList2); GL11.glPopMatrix(); f8 = 1.0F; f9 = -((float) (d0 + 65.0D)); f10 = -f8; tessellator.startDrawingQuads(); tessellator.setColorRGBA_I(0, 255); tessellator.addVertex((-f8), f9, f8); tessellator.addVertex(f8, f9, f8); tessellator.addVertex(f8, f10, f8); tessellator.addVertex((-f8), f10, f8); tessellator.addVertex((-f8), f10, (-f8)); tessellator.addVertex(f8, f10, (-f8)); tessellator.addVertex(f8, f9, (-f8)); tessellator.addVertex((-f8), f9, (-f8)); tessellator.addVertex(f8, f10, (-f8)); tessellator.addVertex(f8, f10, f8); tessellator.addVertex(f8, f9, f8); tessellator.addVertex(f8, f9, (-f8)); tessellator.addVertex((-f8), f9, (-f8)); tessellator.addVertex((-f8), f9, f8); tessellator.addVertex((-f8), f10, f8); tessellator.addVertex((-f8), f10, (-f8)); tessellator.addVertex((-f8), f10, (-f8)); tessellator.addVertex((-f8), f10, f8); tessellator.addVertex(f8, f10, f8); tessellator.addVertex(f8, f10, (-f8)); tessellator.draw(); } if (world.provider.isSkyColored()) { GL11.glColor3f(skyRed * 0.2F + 0.04F, skyGreen * 0.2F + 0.04F, skyBlue * 0.6F + 0.1F); } else { GL11.glColor3f(skyRed, skyGreen, skyBlue); } GL11.glPushMatrix(); GL11.glTranslatef(0.0F, -((float) (d0 - 16.0D)), 0.0F); GL11.glCallList(glSkyList2); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(true); }
@SideOnly(Side.CLIENT) private static void renderSkyTexture(ResourceLocation sky, ResourceLocation sky2, int type) { TextureManager renderEngine = Minecraft.getMinecraft().getTextureManager(); GL11.glDisable(GL11.GL_FOG); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); RenderHelper.disableStandardItemLighting(); GL11.glDepthMask(false); Tessellator tessellator = Tessellator.instance; for (int i = 0; i < 6; ++i) { GL11.glPushMatrix(); UV[] uv = faceDown; int col = 0xffffff; if (i == 0) { // Down face uv = faceDown; switch (type) { case SKYTYPE_ALL: renderEngine.bindTexture(sky); break; case SKYTYPE_ALLHORIZONTAL: case SKYTYPE_ALTERNATING: renderEngine.bindTexture(sky2); break; default: col = 0; break; } } else if (i == 1) { // North face renderEngine.bindTexture(sky); GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); uv = faceNorth; } else if (i == 2) { // South face renderEngine.bindTexture(sky); GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F); uv = faceSouth; } else if (i == 3) { // Up face GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F); uv = faceUp; switch (type) { case SKYTYPE_ALL: renderEngine.bindTexture(sky); break; case SKYTYPE_ALLHORIZONTAL: case SKYTYPE_ALTERNATING: renderEngine.bindTexture(sky2); break; default: col = 0; break; } } else if (i == 4) { // East face if (type == SKYTYPE_ALTERNATING && sky2 != null) { renderEngine.bindTexture(sky2); } else { renderEngine.bindTexture(sky); } GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F); uv = faceEast; } else if (i == 5) { // West face if (type == SKYTYPE_ALTERNATING && sky2 != null) { renderEngine.bindTexture(sky2); } else { renderEngine.bindTexture(sky); } GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F); uv = faceWest; } tessellator.startDrawingQuads(); tessellator.setColorOpaque_I(col); tessellator.addVertexWithUV(-100.0D, -100.0D, -100.0D, uv[0].u, uv[0].v); tessellator.addVertexWithUV(-100.0D, -100.0D, 100.0D, uv[1].u, uv[1].v); tessellator.addVertexWithUV(100.0D, -100.0D, 100.0D, uv[2].u, uv[2].v); tessellator.addVertexWithUV(100.0D, -100.0D, -100.0D, uv[3].u, uv[3].v); tessellator.draw(); GL11.glPopMatrix(); } GL11.glDepthMask(true); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_ALPHA_TEST); }