Java Code Examples for net.minecraft.client.renderer.GlStateManager#blendFunc()
The following examples show how to use
net.minecraft.client.renderer.GlStateManager#blendFunc() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OptionScrollPane.java From NotEnoughItems with MIT License | 6 votes |
public static void drawOverlayGrad(int x1, int x2, int y1, int y2, float zLevel) { GlStateManager.disableTexture2D(); GlStateManager.disableCull(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.shadeModel(GL11.GL_SMOOTH); WorldRenderer r = CCRenderState.startDrawing(); r.setColorRGBA_I(0, 255); r.addVertex(x2, y1, zLevel); r.addVertex(x1, y1, zLevel); r.setColorRGBA_I(0, 0); r.addVertex(x1, y2, zLevel); r.addVertex(x2, y2, zLevel); CCRenderState.draw(); GlStateManager.disableBlend(); GlStateManager.enableCull(); GlStateManager.enableTexture2D(); }
Example 2
Source File: ButtonGuiScale.java From SkyblockAddons with MIT License | 6 votes |
@Override public void drawButton(Minecraft mc, int mouseX, int mouseY) { mc.getTextureManager().bindTexture(buttonTextures); GlStateManager.color(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; GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.blendFunc(770, 771); int boxAlpha = 100; if (hovered) { boxAlpha = 170; } drawRect(this.xPosition, this.yPosition, this.xPosition+this.width, this.yPosition+this.height, main.getUtils().getDefaultColor(boxAlpha)); this.mouseDragged(mc, mouseX, mouseY); int j = 14737632; if (packedFGColour != 0) { j = packedFGColour; } else if (!this.enabled) { j = 10526880; } else if (this.hovered) { j = 16777120; } MinecraftReflection.FontRenderer.drawCenteredString(this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, j); }
Example 3
Source File: MetaTileEntityTESR.java From GregTech with GNU Lesser General Public License v3.0 | 6 votes |
private void renderTileEntityFastPart(MetaTileEntityHolder te, double x, double y, double z, float partialTicks, int destroyStage) { Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); RenderHelper.disableStandardItemLighting(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.enableBlend(); GlStateManager.disableCull(); if (Minecraft.isAmbientOcclusionEnabled()) { GlStateManager.shadeModel(GL11.GL_SMOOTH); } else { GlStateManager.shadeModel(GL11.GL_FLAT); } buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); renderTileEntityFast(te, x, y, z, partialTicks, destroyStage, partialTicks, buffer); buffer.setTranslation(0, 0, 0); tessellator.draw(); RenderHelper.enableStandardItemLighting(); }
Example 4
Source File: ModelSpiritBlight.java From Wizardry with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void render(@Nonnull Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { GlStateManager.disableBlend(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.color(1.0F, 1.0F, 1.0F, 0.9F); RandUtilSeed seed = new RandUtilSeed(entityIn.getDataManager().get(DATA_SHIFT_SEED) + 1); GlStateManager.translate(seed.nextDouble(-3, 3), seed.nextDouble(-3, 3), seed.nextDouble(-3, 3)); double multiplier = 0.05; GlStateManager.translate(RandUtil.nextFloat() * multiplier, RandUtil.nextFloat() * multiplier, RandUtil.nextFloat() * multiplier); super.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); GlStateManager.disableBlend(); }
Example 5
Source File: RenderSphere.java From YouTubeModdingTutorial with MIT License | 6 votes |
@Override public void doRender(EntitySphere entity, double x, double y, double z, float entityYaw, float partialTicks) { GlStateManager.depthMask(false); GlStateManager.pushMatrix(); GlStateManager.translate((float)x, (float)y, (float)z); rotateToPlayer(); // ---------------------------------------- this.bindTexture(sphere); GlStateManager.enableRescaleNormal(); GlStateManager.color(1.0f, 1.0f, 1.0f); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_ONE, GL11.GL_ONE); long t = System.currentTimeMillis() % 6; renderBillboardQuad(0.3f, t * (1.0f / 6.0f), (1.0f / 6.0f)); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.depthMask(true); GlStateManager.popMatrix(); }
Example 6
Source File: RenderEnderminy.java From EnderZoo with Creative Commons Zero v1.0 Universal | 6 votes |
@Override public void doRenderLayer(EntityEnderminy em, float p_177201_2_, float p_177201_3_, float p_177201_4_, float p_177201_5_, float p_177201_6_, float p_177201_7_, float p_177201_8_) { bindTexture(endermanEyesTexture); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE); GlStateManager.disableLighting(); GlStateManager.depthMask(!em.isInvisible()); int i = 61680; int j = i % 65536; int k = i / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j, (float)k); GlStateManager.enableLighting(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); getMainModel().render(em, p_177201_2_, p_177201_3_, p_177201_5_, p_177201_6_, p_177201_7_, p_177201_8_); setLightmap(em); GlStateManager.depthMask(true); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); }
Example 7
Source File: DefaultOverlayRenderer.java From NotEnoughItems with MIT License | 6 votes |
@Override public void renderOverlay(GuiContainerManager gui, Slot slot) { GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); GuiContainerManager.setItemRenderColour(0xA0A0A0B0); for (PositionedStack stack : ingreds) { if (stack.relx == slot.xPos && stack.rely == slot.yPos) { GuiContainerManager.drawItem(stack.relx, stack.rely, stack.item); } } GuiContainerManager.setItemRenderColour(-1); GlStateManager.disableBlend(); GlStateManager.enableLighting(); }
Example 8
Source File: EntryValueEffectOpacity.java From WearableBackpacks with MIT License | 5 votes |
private static void renderEffect(int x, int y, int width, int height, float opacity) { if (opacity <= 0) return; Minecraft mc = Minecraft.getMinecraft(); float animProgress = Minecraft.getSystemTime() / 400.0F; int color = 0xFF8040CC; float r = (color >> 16 & 0xFF) / 255.0F; float g = (color >> 8 & 0xFF) / 255.0F; float b = (color & 0xFF) / 255.0F; GlStateManager.color(r, g, b, opacity * 0.6F); mc.getTextureManager().bindTexture(ENCHANTED_ITEM_GLINT); GlStateManager.enableBlend(); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE); GlStateManager.enableAlpha(); GlStateManager.alphaFunc(GL11.GL_ALWAYS, 0.0F); for (int i = 0; i < 2; ++i) { GlStateManager.matrixMode(GL11.GL_TEXTURE); GlStateManager.loadIdentity(); GlStateManager.rotate(30.0F - i * 60.0F, 0.0F, 0.0F, 1.0F); GlStateManager.translate(0.0F, animProgress * (0.001F + i * 0.003F) * 20.0F, 0.0F); GlStateManager.matrixMode(GL11.GL_MODELVIEW); GuiUtils.drawTexturedModalRect(x, y, 0, 0, width, height, 0); } GlStateManager.matrixMode(GL11.GL_TEXTURE); GlStateManager.loadIdentity(); GlStateManager.matrixMode(GL11.GL_MODELVIEW); GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F); GlStateManager.disableAlpha(); GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.disableBlend(); }
Example 9
Source File: UIModel.java From TFC2 with GNU General Public License v3.0 | 5 votes |
public void setupGL() { GlStateManager.enableBlend(); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager.enableCull(); GlStateManager.disableLighting(); }
Example 10
Source File: ParticleMapleGreenLeaf.java From Sakura_mod with MIT License | 5 votes |
@Override public void renderParticle(BufferBuilder buffer, Entity entity, float partialTicks, float rotX, float rotXZ, float rotZ, float rotYZ, float rotXY) { // EffectRenderer will by default bind the vanilla particles texture, override with our own FMLClientHandler.instance().getClient().renderEngine.bindTexture(ClientProxy.leafTexture); GlStateManager.depthMask(false); GlStateManager.enableBlend(); GlStateManager.blendFunc(770, 1); super.renderParticle(buffer, entity, partialTicks, rotX, rotXZ, rotZ, rotYZ, rotXY); GlStateManager.disableBlend(); GlStateManager.depthMask(true); }
Example 11
Source File: SurfaceHelper.java From ForgeHax with MIT License | 5 votes |
private static void renderItemModelIntoGUI( ItemStack stack, double x, double y, IBakedModel bakedmodel, double scale) { GlStateManager.pushMatrix(); MC.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); MC.getTextureManager() .getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE) .setBlurMipmap(false, false); GlStateManager.enableRescaleNormal(); GlStateManager.enableAlpha(); GlStateManager.alphaFunc(516, 0.1F); GlStateManager.enableBlend(); GlStateManager.blendFunc( GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.translate(x, y, 100.0F + MC.getRenderItem().zLevel); GlStateManager.translate(8.0F, 8.0F, 0.0F); GlStateManager.scale(1.0F, -1.0F, 1.0F); GlStateManager.scale(scale, scale, scale); if (bakedmodel.isGui3d()) { GlStateManager.enableLighting(); } else { GlStateManager.disableLighting(); } bakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms( bakedmodel, ItemCameraTransforms.TransformType.GUI, false); MC.getRenderItem().renderItem(stack, bakedmodel); GlStateManager.disableAlpha(); GlStateManager.disableRescaleNormal(); GlStateManager.disableLighting(); GlStateManager.popMatrix(); MC.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); MC.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap(); }
Example 12
Source File: LayerTofuSlimeGel.java From TofuCraftReload with MIT License | 5 votes |
public void doRenderLayer(EntityTofuSlime entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { if (!entitylivingbaseIn.isInvisible()) { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.enableNormalize(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); this.slimeModel.setModelAttributes(this.slimeRenderer.getMainModel()); this.slimeModel.render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); GlStateManager.disableBlend(); GlStateManager.disableNormalize(); } }
Example 13
Source File: HyperiumRenderItem.java From Hyperium with GNU Lesser General Public License v3.0 | 5 votes |
/** * Basically the same as renderEffect, but does not include the depth code and uses custom color * * @param model the model */ private void renderPot(IBakedModel model, int color) { GlStateManager.depthMask(false); GlStateManager.disableLighting(); GlStateManager.blendFunc(GL11.GL_SRC_COLOR, 1); ((IMixinRenderItem) parent).getTextureManager().bindTexture(RES_ITEM_GLINT); GlStateManager.matrixMode(GL11.GL_TEXTURE); GlStateManager.pushMatrix(); GlStateManager.scale(8.0F, 8.0F, 8.0F); float f = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F / 8.0F; GlStateManager.translate(f, 0.0F, 0.0F); GlStateManager.rotate(-50.0F, 0.0F, 0.0F, 1.0F); ((IMixinRenderItem2) parent).callRenderModel(model, color); GlStateManager.popMatrix(); GlStateManager.pushMatrix(); GlStateManager.scale(8.0F, 8.0F, 8.0F); float f1 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F / 8.0F; GlStateManager.translate(-f1, 0.0F, 0.0F); GlStateManager.rotate(10.0F, 0.0F, 0.0F, 1.0F); ((IMixinRenderItem2) parent).callRenderModel(model, color); GlStateManager.popMatrix(); GlStateManager.matrixMode(GL11.GL_MODELVIEW); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.enableLighting(); GlStateManager.depthMask(true); ((IMixinRenderItem) parent).getTextureManager().bindTexture(TextureMap.locationBlocksTexture); }
Example 14
Source File: Utils.java From SkyblockAddons with MIT License | 5 votes |
public void restoreGLOptions() { if (depthEnabled) { GlStateManager.enableDepth(); } if (!alphaEnabled) { GlStateManager.disableAlpha(); } if (!blendEnabled) { GlStateManager.disableBlend(); } GlStateManager.blendFunc(blendFunctionSrcFactor, blendFunctionDstFactor); }
Example 15
Source File: StructureManager.java From Wizardry with GNU Lesser General Public License v3.0 | 4 votes |
/** * Will not draw the structure if it is not already baked. Resource reloading will re-bake if required. * * @param alpha The transparency of the rendered structure. * @param location The ResourceLocation of the structure to look up. */ @SideOnly(Side.CLIENT) public void draw(ResourceLocation location, float alpha) { HashMap<Integer, int[]> cache = vboCache.get(location); if (cache == null || cache.isEmpty()) { bake(location); return; } GlStateManager.pushMatrix(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.enablePolygonOffset(); GlStateManager.doPolygonOffset(1f, -0.05f); // GlStateManager.disableDepth(); int alphaFunc = GL11.glGetInteger(GL11.GL_ALPHA_TEST_FUNC); float alphaRef = GL11.glGetFloat(GL11.GL_ALPHA_TEST_REF); GlStateManager.alphaFunc(GL11.GL_ALWAYS, 1); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); Tessellator tes = Tessellator.getInstance(); BufferBuilder buffer = tes.getBuffer(); for (int layerID : cache.keySet()) { buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); buffer.addVertexData(cache.get(layerID)); for (int i = 0; i < buffer.getVertexCount(); i++) { buffer.putColorRGBA(buffer.getColorIndex(i), 255, 255, 255, (int) (alpha * 255)); } tes.draw(); } GlStateManager.alphaFunc(alphaFunc, alphaRef); // GlStateManager.enableDepth(); GlStateManager.disablePolygonOffset(); GlStateManager.color(1F, 1F, 1F, 1F); GlStateManager.popMatrix(); }
Example 16
Source File: WorldOverlayRenderer.java From NotEnoughItems with MIT License | 4 votes |
private static void renderChunkBounds(Entity entity) { if (chunkOverlay == 0) return; GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); GlStateManager.disableLighting(); glLineWidth(1.5F); glBegin(GL_LINES); for (int cx = -4; cx <= 4; cx++) for (int cz = -4; cz <= 4; cz++) { double x1 = (entity.chunkCoordX + cx) << 4; double z1 = (entity.chunkCoordZ + cz) << 4; double x2 = x1 + 16; double z2 = z1 + 16; double dy = 128; double y1 = Math.floor(entity.posY - dy / 2); double y2 = y1 + dy; if (y1 < 0) { y1 = 0; y2 = dy; } if (y1 > entity.worldObj.getHeight()) { y2 = entity.worldObj.getHeight(); y1 = y2 - dy; } double dist = Math.pow(1.5, -(cx * cx + cz * cz)); GlStateManager.color(0.9F, 0, 0, (float) dist); if (cx >= 0 && cz >= 0) { glVertex3d(x2, y1, z2); glVertex3d(x2, y2, z2); } if (cx >= 0 && cz <= 0) { glVertex3d(x2, y1, z1); glVertex3d(x2, y2, z1); } if (cx <= 0 && cz >= 0) { glVertex3d(x1, y1, z2); glVertex3d(x1, y2, z2); } if (cx <= 0 && cz <= 0) { glVertex3d(x1, y1, z1); glVertex3d(x1, y2, z1); } if (chunkOverlay == 2 && cx == 0 && cz == 0) { dy = 32; y1 = Math.floor(entity.posY - dy / 2); y2 = y1 + dy; if (y1 < 0) { y1 = 0; y2 = dy; } if (y1 > entity.worldObj.getHeight()) { y2 = entity.worldObj.getHeight(); y1 = y2 - dy; } GlStateManager.color(0, 0.9F, 0, 0.4F); for (double y = (int) y1; y <= y2; y++) { glVertex3d(x2, y, z1); glVertex3d(x2, y, z2); glVertex3d(x1, y, z1); glVertex3d(x1, y, z2); glVertex3d(x1, y, z2); glVertex3d(x2, y, z2); glVertex3d(x1, y, z1); glVertex3d(x2, y, z1); } for (double h = 1; h <= 15; h++) { glVertex3d(x1 + h, y1, z1); glVertex3d(x1 + h, y2, z1); glVertex3d(x1 + h, y1, z2); glVertex3d(x1 + h, y2, z2); glVertex3d(x1, y1, z1 + h); glVertex3d(x1, y2, z1 + h); glVertex3d(x2, y1, z1 + h); glVertex3d(x2, y2, z1 + h); } } } glEnd(); GlStateManager.enableLighting(); GlStateManager.disableBlend(); GlStateManager.enableTexture2D(); }
Example 17
Source File: RendererBackpack.java From WearableBackpacks with MIT License | 4 votes |
private static void renderEnchanted(IBackpack backpack, BlockModelRenderer renderer, float ticks, boolean renderStraps) { Minecraft mc = Minecraft.getMinecraft(); float glintStrength = WearableBackpacks.CONFIG.cosmetic.enchantEffectOpacity.get().floatValue(); if (glintStrength <= 0) return; float glintScale = 1.5F; float animProgress = ticks / 10; int color = IntermodUtils.getRuneColor(backpack.getStack()); float r = (color >> 16 & 0xFF) / 255.0F * glintStrength; float g = (color >> 8 & 0xFF) / 255.0F * glintStrength; float b = (color & 0xFF) / 255.0F * glintStrength; mc.getTextureManager().bindTexture(ENCHANTED_ITEM_GLINT); mc.entityRenderer.setupFogColor(true); GlStateManager.disableLighting(); GlStateManager.depthMask(false); GlStateManager.depthFunc(GL11.GL_EQUAL); GlStateManager.enableBlend(); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_COLOR, GlStateManager.DestFactor.ONE); for (int i = 0; i < 2; ++i) { GlStateManager.matrixMode(GL11.GL_TEXTURE); GlStateManager.loadIdentity(); GlStateManager.scale(glintScale, glintScale, glintScale); GlStateManager.rotate(30.0F - i * 60.0F, 0.0F, 0.0F, 1.0F); GlStateManager.translate(0.0F, animProgress * (0.001F + i * 0.003F) * 20.0F, 0.0F); GlStateManager.matrixMode(GL11.GL_MODELVIEW); renderModel(backpack, renderer, ticks, renderStraps, r, g, b, true); } GlStateManager.matrixMode(GL11.GL_TEXTURE); GlStateManager.loadIdentity(); GlStateManager.matrixMode(GL11.GL_MODELVIEW); GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.disableBlend(); GlStateManager.depthFunc(GL11.GL_LEQUAL); GlStateManager.depthMask(true); GlStateManager.enableLighting(); mc.entityRenderer.setupFogColor(false); }
Example 18
Source File: RocketEventHandler.java From AdvancedRocketry with MIT License | 4 votes |
private void renderModuleSlots(ItemStack armorStack, int slot, RenderGameOverlayEvent event) { int index = 1; float color = 0.85f + 0.15F*MathHelper.sin( 2f*(float)Math.PI*((Minecraft.getMinecraft().world.getTotalWorldTime()) % 60)/60f ); BufferBuilder buffer = Tessellator.getInstance().getBuffer(); GlStateManager.enableBlend(); GlStateManager.enableAlpha(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); float alpha = 0.6f; if( armorStack != null ) { boolean modularArmorFlag = armorStack.getItem() instanceof IModularArmor; if(modularArmorFlag || ItemAirUtils.INSTANCE.isStackValidAirContainer(armorStack)) { int size = 24; int screenY = suitPanel.getRenderY() + (slot-1)*(size + 8); int screenX = suitPanel.getRenderX(); //Draw BG GL11.glColor4f(1f,1f,1f, 1f); Minecraft.getMinecraft().renderEngine.bindTexture(TextureResources.frameHUDBG); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); RenderHelper.renderNorthFaceWithUV(buffer, this.zLevel-1, screenX - 4, screenY - 4, screenX + size, screenY + size + 4,0d,0.5d,0d,1d); Tessellator.getInstance().draw(); Minecraft.getMinecraft().renderEngine.bindTexture(TextureResources.frameHUDBG); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); RenderHelper.renderNorthFaceWithUV(buffer, this.zLevel-1, screenX + size, screenY - 3, screenX + 2 + size, screenY + size + 3,0.5d,0.5d,0d,0d); Tessellator.getInstance().draw(); //Draw Icon GlStateManager.color(color,color,color, color); Minecraft.getMinecraft().renderEngine.bindTexture(TextureResources.armorSlots[slot-1]); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); RenderHelper.renderNorthFaceWithUV(buffer, this.zLevel-1, screenX, screenY, screenX + size, screenY + size,0d,1d,1d,0d); Tessellator.getInstance().draw(); if(modularArmorFlag) { List<ItemStack> stacks = ((IModularArmor)armorStack.getItem()).getComponents(armorStack); for(ItemStack stack : stacks) { GL11.glColor4f(1f, 1f, 1f, 1f); ((IArmorComponent)stack.getItem()).renderScreen(stack, stacks, event, this); ResourceIcon icon = ((IArmorComponent)stack.getItem()).getComponentIcon(stack); ResourceLocation texture = null; if(icon != null) texture= icon.getResourceLocation(); //if(texture != null) { screenX = suitPanel.getRenderX() + 4 + index*(size+2); //Draw BG Minecraft.getMinecraft().renderEngine.bindTexture(TextureResources.frameHUDBG); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); RenderHelper.renderNorthFaceWithUV(buffer, this.zLevel -1, screenX - 4, screenY - 4, screenX + size - 2, screenY + size + 4,0.5d,0.5d,0d,1d); Tessellator.getInstance().draw(); if(texture != null) { //Draw Icon Minecraft.getMinecraft().renderEngine.bindTexture(texture); GlStateManager.color(color,color,color, alpha); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); RenderHelper.renderNorthFaceWithUV(buffer, this.zLevel-1, screenX, screenY, screenX + size, screenY + size, icon.getMinU(),icon.getMaxU(), icon.getMaxV(),icon.getMinV()); Tessellator.getInstance().draw(); } else { GL11.glPushMatrix(); GlStateManager.translate(screenX , screenY, 0); GlStateManager.scale(1.5f, 1.5f, 1.5f); Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(stack, 0,0); GL11.glPopMatrix(); } index++; //} } } screenX = (index)*(size+2) + suitPanel.getRenderX() - 12; //Draw BG GlStateManager.color(1,1,1, 1f); Minecraft.getMinecraft().renderEngine.bindTexture(TextureResources.frameHUDBG); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); RenderHelper.renderNorthFaceWithUV(buffer, this.zLevel-1, screenX + 12, screenY - 4, screenX + size, screenY + size + 4,0.75d,1d,0d,1d); Tessellator.getInstance().draw(); } } GlStateManager.disableAlpha(); }
Example 19
Source File: GlyphPageFontRenderer.java From ClientBase with MIT License | 4 votes |
/** * Render a single line string at the current (posX,posY) and update posX */ private void renderStringAtPos(String text, boolean shadow) { GlyphPage glyphPage = getCurrentGlyphPage(); glPushMatrix(); glScaled(0.5, 0.5, 0.5); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); GlStateManager.enableTexture2D(); glyphPage.bindTexture(); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); for (int i = 0; i < text.length(); ++i) { char c0 = text.charAt(i); if (c0 == 167 && i + 1 < text.length()) { int i1 = "0123456789abcdefklmnor".indexOf(text.toLowerCase(Locale.ENGLISH).charAt(i + 1)); if (i1 < 16) { this.randomStyle = false; this.boldStyle = false; this.strikethroughStyle = false; this.underlineStyle = false; this.italicStyle = false; if (i1 < 0) { i1 = 15; } if (shadow) { i1 += 16; } int j1 = this.colorCode[i1]; this.textColor = j1; GlStateManager.color((float) (j1 >> 16) / 255.0F, (float) (j1 >> 8 & 255) / 255.0F, (float) (j1 & 255) / 255.0F, this.alpha); } else if (i1 == 16) { this.randomStyle = true; } else if (i1 == 17) { this.boldStyle = true; } else if (i1 == 18) { this.strikethroughStyle = true; } else if (i1 == 19) { this.underlineStyle = true; } else if (i1 == 20) { this.italicStyle = true; } else { this.randomStyle = false; this.boldStyle = false; this.strikethroughStyle = false; this.underlineStyle = false; this.italicStyle = false; GlStateManager.color(this.red, this.blue, this.green, this.alpha); } ++i; } else { glyphPage = getCurrentGlyphPage(); glyphPage.bindTexture(); float f = glyphPage.drawChar(c0, posX, posY); doDraw(f, glyphPage); } } glyphPage.unbindTexture(); glPopMatrix(); }
Example 20
Source File: TileOrbHolderRenderer.java From Wizardry with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void render(TileOrbHolder te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { if (te.containsCell()) { GlStateManager.pushMatrix(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.translate(x + 0.5, y + 0.5, z + 0.5); GlStateManager.disableRescaleNormal(); float sin = (float) Math.sin((ClientTickHandler.getTicks() + partialTicks + te.getPos().hashCode()) / 10.0); boolean gravitating = false; // Hover towards block if (te.containsCell()) { BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(te.getPos()); for (int i = -6; i < 6; i++) for (int j = -6; j < 6; j++) for (int k = -6; k < 6; k++) { pos.setPos(te.getPos().getX() + i, te.getPos().getY() + j, te.getPos().getZ() + k); Block block = te.getWorld().getBlockState(pos).getBlock(); if (te.containsCell() && block == ModBlocks.MANA_BATTERY) { gravitating = true; Vec3d direction = new Vec3d(te.getPos()).subtract(new Vec3d(pos)).normalize(); GlStateManager.translate(sin * direction.x / 5.0, sin * direction.y / 5.0, sin * direction.z / 5.0); break; } } } if (!gravitating) GlStateManager.translate(0, sin / 10.0, 0); GlStateManager.rotate((ClientTickHandler.getTicks() + partialTicks) * 4.0f, 0, 1, 0); GlStateManager.translate(0, 0.6, 0); GlStateManager.rotate(45f, 1, 0, 1); { GlStateManager.disableCull(); GlStateManager.enableLighting(); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); RenderHelper.disableStandardItemLighting(); if (te.containsCell()) { Color c = new Color(1f, 1f, 1f, (float) (ManaManager.getMana(te.getWizardryCap()) / ManaManager.getMaxMana(te.getWizardryCap()))); Minecraft.getMinecraft().getTextureManager().bindTexture(manaOrb); renderCube(0.13, c); Minecraft.getMinecraft().getTextureManager().bindTexture(glassOrb); renderCube(0.135, new Color(1, 1, 1, 0.8f)); } GlStateManager.disableRescaleNormal(); } GlStateManager.disableBlend(); GlStateManager.popMatrix(); } }