Java Code Examples for net.minecraft.client.renderer.GlStateManager#enableAlpha()
The following examples show how to use
net.minecraft.client.renderer.GlStateManager#enableAlpha() .
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: PhasedBlockRenderer.java From Wizardry with GNU Lesser General Public License v3.0 | 6 votes |
public static BufferBuilder beginRender() { GlStateManager.enableAlpha(); GlStateManager.enableBlend(); GlStateManager.disableTexture2D(); GlStateManager.enableCull(); GlStateManager.cullFace(GlStateManager.CullFace.BACK); GlStateManager.depthMask(false); GlStateManager.enablePolygonOffset(); GlStateManager.doPolygonOffset(-0.1f, -1000f); GlStateManager.enableColorMaterial(); GlStateManager.color(1, 1, 1, 1); GlStateManager.shadeModel(GL11.GL_SMOOTH); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE); GL14.glBlendEquation(GL14.GL_FUNC_SUBTRACT); BufferBuilder buffer = Tessellator.getInstance().getBuffer(); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL); buffer.setTranslation(-TileEntityRendererDispatcher.staticPlayerX, -TileEntityRendererDispatcher.staticPlayerY, -TileEntityRendererDispatcher.staticPlayerZ); return buffer; }
Example 2
Source File: PlayerDisplay.java From Hyperium with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void draw(int x, double y, boolean config) { GlStateManager.pushMatrix(); GlStateManager.color(1, 1, 1); GlStateManager.translate(x, y, 0); RenderHelper.enableStandardItemLighting(); GlStateManager.enableAlpha(); GlStateManager.shadeModel(GL11.GL_FLAT); GlStateManager.enableAlpha(); GlStateManager.enableDepth(); GlStateManager.rotate(30, 0, 1.0F, 0); GuiInventory.drawEntityOnScreen(0, 100, 50, 0, 0, Minecraft.getMinecraft().thePlayer); GlStateManager.depthFunc(GL11.GL_LEQUAL); GlStateManager.resetColor(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.disableDepth(); GlStateManager.popMatrix(); }
Example 3
Source File: TextureMapRenderer.java From VanillaFix with MIT License | 6 votes |
public static void draw() { float alpha = 1; if (GuiScreen.isCtrlKeyDown()) { alpha = 0.5f; } // Bind texture atlas and disable scaling for debug render (see MixinGlStateManager) Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); pushTextureIdentity(); Minecraft.getMinecraft().entityRenderer.setupOverlayRendering(); GlStateManager.enableAlpha(); GlStateManager.enableBlend(); GlStateManager.disableColorLogic(); GlStateManager.color(1, 1, 1, alpha); drawTexture(5, 5, 0, 0, 230 * stitcher.getImageWidth() / stitcher.getImageHeight(), 230, 1, 1); popTextureMatrix(); }
Example 4
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 5
Source File: GuiUtils.java From Hyperium with GNU Lesser General Public License v3.0 | 5 votes |
public static void drawGradientRect(int zLevel, int left, int top, int right, int bottom, int startColor, int endColor) { float startAlpha = (float) (startColor >> 24 & 255) / 255.0F; float startRed = (float) (startColor >> 16 & 255) / 255.0F; float startGreen = (float) (startColor >> 8 & 255) / 255.0F; float startBlue = (float) (startColor & 255) / 255.0F; float endAlpha = (float) (endColor >> 24 & 255) / 255.0F; float endRed = (float) (endColor >> 16 & 255) / 255.0F; float endGreen = (float) (endColor >> 8 & 255) / 255.0F; float endBlue = (float) (endColor & 255) / 255.0F; GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); GlStateManager.shadeModel(GL11.GL_SMOOTH); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); worldrenderer.pos(right, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).endVertex(); worldrenderer.pos(left, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).endVertex(); worldrenderer.pos(left, bottom, zLevel).color(endRed, endGreen, endBlue, endAlpha).endVertex(); worldrenderer.pos(right, bottom, zLevel).color(endRed, endGreen, endBlue, endAlpha).endVertex(); tessellator.draw(); GlStateManager.shadeModel(GL11.GL_FLAT); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); GlStateManager.enableTexture2D(); }
Example 6
Source File: LayerGlowEye.java From TofuCraftReload with MIT License | 5 votes |
public void doRenderLayer(T entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { this.render.bindTexture(EYE_TEXTURE); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE); if (entitylivingbaseIn.isInvisible()) { GlStateManager.depthMask(false); } else { GlStateManager.depthMask(true); } int i = 50680; int j = i % 65536; int k = i / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) j, (float) k); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); Minecraft.getMinecraft().entityRenderer.setupFogColor(true); this.render.getMainModel().render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); Minecraft.getMinecraft().entityRenderer.setupFogColor(false); i = entitylivingbaseIn.getBrightnessForRender(); j = i % 65536; k = i / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) j, (float) k); this.render.setLightmap(entitylivingbaseIn); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); }
Example 7
Source File: XrayMod.java From ForgeHax with MIT License | 5 votes |
@SubscribeEvent public void onPreRenderBlockLayer(RenderBlockLayerEvent.Pre event) { if (!isInternalCall) { if (!event.getRenderLayer().equals(BlockRenderLayer.TRANSLUCENT)) { event.setCanceled(true); } else if (event.getRenderLayer().equals(BlockRenderLayer.TRANSLUCENT)) { isInternalCall = true; Entity renderEntity = MC.getRenderViewEntity(); GlStateManager.disableAlpha(); MC.renderGlobal.renderBlockLayer( BlockRenderLayer.SOLID, event.getPartialTicks(), 0, renderEntity); GlStateManager.enableAlpha(); MC.renderGlobal.renderBlockLayer( BlockRenderLayer.CUTOUT_MIPPED, event.getPartialTicks(), 0, renderEntity); MC.getTextureManager() .getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE) .setBlurMipmap(false, false); MC.renderGlobal.renderBlockLayer( BlockRenderLayer.CUTOUT, event.getPartialTicks(), 0, renderEntity); MC.getTextureManager() .getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE) .restoreLastBlurMipmap(); GlStateManager.disableAlpha(); isInternalCall = false; } } }
Example 8
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 9
Source File: RenderEventService.java From ForgeHax with MIT License | 5 votes |
@SubscribeEvent public void onRenderWorld(RenderWorldLastEvent event) { GlStateManager.pushMatrix(); GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); GlStateManager.shadeModel(GL11.GL_SMOOTH); GlStateManager.disableDepth(); GlStateManager.glLineWidth(1.f); Vec3d renderPos = EntityUtils.getInterpolatedPos(getRenderEntity(), event.getPartialTicks()); RenderEvent e = new RenderEvent(TESSELLATOR, renderPos, event.getPartialTicks()); e.resetTranslation(); MinecraftForge.EVENT_BUS.post(e); GlStateManager.glLineWidth(1.f); GlStateManager.shadeModel(GL11.GL_FLAT); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); GlStateManager.enableTexture2D(); GlStateManager.enableDepth(); GlStateManager.enableCull(); GlStateManager.popMatrix(); }
Example 10
Source File: RenderUtil.java From seppuku with GNU General Public License v3.0 | 5 votes |
public static void drawLine(float x, float y, float x1, float y1, float thickness, int hex) { float red = (hex >> 16 & 0xFF) / 255.0F; float green = (hex >> 8 & 0xFF) / 255.0F; float blue = (hex & 0xFF) / 255.0F; float alpha = (hex >> 24 & 0xFF) / 255.0F; GlStateManager.pushMatrix(); GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.shadeModel(GL_SMOOTH); glLineWidth(thickness); glEnable(GL_LINE_SMOOTH); glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); final Tessellator tessellator = Tessellator.getInstance(); final BufferBuilder bufferbuilder = tessellator.getBuffer(); bufferbuilder.begin(GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR); bufferbuilder.pos((double) x, (double) y, (double) 0).color(red, green, blue, alpha).endVertex(); bufferbuilder.pos((double) x1, (double) y1, (double) 0).color(red, green, blue, alpha).endVertex(); tessellator.draw(); GlStateManager.shadeModel(GL_FLAT); glDisable(GL_LINE_SMOOTH); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); GlStateManager.enableTexture2D(); GlStateManager.popMatrix(); }
Example 11
Source File: FramebufferShader.java From LiquidBounce with GNU General Public License v3.0 | 5 votes |
public void startDraw(final float partialTicks) { GlStateManager.enableAlpha(); GlStateManager.pushMatrix(); GlStateManager.pushAttrib(); framebuffer = setupFrameBuffer(framebuffer); framebuffer.framebufferClear(); framebuffer.bindFramebuffer(true); entityShadows = mc.gameSettings.entityShadows; mc.gameSettings.entityShadows = false; mc.entityRenderer.setupCameraTransform(partialTicks, 0); }
Example 12
Source File: RenderHelper.java From HoloInventory with MIT License | 5 votes |
public static void start() { GlStateManager.pushMatrix(); GlStateManager.pushAttrib(); 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); }
Example 13
Source File: GuiContainerManager.java From NotEnoughItems with MIT License | 4 votes |
public void renderSlotOverlay(Slot slot) { for (IContainerDrawHandler drawHandler : drawHandlers) drawHandler.renderSlotOverlay(window, slot); GlStateManager.enableAlpha(); }
Example 14
Source File: TESRBarrel.java From enderutilities with GNU Lesser General Public License v3.0 | 4 votes |
protected void renderStack(ItemStack stack, double posX, double posY, double posZ, EnumFacing side, EnumFacing barrelFront) { GlStateManager.pushMatrix(); GlStateManager.translate(posX, posY, posZ); if (side == EnumFacing.UP || side == EnumFacing.DOWN) { GlStateManager.rotate(MODEL_ROT_SIDE_Y[barrelFront.getIndex()], 0, 1, 0); GlStateManager.rotate(-90f * side.getYOffset(), 1, 0, 0); } else { GlStateManager.rotate(MODEL_ROT_SIDE_Y[side.getIndex()], 0, 1, 0); } //GlStateManager.translate(-0.25, 0.2, 0); // This offset is currently added to the renderItemIntoGUI arguments GlStateManager.scale(0.55f, 0.55f, 1); if (this.renderItem.shouldRenderItemIn3D(stack)) { GlStateManager.scale(1 / 16f, -1 / 16f, 0.0001); } else { GlStateManager.scale(1 / 16f, -1 / 16f, 0.01); GlStateManager.translate(0, 0, -100); } // The following rendering stuff within this method has been taken from Storage Drawers by jaquadro, found here: // https://github.com/jaquadro/StorageDrawers/blob/e5719be6d64f757a1b58c25e8ca5bc64074c6b9e/src/com/jaquadro/minecraft/storagedrawers/client/renderer/TileEntityDrawersRenderer.java#L180 // At the time GL_LIGHT* are configured, the coordinates are transformed by the modelview // matrix. The transformations used in `RenderHelper.enableGUIStandardItemLighting` are // suitable for the orthographic projection used by GUI windows, but they are just a little // bit off when rendering a block in 3D and squishing it flat. An additional term is added // to account for slightly different shading on the half-size "icons" in 1x2 and 2x2 // drawers due to the extreme angles caused by flattening the block (as noted below). GlStateManager.pushMatrix(); GlStateManager.scale(2.6f, 2.6f, 1); GlStateManager.rotate(171.6f, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(84.9f, 1.0F, 0.0F, 0.0F); RenderHelper.enableStandardItemLighting(); GlStateManager.popMatrix(); // TileEntitySkullRenderer alters both of these options on, but does not restore them. GlStateManager.enableCull(); // This extra enable toggle is to fix a render glitch with items in Item Frames on screen, // and then hovering over a stack in an inventory... Rendering... always lovely... GlStateManager.enableRescaleNormal(); GlStateManager.disableRescaleNormal(); // GL_POLYGON_OFFSET is used to offset flat icons toward the viewer (-Z) in screen space, // so they always appear on top of the drawer's front space. GlStateManager.enablePolygonOffset(); GlStateManager.doPolygonOffset(-1, -1); // DIRTY HACK: Fool GlStateManager into thinking GL_RESCALE_NORMAL is enabled, but disable // it using popAttrib This prevents RenderItem from enabling it again. // // Normals are transformed by the inverse of the modelview and projection matrices that // excludes the translate terms. When put through the extreme Z scale used to flatten the // block, this makes them point away from the drawer face at a very sharp angle. These // normals are no longer unit scale (normalized), and normalizing them via // GL_RESCALE_NORMAL causes a loss of precision that results in the normals pointing // directly away from the face, which is visible as the block faces having identical // (dark) shading. GlStateManager.pushAttrib(); GlStateManager.enableRescaleNormal(); GlStateManager.popAttrib(); this.renderItem.renderItemIntoGUI(stack, -8, -7); GlStateManager.disableBlend(); // Clean up after RenderItem GlStateManager.enableAlpha(); // Restore world render state after RenderItem GlStateManager.disablePolygonOffset(); GlStateManager.popMatrix(); }
Example 15
Source File: MixinGuiSlot.java From LiquidBounce with GNU General Public License v3.0 | 4 votes |
/** * @author CCBlueX */ @Overwrite public void drawScreen(int mouseXIn, int mouseYIn, float p_148128_3_) { if(this.field_178041_q) { this.mouseX = mouseXIn; this.mouseY = mouseYIn; this.drawBackground(); int i = this.getScrollBarX(); int j = i + 6; this.bindAmountScrolled(); GlStateManager.disableLighting(); GlStateManager.disableFog(); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); int k = this.left + this.width / 2 - this.getListWidth() / 2 + 2; int l = this.top + 4 - (int) this.amountScrolled; if (this.hasListHeader) { this.drawListHeader(k, l, tessellator); } RenderUtils.makeScissorBox(left, top, right, bottom); GL11.glEnable(GL11.GL_SCISSOR_TEST); this.drawSelectionBox(k, l + 2, mouseXIn, mouseYIn + 2); GL11.glDisable(GL11.GL_SCISSOR_TEST); GlStateManager.disableDepth(); int i1 = 4; // ClientCode ScaledResolution scaledResolution = new ScaledResolution(mc); Gui.drawRect(0, 0, scaledResolution.getScaledWidth(), this.top, Integer.MIN_VALUE); Gui.drawRect(0, this.bottom, scaledResolution.getScaledWidth(), this.height, Integer.MIN_VALUE); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(770, 771, 0, 1); GlStateManager.disableAlpha(); GlStateManager.shadeModel(7425); GlStateManager.disableTexture2D(); worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); worldrenderer.pos(this.left, this.top + i1, 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 0).endVertex(); worldrenderer.pos(this.right, this.top + i1, 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 0).endVertex(); worldrenderer.pos(this.right, this.top, 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 255).endVertex(); worldrenderer.pos(this.left, this.top, 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 255).endVertex(); tessellator.draw(); worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); worldrenderer.pos(this.left, this.bottom, 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 255).endVertex(); worldrenderer.pos(this.right, this.bottom, 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 255).endVertex(); worldrenderer.pos(this.right, this.bottom - i1, 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 0).endVertex(); worldrenderer.pos(this.left, this.bottom - i1, 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 0).endVertex(); tessellator.draw(); int j1 = this.func_148135_f(); if (j1 > 0) { int k1 = (this.bottom - this.top) * (this.bottom - this.top) / this.getContentHeight(); k1 = MathHelper.clamp_int(k1, 32, this.bottom - this.top - 8); int l1 = (int) this.amountScrolled * (this.bottom - this.top - k1) / j1 + this.top; if (l1 < this.top) { l1 = this.top; } worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); worldrenderer.pos(i, this.bottom, 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 255).endVertex(); worldrenderer.pos(j, this.bottom, 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 255).endVertex(); worldrenderer.pos(j, this.top, 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 255).endVertex(); worldrenderer.pos(i, this.top, 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 255).endVertex(); tessellator.draw(); worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); worldrenderer.pos(i, l1 + k1, 0.0D).tex(0.0D, 1.0D).color(128, 128, 128, 255).endVertex(); worldrenderer.pos(j, l1 + k1, 0.0D).tex(1.0D, 1.0D).color(128, 128, 128, 255).endVertex(); worldrenderer.pos(j, l1, 0.0D).tex(1.0D, 0.0D).color(128, 128, 128, 255).endVertex(); worldrenderer.pos(i, l1, 0.0D).tex(0.0D, 0.0D).color(128, 128, 128, 255).endVertex(); tessellator.draw(); worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); worldrenderer.pos(i, l1 + k1 - 1, 0.0D).tex(0.0D, 1.0D).color(192, 192, 192, 255).endVertex(); worldrenderer.pos(j - 1, l1 + k1 - 1, 0.0D).tex(1.0D, 1.0D).color(192, 192, 192, 255).endVertex(); worldrenderer.pos(j - 1, l1, 0.0D).tex(1.0D, 0.0D).color(192, 192, 192, 255).endVertex(); worldrenderer.pos(i, l1, 0.0D).tex(0.0D, 0.0D).color(192, 192, 192, 255).endVertex(); tessellator.draw(); } this.func_148142_b(mouseXIn, mouseYIn); GlStateManager.enableTexture2D(); GlStateManager.shadeModel(7424); GlStateManager.enableAlpha(); GlStateManager.disableBlend(); } }
Example 16
Source File: GuiCustom.java From Custom-Main-Menu with MIT License | 4 votes |
@Override public void initGui() { GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.shadeModel(7425); GlStateManager.shadeModel(7424); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); GlStateManager.enableTexture2D(); if (!loadedSplashText && guiConfig.splashText != null) { if (guiConfig.splashText.synced) { this.splashText = CustomMainMenu.INSTANCE.config.getGUI("mainmenu").splashText; } else { loadSplashTexts(); } loadedSplashText = true; } textLabels = new ArrayList<GuiCustomLabel>(); buttonCounter = 0; this.viewportTexture = new DynamicTexture(256, 256); this.field_110351_G = this.mc.getTextureManager().getDynamicTextureLocation("background", this.viewportTexture); Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); if (calendar.get(2) + 1 == 11 && calendar.get(5) == 9) { this.splashText = "Happy birthday, ez!"; } else if (calendar.get(2) + 1 == 6 && calendar.get(5) == 1) { this.splashText = "Happy birthday, Notch!"; } else if (calendar.get(2) + 1 == 12 && calendar.get(5) == 24) { this.splashText = "Merry X-mas!"; } else if (calendar.get(2) + 1 == 1 && calendar.get(5) == 1) { this.splashText = "Happy new year!"; } else if (calendar.get(2) + 1 == 10 && calendar.get(5) == 31) { this.splashText = "OOoooOOOoooo! Spooky!"; } int idCounter = 6000; // Add Custom Buttons for (Button b : guiConfig.customButtons) { if (b.wrappedButtonID != -1) { this.buttonList.add(alignButton(b, new GuiCustomWrappedButton(b.wrappedButtonID, b.wrappedButtonID, b))); } else { this.buttonList.add(alignButton(b, new GuiCustomButton(idCounter, b))); idCounter++; } } // Add Labels for (Label t : guiConfig.customLabels) { textLabels.add(new GuiCustomLabel(this, t, modX(t.posX, t.alignment), modY(t.posY, t.alignment))); } }
Example 17
Source File: ParticleRenderer.java From Logistics-Pipes-2 with MIT License | 4 votes |
public void renderParticles(EntityPlayer aPlayer, float pTicks) { float f = ActiveRenderInfo.getRotationX(); float f1 = ActiveRenderInfo.getRotationZ(); float f2 = ActiveRenderInfo.getRotationYZ(); float f3 = ActiveRenderInfo.getRotationXY(); float f4 = ActiveRenderInfo.getRotationXZ(); EntityPlayer player = Minecraft.getMinecraft().player; if(player!=null) { Particle.interpPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * pTicks; Particle.interpPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * pTicks; Particle.interpPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * pTicks; Particle.cameraViewDir = player.getLook(pTicks); GlStateManager.enableAlpha(); GlStateManager.enableBlend(); GlStateManager.alphaFunc(516, 0.003921569F); GlStateManager.disableCull(); GlStateManager.depthMask(false); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); Tessellator tess = Tessellator.getInstance(); VertexBuffer buffer = tess.getBuffer(); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); for(int i = 0; i < particles.size(); i ++) { if(!((ILP2Particle) particles.get(i)).isAdditive()) { particles.get(i).renderParticle(buffer, player, pTicks, f, f4, f1, f2, f3); } } tess.draw(); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); for(int i = 0; i < particles.size(); i ++) { if(((ILP2Particle) particles.get(i)).isAdditive()) { particles.get(i).renderParticle(buffer, player, pTicks, f, f4, f1, f2, f3); } } tess.draw(); GlStateManager.enableCull(); GlStateManager.depthMask(true); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); GlStateManager.disableBlend(); GlStateManager.alphaFunc(516, 0.1F); } }
Example 18
Source File: RenderBeam.java From TofuCraftReload with MIT License | 4 votes |
/** * Renders the desired {@code T} type Entity. */ public void doRender(EntityBeam entity, double x, double y, double z, float entityYaw, float partialTicks) { this.bindEntityTexture(entity); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.pushMatrix(); GlStateManager.disableLighting(); GlStateManager.translate((float) x, (float) y, (float) z); GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks - 90.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, 0.0F, 0.0F, 1.0F); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); GlStateManager.enableRescaleNormal(); GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F); GlStateManager.scale(0.05625F, 0.05625F, 0.05625F); GlStateManager.translate(-4.0F, 0.0F, 0.0F); if (this.renderOutlines) { GlStateManager.enableColorMaterial(); GlStateManager.enableOutlineMode(this.getTeamColor(entity)); } GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE); GlStateManager.depthMask(true); GlStateManager.glNormal3f(0.05625F, 0.0F, 0.0F); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(-7.0D, -2.0D, -2.0D).tex(0.0D, 0.15625D).endVertex(); bufferbuilder.pos(-7.0D, -2.0D, 2.0D).tex(0.15625D, 0.15625D).endVertex(); bufferbuilder.pos(-7.0D, 2.0D, 2.0D).tex(0.15625D, 0.3125D).endVertex(); bufferbuilder.pos(-7.0D, 2.0D, -2.0D).tex(0.0D, 0.3125D).endVertex(); tessellator.draw(); GlStateManager.glNormal3f(-0.05625F, 0.0F, 0.0F); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(-7.0D, 2.0D, -2.0D).tex(0.0D, 0.15625D).endVertex(); bufferbuilder.pos(-7.0D, 2.0D, 2.0D).tex(0.15625D, 0.15625D).endVertex(); bufferbuilder.pos(-7.0D, -2.0D, 2.0D).tex(0.15625D, 0.3125D).endVertex(); bufferbuilder.pos(-7.0D, -2.0D, -2.0D).tex(0.0D, 0.3125D).endVertex(); tessellator.draw(); for (int j = 0; j < 4; ++j) { GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); GlStateManager.glNormal3f(0.0F, 0.0F, 0.05625F); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(-8.0D, -2.0D, 0.0D).tex(0.0D, 0.0D).endVertex(); bufferbuilder.pos(8.0D, -2.0D, 0.0D).tex(0.5D, 0.0D).endVertex(); bufferbuilder.pos(8.0D, 2.0D, 0.0D).tex(0.5D, 0.15625D).endVertex(); bufferbuilder.pos(-8.0D, 2.0D, 0.0D).tex(0.0D, 0.15625D).endVertex(); tessellator.draw(); } if (this.renderOutlines) { GlStateManager.disableOutlineMode(); GlStateManager.disableColorMaterial(); } GlStateManager.disableBlend(); GlStateManager.enableAlpha(); GlStateManager.disableRescaleNormal(); GlStateManager.enableLighting(); GlStateManager.popMatrix(); super.doRender(entity, x, y, z, entityYaw, partialTicks); }
Example 19
Source File: HyperiumGui.java From Hyperium with GNU Lesser General Public License v3.0 | 4 votes |
/** * Draws an animated rainbow box in the specified range * * @param left the x1 position * @param top the y1 position * @param right the x2 position * @param bottom the y2 position * @param alpha the alpha the box should be drawn at * @author boomboompower */ public static void drawChromaBox(int left, int top, int right, int bottom, float alpha) { if (left < right) { int i = left; left = right; right = i; } if (top < bottom) { int j = top; top = bottom; bottom = j; } int startColor = Color.HSBtoRGB(System.currentTimeMillis() % 5000L / 5000.0f, 0.8f, 0.8f); int endColor = Color.HSBtoRGB((System.currentTimeMillis() + 500) % 5000L / 5000.0f, 0.8f, 0.8f); float f1 = (float) (startColor >> 16 & 255) / 255.0F; float f2 = (float) (startColor >> 8 & 255) / 255.0F; float f3 = (float) (startColor & 255) / 255.0F; float f5 = (float) (endColor >> 16 & 255) / 255.0F; float f6 = (float) (endColor >> 8 & 255) / 255.0F; float f7 = (float) (endColor & 255) / 255.0F; GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); GlStateManager.shadeModel(GL11.GL_SMOOTH); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); worldrenderer.pos(right, top, 0).color(f1, f2, f3, alpha).endVertex(); worldrenderer.pos(left, top, 0).color(f1, f2, f3, alpha).endVertex(); worldrenderer.pos(left, bottom, 0).color(f5, f6, f7, alpha).endVertex(); worldrenderer.pos(right, bottom, 0).color(f5, f6, f7, alpha).endVertex(); tessellator.draw(); GlStateManager.shadeModel(GL11.GL_FLAT); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); GlStateManager.enableTexture2D(); }
Example 20
Source File: MixinLoadingScreenRenderer.java From Hyperium with GNU Lesser General Public License v3.0 | 4 votes |
/** * @author ConorTheDev * @reason Custom screen when loading to a new world */ @Inject(method = "setLoadingProgress", at = @At("HEAD"), cancellable = true) private void setLoadingProgress(CallbackInfo ci) { if (Settings.HYPERIUM_LOADING_SCREEN) { long nanoTime = Minecraft.getSystemTime(); if (nanoTime - systemTime >= 100L) { systemTime = nanoTime; ScaledResolution scaledresolution = new ScaledResolution(mc); int scaleFactor = scaledresolution.getScaleFactor(); int scaledWidth = scaledresolution.getScaledWidth(); int scaledHeight = scaledresolution.getScaledHeight(); if (OpenGlHelper.isFramebufferEnabled()) { framebuffer.framebufferClear(); } else { GlStateManager.clear(GL11.GL_DEPTH_BUFFER_BIT); } framebuffer.bindFramebuffer(false); GlStateManager.matrixMode(GL11.GL_PROJECTION); GlStateManager.loadIdentity(); GlStateManager.ortho(0.0D, scaledresolution.getScaledWidth_double(), scaledresolution.getScaledHeight_double(), 0.0D, 100.0D, 300.0D); GlStateManager.matrixMode(GL11.GL_MODELVIEW); GlStateManager.loadIdentity(); GlStateManager.translate(0.0F, 0.0F, -200.0F); if (!OpenGlHelper.isFramebufferEnabled()) GlStateManager.clear(16640); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); mc.getTextureManager().bindTexture(new ResourceLocation("textures/world-loading.png")); Gui.drawModalRectWithCustomSizedTexture(0, 0, 0.0f, 0.0f, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight()); int progress; if ("Loading world".equals(currentlyDisplayedText)) { if (message.isEmpty()) { progress = 33; } else if (message.equals("Converting world")) { progress = 66; } else if (message.equals("Building terrain")) { progress = 90; } else { progress = 100; } } else { progress = -1; } if (progress >= 0) { int maxProgress = 100; int barTop = 2; int barHeight = scaledResolution.getScaledHeight() - 15; GlStateManager.disableTexture2D(); worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); worldrenderer.pos(maxProgress, barHeight, 0.0D).color(128, 128, 128, 255).endVertex(); worldrenderer.pos(maxProgress, barHeight + barTop, 0.0D).color(128, 128, 128, 255).endVertex(); worldrenderer.pos(maxProgress + maxProgress, barHeight + barTop, 0.0D).color(128, 128, 128, 255).endVertex(); worldrenderer.pos(maxProgress + maxProgress, barHeight, 0.0D).color(128, 128, 128, 255).endVertex(); worldrenderer.pos(maxProgress, barHeight, 0.0D).color(128, 255, 128, 255).endVertex(); worldrenderer.pos(maxProgress, barHeight + barTop, 0.0D).color(128, 255, 128, 255).endVertex(); worldrenderer.pos(maxProgress + progress, barHeight + barTop, 0.0D).color(128, 255, 128, 255).endVertex(); worldrenderer.pos(maxProgress + progress, barHeight, 0.0D).color(128, 255, 128, 255).endVertex(); tessellator.draw(); GlStateManager.enableAlpha(); GlStateManager.enableBlend(); Gui.drawRect(0, scaledResolution.getScaledHeight() - 35, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), new Color(0, 0, 0, 50).getRGB()); GlStateManager.disableAlpha(); GlStateManager.disableBlend(); GlStateManager.enableTexture2D(); } GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); mc.fontRendererObj.drawString(currentlyDisplayedText, 5, scaledResolution.getScaledHeight() - 30, -1); mc.fontRendererObj.drawString(message, 5, scaledResolution.getScaledHeight() - 15, -1); framebuffer.unbindFramebuffer(); if (OpenGlHelper.isFramebufferEnabled()) { framebuffer.framebufferRender(scaledWidth * scaleFactor, scaledHeight * scaleFactor); } mc.updateDisplay(); try { Thread.yield(); } catch (Exception ignored) { } } ci.cancel(); } }