public static void drawPlayerOnGui( Minecraft par0Minecraft, int par1, int par2, int par3, float par4, float par5) { GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glPushMatrix(); GL11.glTranslatef((float) par1, (float) par2, 50.0F); GL11.glScalef((float) (-par3), (float) par3, (float) par3); GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); float f2 = par0Minecraft.thePlayer.renderYawOffset; float f3 = par0Minecraft.thePlayer.rotationYaw; float f4 = par0Minecraft.thePlayer.rotationPitch; par4 -= 19; GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F); RenderHelper.enableStandardItemLighting(); GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-((float) Math.atan((double) (par5 / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F); par0Minecraft.thePlayer.renderYawOffset = (float) Math.atan((double) (par4 / 40.0F)) * 20.0F; par0Minecraft.thePlayer.rotationYaw = (float) Math.atan((double) (par4 / 40.0F)) * 40.0F; par0Minecraft.thePlayer.rotationPitch = -((float) Math.atan((double) (par5 / 40.0F))) * 20.0F; par0Minecraft.thePlayer.rotationYawHead = par0Minecraft.thePlayer.rotationYaw; GL11.glTranslatef(0.0F, par0Minecraft.thePlayer.yOffset, 0.0F); RenderManager.instance.playerViewY = 180.0F; RenderManager.instance.renderEntityWithPosYaw( par0Minecraft.thePlayer, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); par0Minecraft.thePlayer.renderYawOffset = f2; par0Minecraft.thePlayer.rotationYaw = f3; par0Minecraft.thePlayer.rotationPitch = f4; GL11.glPopMatrix(); RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); GL11.glDisable(GL11.GL_TEXTURE_2D); OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); }
public void drawPlayerOnGui( Minecraft par0Minecraft, int par1, int par2, int par3, float par4, float par5) { final float pitchBefore = par0Minecraft.thePlayer.rotationPitch; GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glPushMatrix(); GL11.glTranslatef(par1, par2, 50.0F); GL11.glScalef(-par3, par3, par3); GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); final float var6 = par0Minecraft.thePlayer.renderYawOffset; final float var7 = par0Minecraft.thePlayer.rotationYaw; final float var8 = par0Minecraft.thePlayer.rotationPitch; GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F); RenderHelper.enableStandardItemLighting(); GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-((float) Math.atan(this.rotation / 40.0F)) * 00.0F, 1.0F, 0.0F, 0.0F); par0Minecraft.thePlayer.renderYawOffset = this.rotation; par0Minecraft.thePlayer.rotationYaw = this.rotation; par0Minecraft.thePlayer.rotationPitch = 0; par0Minecraft.thePlayer.rotationYawHead = par0Minecraft.thePlayer.rotationYaw; GL11.glTranslatef(0.0F, par0Minecraft.thePlayer.yOffset, 0.0F); RenderManager.instance.playerViewY = 180.0F; RenderManager.instance.renderEntityWithPosYaw( par0Minecraft.thePlayer, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); par0Minecraft.thePlayer.renderYawOffset = var6; par0Minecraft.thePlayer.rotationYaw = var7; // par0Minecraft.thePlayer.rotationPitch = var8; GL11.glPopMatrix(); RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); GL11.glDisable(GL11.GL_TEXTURE_2D); OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); par0Minecraft.thePlayer.rotationPitch = pitchBefore; }
public void doRender( EntityTimeDisruption entity, double par2, double par3, double par4, float par5, float par6) { float f = -0.125F; float f1 = 0.025F; GL11.glPushMatrix(); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glTranslatef((float) par2, (float) par3 + f, (float) par4); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glScalef(0.85F, 0.85F, 0.85F); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_NORMALIZE); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); this.bindTexture(this.getEntityTexture(entity)); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glLoadIdentity(); float f2 = MathHelper.cos(f1 * 0.15F) * 0.56F; float f3 = f1 * 0.02F; GL11.glTranslatef(f2, f3, 0.0F); GL11.glEnable(GL11.GL_BLEND); GL11.glColor4f(1.1F, 1.6F, 1.1F, 0.35F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); GL11.glTranslatef(0.0F, 0.0F, 0.0F); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glLoadIdentity(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); this.model.render(entity, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, f1); GL11.glDepthMask(true); OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); GL11.glDisable(GL11.GL_TEXTURE_2D); OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL12.GL_RESCALE_NORMAL); OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); GL11.glEnable(GL11.GL_TEXTURE_2D); OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glPopMatrix(); }
@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 renderPart(int x, int y, int z, int scale, PartInfo partInfo) { GL11.glPushMatrix(); GL11.glTranslatef(x, y, z); GL11.glScalef(-scale, scale, 1F); RenderHelper.enableStandardItemLighting(); Minecraft.getMinecraft().getRenderManager().playerViewY = 180.0F; PartRegistry.getRenderPart(partInfo.partType, partInfo.typeid) .render(fakeEntity, partInfo, 0, 0, 0, 0); RenderHelper.disableStandardItemLighting(); OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); GL11.glDisable(GL11.GL_TEXTURE_2D); OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); GL11.glPopMatrix(); }
@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(); }
/** * Will render the specified entity at the specified partial tick time. Args: entity, * partialTickTime */ public void renderEntity(Entity par1Entity, float par2) { if (par1Entity.ticksExisted == 0) { par1Entity.lastTickPosX = par1Entity.posX; par1Entity.lastTickPosY = par1Entity.posY; par1Entity.lastTickPosZ = par1Entity.posZ; } double d0 = par1Entity.lastTickPosX + (par1Entity.posX - par1Entity.lastTickPosX) * (double) par2; double d1 = par1Entity.lastTickPosY + (par1Entity.posY - par1Entity.lastTickPosY) * (double) par2; double d2 = par1Entity.lastTickPosZ + (par1Entity.posZ - par1Entity.lastTickPosZ) * (double) par2; float f1 = par1Entity.prevRotationYaw + (par1Entity.rotationYaw - par1Entity.prevRotationYaw) * par2; int i = par1Entity.getBrightnessForRender(par2); if (par1Entity.isBurning()) { i = 15728880; } int j = i % 65536; int k = i / 65536; OpenGlHelper.setLightmapTextureCoords( OpenGlHelper.lightmapTexUnit, (float) j / 1.0F, (float) k / 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.renderEntityWithPosYaw( par1Entity, d0 - renderPosX, d1 - renderPosY, d2 - renderPosZ, f1, par2); }
protected int func_77097_a(EntitySpider p_77097_1_, int p_77097_2_, float p_77097_3_) { if (p_77097_2_ != 0) { return -1; } else { this.func_76985_a("/mob/spider_eyes.png"); float var4 = 1.0F; GL11.glEnable(3042); GL11.glDisable(3008); GL11.glBlendFunc(1, 1); if (p_77097_1_.func_82150_aj()) { GL11.glDepthMask(false); } else { GL11.glDepthMask(true); } char var5 = '\uf0f0'; int var6 = var5 % 65536; int var7 = var5 / 65536; OpenGlHelper.func_77475_a( OpenGlHelper.field_77476_b, (float) var6 / 1.0F, (float) var7 / 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, var4); return 1; } }
@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); } }
/** Sets the spider's glowing eyes */ protected int setSpiderEyeBrightness(EntitySpider par1EntitySpider, int par2, float par3) { if (par2 != 0) { return -1; } else { this.loadTexture("/mob/spider_eyes.png"); float f1 = 1.0F; GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); if (par1EntitySpider.isInvisible()) { GL11.glDepthMask(false); } else { GL11.glDepthMask(true); } char c0 = 61680; int j = c0 % 65536; int k = c0 / 65536; OpenGlHelper.setLightmapTextureCoords( OpenGlHelper.lightmapTexUnit, (float) j / 1.0F, (float) k / 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, f1); return 1; } }
@Override public void loadRenderers() { if (this.world != null) { this.displayListEntitiesDirty = true; this.renderDistanceChunks = ConfigurationHandler.renderDistance; final boolean vbo = this.vboEnabled; this.vboEnabled = OpenGlHelper.useVbo(); if (vbo && !this.vboEnabled) { initList(); } else if (!vbo && this.vboEnabled) { initVbo(); } if (this.viewFrustum != null) { this.viewFrustum.deleteGlResources(); } stopChunkUpdates(); this.viewFrustum = new ViewFrustumOverlay( this.world, this.renderDistanceChunks, this, this.renderChunkFactory); final double posX = PLAYER_POSITION_OFFSET.x; final double posZ = PLAYER_POSITION_OFFSET.z; this.viewFrustum.updateChunkPositions(posX, posZ); } }
/** Render the EvolvedEndermans eyes */ protected int renderEyes( SCSednaEntityEvolvedEnderman par1EntityEvolvedEnderman, int par2, float par3) { if (par2 != 0) { return -1; } else { this.bindTexture(EvolvedEndermanEyesTexture); float f1 = 1.0F; GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); GL11.glDisable(GL11.GL_LIGHTING); if (par1EntityEvolvedEnderman.isInvisible()) { GL11.glDepthMask(false); } else { GL11.glDepthMask(true); } char c0 = 61680; int j = c0 % 65536; int k = c0 / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j / 1.0F, k / 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(GL11.GL_LIGHTING); GL11.glColor4f(1.0F, 1.0F, 1.0F, f1); return 1; } }
@SideOnly(Side.CLIENT) @Override public int getColorFromItemStack(ItemStack stack, int renderPass) { OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 220f, 220f); // OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 61680f, 0f); return 16777215; }
/** 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 draw(int startX, int startY) { GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); RenderHelper.enableGUIStandardItemLighting(); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); ItemStack output = getOutputStack(); if (output != null) manager.gui.drawItemStack(output, startX + xPos, startY + yPos); // RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL11.GL_DEPTH_TEST); if (worktable.getMemory().isLocked(slotNumber)) { manager.gui.setZLevel(110f); Proxies.common.bindTexture(SpriteSheet.ITEMS); manager.gui.drawTexturedModelRectFromIcon( startX + xPos, startY + yPos, TextureManager.getInstance().getDefault("slots/locked"), 16, 16); manager.gui.setZLevel(0f); } GL11.glPopAttrib(); }
/** 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); }
public void renderSpinningCubes(int cubes, int repeat, int origRepeat) { GL11.glDisable(GL11.GL_TEXTURE_2D); final float modifier = 6F; final float rotationModifier = 0.2F; final float radiusBase = 0.35F; final float radiusMod = 0.05F; double ticks = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks - 1.3 * (origRepeat - repeat); float offsetPerCube = 360 / cubes; GL11.glPushMatrix(); GL11.glTranslatef(-0.025F, 0.85F, -0.025F); for (int i = 0; i < cubes; i++) { float offset = offsetPerCube * i; float deg = (int) (ticks / rotationModifier % 360F + offset); float rad = deg * (float) Math.PI / 180F; float radiusX = (float) (radiusBase + radiusMod * Math.sin(ticks / modifier)); float radiusZ = (float) (radiusBase + radiusMod * Math.cos(ticks / modifier)); float x = (float) (radiusX * Math.cos(rad)); float z = (float) (radiusZ * Math.sin(rad)); float y = (float) Math.cos((ticks + 50 * i) / 5F) / 10F; GL11.glPushMatrix(); GL11.glTranslatef(x, y, z); float xRotate = (float) Math.sin(ticks * rotationModifier) / 2F; float yRotate = (float) Math.max(0.6F, Math.sin(ticks * 0.1F) / 2F + 0.5F); float zRotate = (float) Math.cos(ticks * rotationModifier) / 2F; GL11.glRotatef(deg, xRotate, yRotate, zRotate); if (repeat < origRepeat) { GL11.glColor4f(1F, 1F, 1F, (float) repeat / (float) origRepeat * 0.4F); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_ALPHA_TEST); } else GL11.glColor4f(1F, 1F, 1F, 1F); int light = 15728880; int lightmapX = light % 65536; int lightmapY = light / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY); spinningCube.render(1F / 16F); if (repeat < origRepeat) { GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); } GL11.glPopMatrix(); } GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); if (repeat != 0) renderSpinningCubes(cubes, repeat - 1, origRepeat); }
private void adjustLightFixture(World w, int i, int j, int k, Block b) { Tessellator tess = Tessellator.instance; float brightness = b.getLightValue(w, i, j, k); int skyLight = w.getLightBrightnessForSkyBlocks(i, j, k, 0); int modulousModifier = skyLight % 65536; int divModifier = skyLight / 65536; tess.setColorOpaque_F(brightness, brightness, brightness); OpenGlHelper.setLightmapTextureCoords( OpenGlHelper.lightmapTexUnit, (float) modulousModifier, divModifier); }
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(); }
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(); } }
@Override public void doRenderLayer( EntityAntiSpider entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) { spiderRenderer.bindTexture(SPIDER_EYES); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.blendFunc(1, 1); if (entitylivingbaseIn.isInvisible()) GlStateManager.depthMask(false); else GlStateManager.depthMask(true); int i = 61680; int j = i % 65536; int k = i / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j / 1.0F, k / 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); spiderRenderer .getMainModel() .render( entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale); i = entitylivingbaseIn.getBrightnessForRender(partialTicks); j = i % 65536; k = i / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j / 1.0F, k / 1.0F); spiderRenderer.setLightmap(entitylivingbaseIn, partialTicks); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); }
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); }
@Override public void draw(int startX, int startY) { GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); RenderHelper.enableGUIStandardItemLighting(); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); manager.gui.drawItemStack(BOOK, startX + xPos, startY + yPos); GL11.glPopAttrib(); }
@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); }
public GuiMainMenu() { this.field_146972_A = field_96138_a; this.splashText = "missingno"; BufferedReader var1 = null; try { ArrayList var2 = new ArrayList(); var1 = new BufferedReader( new InputStreamReader( Minecraft.getMinecraft() .getResourceManager() .getResource(splashTexts) .getInputStream(), Charsets.UTF_8)); String var3; while ((var3 = var1.readLine()) != null) { var3 = var3.trim(); if (!var3.isEmpty()) { var2.add(var3); } } if (!var2.isEmpty()) { do { this.splashText = (String) var2.get(rand.nextInt(var2.size())); } while (this.splashText.hashCode() == 125780783); } } catch (IOException var12) {; } finally { if (var1 != null) { try { var1.close(); } catch (IOException var11) {; } } } this.updateCounter = rand.nextFloat(); this.field_92025_p = ""; if (!GLContext.getCapabilities().OpenGL20 && !OpenGlHelper.func_153193_b()) { this.field_92025_p = I18n.format("title.oldgl1", new Object[0]); this.field_146972_A = I18n.format("title.oldgl2", new Object[0]); this.field_104024_v = "https://help.mojang.com/customer/portal/articles/325948?ref=game"; } }
@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); }
public RenderSchematic(final Minecraft minecraft) { super(minecraft); this.mc = minecraft; this.profiler = minecraft.mcProfiler; this.renderManager = minecraft.getRenderManager(); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT); GlStateManager.bindTexture(0); this.vboEnabled = OpenGlHelper.useVbo(); if (this.vboEnabled) { initVbo(); } else { initList(); } }
@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); } }