public static void apply2(IBakedModel model, int color) { GlStateManager.enableAlpha(); GlStateManager.enableBlend(); GlStateManager.depthMask(false); GlStateManager.depthFunc(514); GlStateManager.disableLighting(); GlStateManager.blendFunc(SourceFactor.SRC_COLOR, DestFactor.ONE); Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("minecraft", "textures/misc/enchanted_item_glint.png")); GlStateManager.matrixMode(5890); GlStateManager.pushMatrix(); GlStateManager.scale(8.0F, 8.0F, 8.0F); float f = Minecraft.getSystemTime() % 3000L / 3000.0F / 8.0F; GlStateManager.translate(f, 0.0F, 0.0F); GlStateManager.rotate(-50.0F, 0.0F, 0.0F, 1.0F); RenderModel.render(model, color); GlStateManager.popMatrix(); GlStateManager.matrixMode(5888); GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager.enableLighting(); GlStateManager.depthFunc(515); GlStateManager.depthMask(true); Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); }
@Override public void draw(IGuiBase gui){ super.draw(gui); GlStateManager.enableBlend(); GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE); Minecraft.getMinecraft().getTextureManager().bindTexture(rl); float lifeCoeff = Math.min(1.0f,(float)lifetime/(float)maxLifetime); GlStateManager.color(r, g, b, a*lifeCoeff); int currentSize = (int)(this.size * lifeCoeff); int shiftedX = gui.getBaseX()+(int)(x+vx*Minecraft.getMinecraft().getRenderPartialTicks()); int shiftedY = gui.getBaseY()+(int)(y+vy*Minecraft.getMinecraft().getRenderPartialTicks()); drawTexturedModalRect(shiftedX-currentSize, shiftedY-currentSize, 2*currentSize, 2*currentSize, 0, 0, 32, 32); GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager.disableBlend(); GlStateManager.color(1f, 1f, 1f, 1f); }
public static void drawTextGlowing(FontRenderer font, String s, int x, int y, int r, int g, int b, int a){ GuiBase.drawTextRGBA(font, s, x, y, r, g, b, a); GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE); GuiBase.drawTextRGBA(font, s, x-1, y, r,g,b, (32*a)/255); GuiBase.drawTextRGBA(font, s, x+1, y, r,g,b, (32*a)/255); GuiBase.drawTextRGBA(font, s, x, y-1, r,g,b, (32*a)/255); GuiBase.drawTextRGBA(font, s, x, y+1, r,g,b, (32*a)/255); GuiBase.drawTextRGBA(font, s, x-2, y, r,g,b, (13*a)/255); GuiBase.drawTextRGBA(font, s, x+2, y, r,g,b, (13*a)/255); GuiBase.drawTextRGBA(font, s, x, y-2, r,g,b, (13*a)/255); GuiBase.drawTextRGBA(font, s, x, y+2, r,g,b, (13*a)/255); GuiBase.drawTextRGBA(font, s, x-1, y+1, r,g,b, (13*a)/255); GuiBase.drawTextRGBA(font, s, x+1, y-1, r,g,b, (13*a)/255); GuiBase.drawTextRGBA(font, s, x-1, y-1, r,g,b, (13*a)/255); GuiBase.drawTextRGBA(font, s, x+1, y+1, r,g,b, (13*a)/255); GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); }
@Override public void doRenderLayer(EntitySwet swet, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { this.slime.setModelAttributes(this.render.getMainModel()); this.slime.setLivingAnimations(swet, limbSwing, limbSwingAmount, partialTicks); GlStateManager.pushMatrix(); GlStateManager.enableNormalize(); GlStateManager.enableBlend(); GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); this.manager.renderEngine.bindTexture(this.render.getEntityTexture(swet)); this.slime.render(swet, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); GlStateManager.popMatrix(); }
@Override protected void renderModel(EntityDragonMinion par1EntityDragonMinion, float par2, float par3, float par4, float par5, float par6, float par7) { bindEntityTexture(par1EntityDragonMinion); GlStateManager.enableBlend(); GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); mainModel.render(par1EntityDragonMinion, par2, par3, par4, par5, par6, par7); GlStateManager.disableBlend(); if (par1EntityDragonMinion.hurtTime > 0) { GL11.glDepthFunc(GL11.GL_EQUAL); GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager.color(1.0F, 0.0F, 0.0F, 0.5F); mainModel.render(par1EntityDragonMinion, par2, par3, par4, par5, par6, par7); GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); GL11.glDepthFunc(GL11.GL_LEQUAL); } }
public void renderItem(int xPos, int yPos, ItemStack stack, int mx, int my) { if(stack == null || stack.isEmpty()) return; if(stack.getItemDamage() == OreDictionary.WILDCARD_VALUE) stack.setItemDamage(0); RenderItem render = Minecraft.getMinecraft().getRenderItem(); if(mx > xPos && mx < xPos+16 && my > yPos && my < yPos+16) tooltipStack = stack; GlStateManager.pushMatrix(); GlStateManager.enableBlend(); GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); RenderHelper.enableGUIStandardItemLighting(); GlStateManager.enableRescaleNormal(); GlStateManager.enableDepth(); render.renderItemAndEffectIntoGUI(stack, xPos, yPos); render.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, stack, xPos, yPos, null); RenderHelper.disableStandardItemLighting(); GlStateManager.popMatrix(); GlStateManager.disableLighting(); }
public void renderItem(int xPos, int yPos, ItemStack stack, int mx, int my) { if(stack == null || stack.isEmpty()) return; if(stack.getItemDamage() == OreDictionary.WILDCARD_VALUE) stack.setItemDamage(0); RenderItem render = Minecraft.getMinecraft().getRenderItem(); if(mx > xPos && mx < xPos+16 && my > yPos && my < yPos+16) tooltipStack = stack; GlStateManager.pushMatrix(); GlStateManager.enableBlend(); GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); RenderHelper.enableGUIStandardItemLighting(); GlStateManager.enableRescaleNormal(); GlStateManager.enableBlend(); render.renderItemAndEffectIntoGUI(stack, xPos, yPos); render.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, stack, xPos, yPos, null); RenderHelper.disableStandardItemLighting(); GlStateManager.popMatrix(); GlStateManager.disableLighting(); }
public void render(ItemStack stack, MapData data, boolean inFrame) { WirelessMapNodeStorage mapstorage = RedstoneEtherAddons.client().getMapNodes(); if (stack == null || stack.getItem() != ModItems.itemWirelessMap) { return; } ClientMapInfo mapinfo = RedstoneEtherAddons.client().getMPMapInfo((short) stack.getItemDamage()); if (mapinfo == null) { return; } CCRenderState ccrs = CCRenderState.instance(); GlStateManager.disableTexture2D(); GlStateManager.disableDepth(); GlStateManager.enableBlend(); GlStateManager.blendFunc(SourceFactor.ONE, DestFactor.ONE_MINUS_SRC_ALPHA); float light = 1; int xCenter = mapinfo.xCenter; int zCenter = mapinfo.zCenter; int scale = mapinfo.scale; ccrs.startDrawing(0x07, DefaultVertexFormats.POSITION_COLOR); renderPass(ccrs, xCenter, zCenter, scale, mapstorage, 0.75F, 1F, light * 0.5F); renderPass(ccrs, xCenter, zCenter, scale, mapstorage, 0.6F, 1F, light); ccrs.draw(); GlStateManager.enableTexture2D(); GlStateManager.enableDepth(); GlStateManager.disableBlend(); }
@Override public void doRender(EntityHorse entity, double x, double y, double z, float entityYaw, float partialTicks) { GlStateManager.pushMatrix(); GlStateManager.enableAlpha(); GlStateManager.enableBlend(); GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE); GlStateManager.color(1F, 1F, 1F, 0.5F); super.doRender(entity, x, y, z, entityYaw, partialTicks); GlStateManager.popMatrix(); GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); }
public static void drawGradientRect(double left, double top, double zLevel, double right, double bottom, int startColor, int endColor) { float f = (startColor >> 24 & 255) / 255.0F; float f1 = (startColor >> 16 & 255) / 255.0F; float f2 = (startColor >> 8 & 255) / 255.0F; float f3 = (startColor & 255) / 255.0F; float f4 = (endColor >> 24 & 255) / 255.0F; float f5 = (endColor >> 16 & 255) / 255.0F; float f6 = (endColor >> 8 & 255) / 255.0F; float f7 = (endColor & 255) / 255.0F; GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.shadeModel(7425); Tessellator tessellator = Tessellator.getInstance(); VertexBuffer vertexbuffer = tessellator.getBuffer(); vertexbuffer.begin(7, DefaultVertexFormats.POSITION_COLOR); vertexbuffer.pos(right, top, zLevel).color(f1, f2, f3, f).endVertex(); vertexbuffer.pos(left, top, zLevel).color(f1, f2, f3, f).endVertex(); vertexbuffer.pos(left, bottom, zLevel).color(f5, f6, f7, f4).endVertex(); vertexbuffer.pos(right, bottom, zLevel).color(f5, f6, f7, f4).endVertex(); tessellator.draw(); GlStateManager.shadeModel(7424); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); GlStateManager.enableTexture2D(); }
public static void renderPoison(Minecraft mc) { PlayerAether playerAether = PlayerAether.get(mc.thePlayer); if(playerAether.isPoisoned()) { ScaledResolution scaledresolution = new ScaledResolution(mc); Tessellator tessellator = Tessellator.getInstance(); VertexBuffer renderer = tessellator.getBuffer(); float alpha = getPoisonAlpha((float)(playerAether.poisonInstance().poisonTime % 50) / 50F); int width = scaledresolution.getScaledWidth(); int height = scaledresolution.getScaledHeight(); GlStateManager.pushMatrix(); GlStateManager.enableBlend(); GlStateManager.disableDepth(); GlStateManager.depthMask(false); GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager.disableAlpha(); mc.renderEngine.bindTexture(TEXTURE_POISON_VIGNETTE); renderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); renderer.pos(0.0D, (double)height, -90.0D).tex(0.0D, 1.0D).color(0.5F, 0.5F, 0.5F, alpha).endVertex(); renderer.pos((double)width, (double)height, -90.0D).tex(1.0D, 1.0D).color(0.5F, 0.5F, 0.5F, alpha).endVertex(); renderer.pos((double)width, 0.0D, -90.0D).tex(1.0D, 0.0D).color(0.5F, 0.5F, 0.5F, alpha).endVertex(); renderer.pos(0.0D, 0.0D, -90.0D).tex(0.0D, 0.0D).color(0.5F, 0.5F, 0.5F, alpha).endVertex(); tessellator.draw(); GlStateManager.depthMask(true); GlStateManager.enableDepth(); GlStateManager.enableAlpha(); GlStateManager.disableBlend(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.popMatrix(); } }
public static void renderCure(Minecraft mc) { PlayerAether playerAether = PlayerAether.get(mc.thePlayer); if(playerAether.isCured()) { ScaledResolution scaledresolution = new ScaledResolution(mc); Tessellator tessellator = Tessellator.getInstance(); VertexBuffer renderer = tessellator.getBuffer(); float alpha = 0.5F; int width = scaledresolution.getScaledWidth(); int height = scaledresolution.getScaledHeight(); GlStateManager.pushMatrix(); GlStateManager.enableBlend(); GlStateManager.disableDepth(); GlStateManager.depthMask(false); GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager.disableAlpha(); mc.renderEngine.bindTexture(TEXTURE_CURE_VIGNETTE); renderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); renderer.pos(0.0D, (double)height, -90.0D).tex(0.0D, 1.0D).color(0.5F, 0.5F, 0.5F, alpha).endVertex(); renderer.pos((double)width, (double)height, -90.0D).tex(1.0D, 1.0D).color(0.5F, 0.5F, 0.5F, alpha).endVertex(); renderer.pos((double)width, 0.0D, -90.0D).tex(1.0D, 0.0D).color(0.5F, 0.5F, 0.5F, alpha).endVertex(); renderer.pos(0.0D, 0.0D, -90.0D).tex(0.0D, 0.0D).color(0.5F, 0.5F, 0.5F, alpha).endVertex(); tessellator.draw(); GlStateManager.depthMask(true); GlStateManager.enableDepth(); GlStateManager.enableAlpha(); GlStateManager.disableBlend(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.popMatrix(); } }
public static void renderIronBubble(Minecraft mc) { ScaledResolution scaledresolution = new ScaledResolution(mc); int width = scaledresolution.getScaledWidth(); int height = scaledresolution.getScaledHeight(); GlStateManager.pushMatrix(); GlStateManager.enableBlend(); GlStateManager.disableDepth(); GlStateManager.depthMask(false); GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.disableAlpha(); mc.renderEngine.bindTexture(Gui.ICONS); int bubbleAmount = PlayerAether.get(mc.thePlayer).getAccessoryCount(ItemsAether.iron_bubble); if (mc.playerController.shouldDrawHUD() && mc.thePlayer.isInWater() && mc.thePlayer.isInsideOfMaterial(Material.WATER)) { for (int i = 0; i < bubbleAmount; ++i) { drawTexturedModalRect((width / 2 - 8 * i) + 81, height - 49, 16, 18, 9, 9); } } GlStateManager.depthMask(true); GlStateManager.enableDepth(); GlStateManager.enableAlpha(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.popMatrix(); }
public static void renderCooldown(Minecraft mc) { PlayerAether playerInfo = PlayerAether.get(mc.thePlayer); if (playerInfo.getCooldown() != 0) { ScaledResolution scaledresolution = new ScaledResolution(mc); int cooldownRemaining = (int) ((float) (playerInfo.getCooldown()) / (float) (playerInfo.getCooldownMax()) * 128F); int width = scaledresolution.getScaledWidth(); mc.fontRendererObj.drawStringWithShadow(playerInfo.getCooldownName() + " Cooldown", (width / 2) - (mc.fontRendererObj.getStringWidth(playerInfo.getCooldownName() + " Cooldown") / 2), 32, 0xffffffff); GlStateManager.pushMatrix(); GlStateManager.enableBlend(); GlStateManager.disableDepth(); GlStateManager.depthMask(false); GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.disableAlpha(); mc.renderEngine.bindTexture(TEXTURE_COOLDOWN_BAR); drawTexturedModalRect(width / 2 - 64, 42, 0, 8, 128, 8); drawTexturedModalRect(width / 2 - 64, 42, 0, 0, cooldownRemaining, 8); GlStateManager.depthMask(true); GlStateManager.enableDepth(); GlStateManager.enableAlpha(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.popMatrix(); } }
public static void renderAetherPortal(float timeInPortal, ScaledResolution scaledRes) { if (timeInPortal < 1.0F) { timeInPortal = timeInPortal * timeInPortal; timeInPortal = timeInPortal * timeInPortal; timeInPortal = timeInPortal * 0.8F + 0.2F; } GlStateManager.disableAlpha(); GlStateManager.disableDepth(); GlStateManager.depthMask(false); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.color(1.0F, 1.0F, 1.0F, timeInPortal); Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); TextureAtlasSprite textureatlassprite = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(BlocksAether.aether_portal.getDefaultState()); float f = textureatlassprite.getMinU(); float f1 = textureatlassprite.getMinV(); float f2 = textureatlassprite.getMaxU(); float f3 = textureatlassprite.getMaxV(); Tessellator tessellator = Tessellator.getInstance(); VertexBuffer vertexbuffer = tessellator.getBuffer(); vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX); vertexbuffer.pos(0.0D, (double)scaledRes.getScaledHeight(), -90.0D).tex((double)f, (double)f3).endVertex(); vertexbuffer.pos((double)scaledRes.getScaledWidth(), (double)scaledRes.getScaledHeight(), -90.0D).tex((double)f2, (double)f3).endVertex(); vertexbuffer.pos((double)scaledRes.getScaledWidth(), 0.0D, -90.0D).tex((double)f2, (double)f1).endVertex(); vertexbuffer.pos(0.0D, 0.0D, -90.0D).tex((double)f, (double)f1).endVertex(); tessellator.draw(); GlStateManager.depthMask(true); GlStateManager.enableDepth(); GlStateManager.enableAlpha(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); }
@Override protected void renderModel(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor) { GlStateManager.enableBlend(); GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); super.renderModel(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor); GlStateManager.disableBlend(); }
@Override protected void renderModel(EntitySacthoth entitylivingbaseIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor) { GlStateManager.enableBlend(); GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); super.renderModel(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor); GlStateManager.disableBlend(); }
/** * Renders the dragon model. Called by renderModel. */ @Override protected void renderModel(EntityDragonBoss par1EntityDragonBoss, float par2, float par3, float par4, float par5, float par6, float par7) { if (par1EntityDragonBoss.deathTicks > 0) { float f6 = par1EntityDragonBoss.deathTicks / 200.0F; GL11.glDepthFunc(GL11.GL_LEQUAL); GlStateManager.enableAlpha(); GL11.glAlphaFunc(GL11.GL_GREATER, f6); bindTexture(field_110842_f); mainModel.render(par1EntityDragonBoss, par2, par3, par4, par5, par6, par7); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); GL11.glDepthFunc(GL11.GL_EQUAL); } bindEntityTexture(par1EntityDragonBoss); mainModel.render(par1EntityDragonBoss, par2, par3, par4, par5, par6, par7); if (par1EntityDragonBoss.hurtTime > 0) { GL11.glDepthFunc(GL11.GL_EQUAL); GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager.color(1.0F, 0.0F, 0.0F, 0.5F); mainModel.render(par1EntityDragonBoss, par2, par3, par4, par5, par6, par7); GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); GL11.glDepthFunc(GL11.GL_LEQUAL); } }
@Override protected void renderModel(EntityLesserShoggoth entitylivingbaseIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor) { if(entitylivingbaseIn.getShoggothType() < 4){ super.renderModel(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor); return; } GlStateManager.enableBlend(); GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); super.renderModel(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor); GlStateManager.disableBlend(); }
@Override @SideOnly(Side.CLIENT) public void renderHelmetOverlay(ItemStack stack, EntityPlayer player, ScaledResolution resolution, float partialTicks){ final ResourceLocation coraliumBlur = new ResourceLocation("abyssalcraft:textures/misc/coraliumblur.png"); if(Minecraft.getMinecraft().gameSettings.thirdPersonView == 0 && stack != null && stack.getItem() == ACItems.depths_helmet) { GlStateManager.disableDepth(); GlStateManager.depthMask(false); GlStateManager.enableBlend(); GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager.color(1.0F, 1.0F, 1.0F, (float)ACConfig.depthsHelmetOverlayOpacity); Minecraft.getMinecraft().renderEngine.bindTexture(coraliumBlur); Tessellator t = Tessellator.getInstance(); BufferBuilder wr = t.getBuffer(); wr.begin(7, DefaultVertexFormats.POSITION_TEX); wr.pos(0.0D, resolution.getScaledHeight(), 90.0D).tex(0.0D, 1.0D).endVertex();; wr.pos(resolution.getScaledWidth(), resolution.getScaledHeight(), 90.0D).tex(1.0D, 1.0D).endVertex();; wr.pos(resolution.getScaledWidth(), 0.0D, 90.0D).tex(1.0D, 0.0D).endVertex();; wr.pos(0.0D, 0.0D, 90.0D).tex(0.0D, 0.0D).endVertex();; t.draw(); GlStateManager.depthMask(true); GlStateManager.enableDepth(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); } }
public static void enableBlendAlphaStuffs() { GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate( SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ZERO, DestFactor.ONE); GlStateManager.disableTexture2D(); GlStateManager.shadeModel(GL11.GL_SMOOTH); }
public static void apply(IBakedModel model, int damage) { GlStateManager.enableAlpha(); GlStateManager.enableBlend(); GlStateManager.depthMask(false); GlStateManager.depthFunc(514); GlStateManager.disableLighting(); GlStateManager.blendFunc(SourceFactor.SRC_COLOR, DestFactor.ONE); Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("minecraft", "textures/misc/enchanted_item_glint.png")); GlStateManager.matrixMode(5890); GlStateManager.pushMatrix(); GlStateManager.scale(8.0F, 8.0F, 8.0F); float f = Minecraft.getSystemTime() % 3000L / 3000.0F / 8.0F; GlStateManager.translate(f, 0.0F, 0.0F); GlStateManager.rotate(-50.0F, 0.0F, 0.0F, 1.0F); switch (damage) { case 0: RenderModel.render(model, -10092544); break; case 1: RenderModel.render(model, -16777114); break; case 2: RenderModel.render(model, -10066330); break; case 3: RenderModel.render(model, -10066432); break; case 4: RenderModel.render(model, -12097946); break; case 5: RenderModel.render(model, -16751104); break; case 6: RenderModel.render(model, 0xFFFF0000); break; case 7: RenderModel.render(model, 0xFF0000FF); break; case -1: default: RenderModel.render(model, -8372020); } GlStateManager.popMatrix(); GlStateManager.matrixMode(5888); GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager.enableLighting(); GlStateManager.depthFunc(515); GlStateManager.depthMask(true); Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); }
/** * Renders floating lines of text in the 3D world at a specific position. * @param list The string list of text to render * @param x X coordinate in the game world * @param y Y coordinate in the game world * @param z Z coordinate in the game world * @param color * @param renderBlackBox render a pretty black border behind the text? * @param partialTickTime */ public static void renderFloatingText(List<String> list, double x, double y, double z, int color, boolean renderBlackBox, float partialTickTime, boolean ignorePitch) { Minecraft mc = Minecraft.getMinecraft(); RenderManager renderManager = mc.getRenderManager(); FontRenderer fontRenderer = mc.fontRendererObj; EntityPlayer clientPlayer = CrystalMod.proxy.getClientPlayer(); float playerX = (float) (clientPlayer.lastTickPosX + (clientPlayer.posX - clientPlayer.lastTickPosX) * partialTickTime); float playerY = (float) (clientPlayer.lastTickPosY + (clientPlayer.posY - clientPlayer.lastTickPosY) * partialTickTime); float playerZ = (float) (clientPlayer.lastTickPosZ + (clientPlayer.posZ - clientPlayer.lastTickPosZ) * partialTickTime); double dx = x-playerX; double dy = y-playerY; double dz = z-playerZ; float distance = (float) Math.sqrt(dx*dx + dy*dy + dz*dz); float multiplier = distance / 120f; float scale = 0.45f * multiplier; GlStateManager.color(1f, 1f, 1f, 0.5f); GlStateManager.pushMatrix(); GlStateManager.translate(dx, dy, dz); GlStateManager.rotate(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F); if(!ignorePitch)GlStateManager.rotate(renderManager.playerViewX, 1.0F, 0.0F, 0.0F); GlStateManager.scale(-scale, -scale, scale); GlStateManager.disableLighting(); GlStateManager.depthMask(false); GlStateManager.disableDepth(); GlStateManager.enableBlend(); GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); int textWidth = 0; for (String thisMessage : list) { int thisMessageWidth = fontRenderer.getStringWidth(thisMessage); if (thisMessageWidth > textWidth) textWidth = thisMessageWidth; } int lineHeight = 10; if(renderBlackBox) { Tessellator tessellator = Tessellator.getInstance(); VertexBuffer buffer = tessellator.getBuffer(); GlStateManager.disableTexture2D(); buffer.begin(7, DefaultVertexFormats.POSITION_COLOR); int stringMiddle = textWidth / 2; buffer.pos(-stringMiddle - 1, -1 + 0, 0.0D).color(0.0F, 0.0F, 0.0F, 0.5F).endVertex(); buffer.pos(-stringMiddle - 1, 8 + lineHeight*list.size()-lineHeight, 0.0D).color(0.0F, 0.0F, 0.0F, 0.5F).endVertex(); buffer.pos(stringMiddle + 1, 8 + lineHeight*list.size()-lineHeight, 0.0D).color(0.0F, 0.0F, 0.0F, 0.5F).endVertex(); buffer.pos(stringMiddle + 1, -1 + 0, 0.0D).color(0.0F, 0.0F, 0.0F, 0.5F).endVertex(); tessellator.draw(); GlStateManager.enableTexture2D(); } int i = 0; for(String message : list) { fontRenderer.drawString(message, -textWidth / 2, i*lineHeight, color); i++; } GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.depthMask(true); GlStateManager.enableDepth(); GlStateManager.popMatrix(); }
public static void renderBeam(double x1, double y1, double z1, double x2, double y2, double z2, int tick, float partialTicks, double beamWidth, int r, int g, int b, float alpha) { Tessellator tessy = Tessellator.getInstance(); VertexBuffer render = tessy.getBuffer(); Vec3d vec1 = new Vec3d(x1, y1, z1); Vec3d vec2 = new Vec3d(x2, y2, z2); Vec3d combinedVec = vec2.subtract(vec1); double rot = tick > 0 ? ((ClientEventHandler.elapsedTicks + partialTicks) * (tick)) % 360 : 0; double pitch = Math.atan2(combinedVec.yCoord, Math.sqrt(combinedVec.xCoord*combinedVec.xCoord+combinedVec.zCoord*combinedVec.zCoord)); double yaw = Math.atan2(-combinedVec.zCoord, combinedVec.xCoord); double length = combinedVec.lengthVector(); GlStateManager.pushMatrix(); GlStateManager.disableLighting(); GlStateManager.enableBlend(); GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE); int func = GL11.glGetInteger(GL11.GL_ALPHA_TEST_FUNC); float ref = GL11.glGetFloat(GL11.GL_ALPHA_TEST_REF); GlStateManager.alphaFunc(GL11.GL_ALWAYS, 0); GlStateManager.translate(x1-TileEntityRendererDispatcher.staticPlayerX, y1-TileEntityRendererDispatcher.staticPlayerY, z1-TileEntityRendererDispatcher.staticPlayerZ); GlStateManager.rotate((float)(180*yaw/Math.PI), 0, 1, 0); GlStateManager.rotate((float)(180*pitch/Math.PI), 0, 0, 1); GlStateManager.rotate((float)rot, 1, 0, 0); GlStateManager.disableTexture2D(); render.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR); final int MAX_LIGHT_X = 0xF000F0; final int MAX_LIGHT_Y = 0xF000F0; float red = r/255F, green = g/255F, blue = b/255F; for(double i = 0; i < 4; i++){ double width = beamWidth*(i/4.0); render.pos(length, width, width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(red, green, blue, alpha).endVertex(); render.pos(0, width, width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(red, green, blue, alpha).endVertex(); render.pos(0, -width, width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(red, green, blue, alpha).endVertex(); render.pos(length, -width, width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(red, green, blue, alpha).endVertex(); render.pos(length, -width, -width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(red, green, blue, alpha).endVertex(); render.pos(0, -width, -width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(red, green, blue, alpha).endVertex(); render.pos(0, width, -width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(red, green, blue, alpha).endVertex(); render.pos(length, width, -width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(red, green, blue, alpha).endVertex(); render.pos(length, width, -width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(red, green, blue, alpha).endVertex(); render.pos(0, width, -width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(red, green, blue, alpha).endVertex(); render.pos(0, width, width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(red, green, blue, alpha).endVertex(); render.pos(length, width, width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(red, green, blue, alpha).endVertex(); render.pos(length, -width, width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(red, green, blue, alpha).endVertex(); render.pos(0, -width, width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(red, green, blue, alpha).endVertex(); render.pos(0, -width, -width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(red, green, blue, alpha).endVertex(); render.pos(length, -width, -width).tex(0, 0).lightmap(MAX_LIGHT_X, MAX_LIGHT_Y).color(red, green, blue, alpha).endVertex(); } tessy.draw(); GlStateManager.enableTexture2D(); GlStateManager.alphaFunc(func, ref); GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager.disableBlend(); GlStateManager.enableLighting(); GlStateManager.popMatrix(); }