Java Code Examples for net.minecraft.client.renderer.GlStateManager#disableAlpha()

The following examples show how to use net.minecraft.client.renderer.GlStateManager#disableAlpha() . 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: GuiDownloadTofuTerrain.java    From TofuCraftReload with MIT License 6 votes vote down vote up
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
    long time = Minecraft.getSystemTime() - prevTime;

    if (getPanoramaPaths() != null) {
        if (time > 200L) {
            ++panoramaTimer;
        }

        GlStateManager.disableAlpha();
        renderSkybox(partialTicks);
        GlStateManager.enableAlpha();
    } else {
        drawBackground(0);
    }

    if (time > 500L) {
        drawCenteredString(fontRenderer, getInfoText(), width / 2, height / 2 + 40, 0xFFFFFF);
    }

    if (time > 2000L) {
        drawCenteredString(fontRenderer, getSubText(), width / 2, height / 2 + 65, 0xCCCCCC);
    }
}
 
Example 2
Source File: SurfaceHelper.java    From ForgeHax with MIT License 5 votes vote down vote up
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 3
Source File: XrayMod.java    From ForgeHax with MIT License 5 votes vote down vote up
@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 4
Source File: GuiComponentColorPicker.java    From OpenModsLib with MIT License 5 votes vote down vote up
@Override
public void render(int offsetX, int offsetY, int mouseX, int mouseY) {
	GlStateManager.color(1, 1, 1, 1);

	int renderX = offsetX + x;
	int renderY = offsetY + y;

	bindComponentsSheet();
	drawTexturedModalRect(renderX, renderY, 156, 206, getWidth(), getColorsHeight());
	drawRect(renderX, renderY, renderX + getWidth(), renderY + getColorsHeight(), (tone << 24) | 0xFFFFFF);

	GlStateManager.enableBlend();
	GlStateManager.disableTexture2D();
	GlStateManager.disableAlpha();
	GlStateManager.shadeModel(GL11.GL_SMOOTH);
	GL11.glBegin(GL11.GL_QUADS);
	GlStateManager.color(0, 0, 0, 1.0f);
	GL11.glVertex3d(renderX, renderY + getColorsHeight(), 0.0);
	GL11.glVertex3d(renderX + getWidth(), renderY + getColorsHeight(), 0.0);
	GlStateManager.color(0, 0, 0, 0f);
	GL11.glVertex3d(renderX + getWidth(), renderY, 0.0D);
	GL11.glVertex3d(renderX, renderY, 0.0);
	GL11.glEnd();
	GlStateManager.shadeModel(GL11.GL_FLAT);
	GlStateManager.disableBlend();
	GlStateManager.enableTexture2D();
	GlStateManager.enableAlpha();
	drawRect(renderX + pointX - 1,
			renderY + pointY - 1,
			renderX + pointX + 1,
			renderY + pointY + 1, 0xCCCC0000);
}
 
Example 5
Source File: CustomCrosshair.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void drawXCrosshair(int screenWidth, int screenHeight, int renderGap,
                            Color renderColour) {
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
    GL11.glDisable(GL11.GL_POINT_SMOOTH);
    GlStateManager.disableAlpha();
    GlStateManager.disableBlend();
    if (outline) {
        GL11.glLineWidth((float) (thickness + 6));
        CustomCrosshairGraphics
            .drawLine(screenWidth - width - 1, screenHeight + height + 1,
                screenWidth, screenHeight, colourOutline);
        CustomCrosshairGraphics
            .drawLine(screenWidth, screenHeight, screenWidth + width + 1,
                screenHeight + height + 1, colourOutline);
        CustomCrosshairGraphics
            .drawLine(screenWidth + width + 1, screenHeight - height - 1,
                screenWidth, screenHeight, colourOutline);
        CustomCrosshairGraphics
            .drawLine(screenWidth, screenHeight, screenWidth - width - 1,
                screenHeight - height - 1, colourOutline);
    }
    GL11.glLineWidth((float) (thickness + 1));
    CustomCrosshairGraphics
        .drawLine(screenWidth - width, screenHeight + height, screenWidth,
            screenHeight, renderColour);
    CustomCrosshairGraphics.drawLine(screenWidth, screenHeight, screenWidth + width,
        screenHeight + height, renderColour);
    CustomCrosshairGraphics
        .drawLine(screenWidth + width, screenHeight - height, screenWidth,
            screenHeight, renderColour);
    CustomCrosshairGraphics.drawLine(screenWidth, screenHeight, screenWidth - width,
        screenHeight - height, renderColour);
}
 
Example 6
Source File: GuiCustom.java    From Custom-Main-Menu with MIT License 5 votes vote down vote up
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);
	GlStateManager.enableBlend();
	GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
	GlStateManager.colorMask(true, true, true, false);
	Tessellator tessellator = Tessellator.getInstance();
	BufferBuilder vertexBuffer = tessellator.getBuffer();
	vertexBuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
	GlStateManager.disableAlpha();
	int i = 3;

	if (guiConfig.panorama.blur)
	{
		for (int j = 0; j < i; ++j)
		{
			float f = 1.0F / (float) (j + 1);
			int k = this.width;
			int l = this.height;
			float f1 = (float) (j - i / 2) / 256.0F;
			vertexBuffer.pos((double) k, (double) l, (double) this.zLevel).tex((double) (0.0F + f1), 1.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
			vertexBuffer.pos((double) k, 0.0D, (double) this.zLevel).tex((double) (1.0F + f1), 1.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
			vertexBuffer.pos(0.0D, 0.0D, (double) this.zLevel).tex((double) (1.0F + f1), 0.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
			vertexBuffer.pos(0.0D, (double) l, (double) this.zLevel).tex((double) (0.0F + f1), 0.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
		}
	}

	tessellator.draw();
	GlStateManager.enableAlpha();
	GlStateManager.colorMask(true, true, true, true);
}
 
Example 7
Source File: GuiDownloadTofuTerrain.java    From TofuCraftReload with MIT License 5 votes vote down vote up
private void rotateAndBlurSkybox(float ticks) {
    mc.getTextureManager().bindTexture(panoramaBackground);
    GlStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
    GlStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
    GlStateManager.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, 256, 256);
    GlStateManager.enableBlend();
    GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
    GlStateManager.colorMask(true, true, true, false);
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder buffer = tessellator.getBuffer();
    buffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
    GlStateManager.disableAlpha();
    byte b0 = 3;

    for (int i = 0; i < b0; ++i) {
        float f = 1.0F / (i + 1);
        int j = width;
        int k = height;
        float f1 = (i - b0 / 2) / 256.0F;
        buffer.pos(j, k, 0.0D).tex(0.0F + f1, 1.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
        buffer.pos(j, 0.0D, 0.0D).tex(1.0F + f1, 1.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
        buffer.pos(0.0D, 0.0D, 0.0D).tex(1.0F + f1, 0.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
        buffer.pos(0.0D, k, 0.0D).tex(0.0F + f1, 0.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
    }

    tessellator.draw();
    GlStateManager.enableAlpha();
    GlStateManager.colorMask(true, true, true, true);
}
 
Example 8
Source File: LayerGlowEye.java    From TofuCraftReload with MIT License 5 votes vote down vote up
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 9
Source File: PlayerOverlay.java    From MediaMod with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Draws a rectangle with a vertical gradient between the specified colors (ARGB format).
 * Args: x1, y1, x2, y2, topColor, bottomColor
 *
 * @author ScottehBoeh
 */
private void drawGradientRect(double left, double top, double right, double bottom, int startColor, int endColor) {
    float f = (float) (startColor >> 24 & 255) / 255.0F;
    float f1 = (float) (startColor >> 16 & 255) / 255.0F;
    float f2 = (float) (startColor >> 8 & 255) / 255.0F;
    float f3 = (float) (startColor & 255) / 255.0F;
    float f4 = (float) (endColor >> 24 & 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(770, 771, 1, 0);
    GlStateManager.shadeModel(7425);
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR);
    worldrenderer.pos(right, top, 0).color(f1, f2, f3, f).endVertex();
    worldrenderer.pos(left, top, 0).color(f1, f2, f3, f).endVertex();
    worldrenderer.pos(left, bottom, 0).color(f5, f6, f7, f4).endVertex();
    worldrenderer.pos(right, bottom, 0).color(f5, f6, f7, f4).endVertex();
    tessellator.draw();
    GlStateManager.shadeModel(7424);
    GlStateManager.disableBlend();
    GlStateManager.enableAlpha();
    GlStateManager.enableTexture2D();
}
 
Example 10
Source File: GuiContainerLargeStacks.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void renderLargeStackItemOverlayIntoGUI(FontRenderer fontRenderer, ItemStack stack, int xPosition, int yPosition)
{
    if (stack.isEmpty())
    {
        return;
    }

    if (stack.getCount() != 1)
    {
        String str = EUStringUtils.getStackSizeString(stack, 4);

        if (stack.getCount() < 1)
        {
            str = TextFormatting.RED + str;
        }

        GlStateManager.disableLighting();
        GlStateManager.disableDepth();
        GlStateManager.disableBlend();

        GlStateManager.pushMatrix();
        GlStateManager.translate(xPosition, yPosition, 0.0d);
        GlStateManager.scale(0.5d, 0.5d, 0.5d);

        fontRenderer.drawStringWithShadow(str, (31 - fontRenderer.getStringWidth(str)), 23, 0xFFFFFF);

        GlStateManager.popMatrix();

        GlStateManager.enableLighting();
        GlStateManager.enableDepth();
    }

    if (stack.getItem().showDurabilityBar(stack))
    {
        double health = stack.getItem().getDurabilityForDisplay(stack);
        int j = (int)Math.round(13.0D - health * 13.0D);
        int i = (int)Math.round(255.0D - health * 255.0D);

        GlStateManager.disableLighting();
        GlStateManager.disableDepth();
        GlStateManager.disableTexture2D();
        GlStateManager.disableAlpha();
        GlStateManager.disableBlend();

        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder vertexBuffer = tessellator.getBuffer();

        this.drawQuad(vertexBuffer, xPosition + 2, yPosition + 13, 13, 2, 0, 0, 0, 255);
        this.drawQuad(vertexBuffer, xPosition + 2, yPosition + 13, 12, 1, (255 - i) / 4, 64, 0, 255);
        this.drawQuad(vertexBuffer, xPosition + 2, yPosition + 13, j, 1, 255 - i, i, 0, 255);

        GlStateManager.enableAlpha();
        GlStateManager.enableTexture2D();
        GlStateManager.enableLighting();
        GlStateManager.enableDepth();
    }
}
 
Example 11
Source File: RenderUtils.java    From ForgeHax with MIT License 4 votes vote down vote up
public static void drawLine(
    Vec3d startPos, Vec3d endPos, int color, boolean smooth, float width) {
  Tessellator tessellator = Tessellator.getInstance();
  BufferBuilder BufferBuilder = tessellator.getBuffer();
  
  Vec3d endVecPos = endPos.subtract(startPos);
  
  float r = (float) (color >> 16 & 255) / 255.0F;
  float g = (float) (color >> 8 & 255) / 255.0F;
  float b = (float) (color & 255) / 255.0F;
  float a = (float) (color >> 24 & 255) / 255.0F;
  
  if (smooth) {
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
  }
  
  GL11.glLineWidth(width);
  
  GlStateManager.pushMatrix();
  GlStateManager.translate(startPos.x, startPos.y, startPos.z);
  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);
  
  BufferBuilder.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
  BufferBuilder.pos(0, 0, 0).color(r, g, b, a).endVertex();
  BufferBuilder.pos(endVecPos.x, endVecPos.y, endVecPos.z).color(r, g, b, a).endVertex();
  tessellator.draw();
  
  if (smooth) {
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
  }
  
  GlStateManager.shadeModel(GL11.GL_FLAT);
  GlStateManager.disableBlend();
  GlStateManager.enableAlpha();
  GlStateManager.enableTexture2D();
  GlStateManager.enableDepth();
  GlStateManager.enableCull();
  GlStateManager.popMatrix();
}
 
Example 12
Source File: LiftLeverTileEntityRenderer.java    From Valkyrien-Skies with Apache License 2.0 4 votes vote down vote up
@Override
public void render(TileEntityLiftLever tileentity, double x, double y, double z,
    float partialTick,
    int destroyStage, float alpha) {

    this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    GlStateManager.pushMatrix();
    GlStateManager.disableLighting();

    GlStateManager.translate(x, y, z);
    GlStateManager.disableAlpha();
    GlStateManager.disableBlend();
    GlStateManager.pushMatrix();

    int brightness = tileentity.getWorld().getCombinedLight(tileentity.getPos(), 0);
    IBlockState gearState = Minecraft.getMinecraft().world.getBlockState(tileentity.getPos());
    if (gearState.getBlock() instanceof BlockLiftLever) {
        EnumFacing facing = gearState.getValue(BlockHorizontal.FACING);

        GlStateManager.translate(0.5, 0.5, 0.5);
        switch (facing) {
            case UP:
                GL11.glRotated(90, 1, 0, 0);
                break;
            case DOWN:
                GL11.glRotated(270, 1, 0, 0);
                break;
            case NORTH:
                GL11.glRotated(0, 0, 1, 0);
                break;
            case EAST:
                GL11.glRotated(270, 0, 1, 0);
                break;
            case SOUTH:
                GL11.glRotated(180, 0, 1, 0);
                break;
            case WEST:
                GL11.glRotated(90, 0, 1, 0);
                break;
        }
        GlStateManager.translate(-0.5, -0.5, -0.5);
    }

    float leverOffset = tileentity.getPrevLeverOffset()
        + (tileentity.getLeverOffset() - tileentity.getPrevLeverOffset()) * partialTick;

    // double keyframe = ((Minecraft.getMinecraft().world.getTotalWorldTime() + partialTick) % 44) + 1;

    double keyframe = (44 * leverOffset) + 1;
    GibsAnimationRegistry.getAnimation("lift_lever").renderAnimation(keyframe, brightness);

    GlStateManager.popMatrix();
    GlStateManager.popMatrix();
    GlStateManager.enableLighting();
    GlStateManager.resetColor();
}
 
Example 13
Source File: RenderUtils.java    From ForgeHax with MIT License 4 votes vote down vote up
public static void drawBox(
    Vec3d startPos, Vec3d endPos, int color, float width, boolean ignoreZ) {
  Tessellator tessellator = Tessellator.getInstance();
  BufferBuilder buffer = tessellator.getBuffer();
  
  Vec3d renderPos = EntityUtils.getInterpolatedPos(getLocalPlayer(), MC.getRenderPartialTicks());
  
  Vec3d min = startPos.subtract(renderPos);
  Vec3d max = endPos.subtract(renderPos);
  
  double minX = min.x, minY = min.y, minZ = min.z;
  double maxX = max.x, maxY = max.y, maxZ = max.z;
  
  float r = (float) (color >> 16 & 255) / 255.0F;
  float g = (float) (color >> 8 & 255) / 255.0F;
  float b = (float) (color & 255) / 255.0F;
  float a = (float) (color >> 24 & 255) / 255.0F;
  
  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.glLineWidth(width);
  
  if (ignoreZ) {
    GlStateManager.disableDepth();
  }
  
  GlStateManager.color(r, g, b, a);
  
  // GlStateManager.translate(startPos.xCoord, startPos.yCoord, startPos.zCoord);
  
  buffer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
  buffer.pos(minX, minY, minZ).endVertex();
  buffer.pos(maxX, minY, minZ).endVertex();
  buffer.pos(maxX, minY, maxZ).endVertex();
  buffer.pos(minX, minY, maxZ).endVertex();
  buffer.pos(minX, minY, minZ).endVertex();
  tessellator.draw();
  buffer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION);
  buffer.pos(minX, maxY, minZ).endVertex();
  buffer.pos(maxX, maxY, minZ).endVertex();
  buffer.pos(maxX, maxY, maxZ).endVertex();
  buffer.pos(minX, maxY, maxZ).endVertex();
  buffer.pos(minX, maxY, minZ).endVertex();
  tessellator.draw();
  buffer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION);
  buffer.pos(minX, minY, minZ).endVertex();
  buffer.pos(minX, maxY, minZ).endVertex();
  buffer.pos(maxX, minY, minZ).endVertex();
  buffer.pos(maxX, maxY, minZ).endVertex();
  buffer.pos(maxX, minY, maxZ).endVertex();
  buffer.pos(maxX, maxY, maxZ).endVertex();
  buffer.pos(minX, minY, maxZ).endVertex();
  buffer.pos(minX, maxY, maxZ).endVertex();
  tessellator.draw();
  
  GlStateManager.shadeModel(GL11.GL_FLAT);
  GlStateManager.disableBlend();
  GlStateManager.enableAlpha();
  GlStateManager.enableTexture2D();
  GlStateManager.enableDepth();
  GlStateManager.enableCull();
  GlStateManager.popMatrix();
}
 
Example 14
Source File: ProjectilesModule.java    From seppuku with GNU General Public License v3.0 4 votes vote down vote up
@Listener
public void onRender(EventRender3D event) {
    final Minecraft mc = Minecraft.getMinecraft();

    ThrowableType throwingType = this.getTypeFromCurrentItem(mc.player);

    if (throwingType == ThrowableType.NONE) {
        return;
    }

    FlightPath flightPath = new FlightPath(mc.player, throwingType);

    while (!flightPath.isCollided()) {
        flightPath.onUpdate();

        flightPoint.offer(new Vec3d(flightPath.position.x - mc.getRenderManager().viewerPosX,
                flightPath.position.y - mc.getRenderManager().viewerPosY,
                flightPath.position.z - mc.getRenderManager().viewerPosZ));
    }

    final boolean bobbing = mc.gameSettings.viewBobbing;
    mc.gameSettings.viewBobbing = false;
    mc.entityRenderer.setupCameraTransform(event.getPartialTicks(), 0);
    GlStateManager.pushMatrix();
    GlStateManager.disableTexture2D();
    GlStateManager.enableBlend();
    GlStateManager.disableAlpha();
    GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
    GlStateManager.shadeModel(GL_SMOOTH);
    glLineWidth(width.getValue());
    glEnable(GL_LINE_SMOOTH);
    glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
    GlStateManager.disableDepth();
    glEnable(GL32.GL_DEPTH_CLAMP);
    final Tessellator tessellator = Tessellator.getInstance();
    final BufferBuilder bufferbuilder = tessellator.getBuffer();

    while (!flightPoint.isEmpty()) {
        bufferbuilder.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR);
        Vec3d head = flightPoint.poll();
        bufferbuilder.pos(head.x, head.y, head.z).color(red.getValue() / 255.0f, green.getValue() / 255.0f, blue.getValue() / 255.0f, alpha.getValue() / 255.0f).endVertex();

        if (flightPoint.peek() != null) {
            Vec3d point = flightPoint.peek();
            bufferbuilder.pos(point.x, point.y, point.z).color(red.getValue() / 255.0f, green.getValue() / 255.0f, blue.getValue() / 255.0f, alpha.getValue() / 255.0f).endVertex();
        }

        tessellator.draw();
    }

    GlStateManager.shadeModel(GL_FLAT);
    glDisable(GL_LINE_SMOOTH);
    GlStateManager.enableDepth();
    glDisable(GL32.GL_DEPTH_CLAMP);
    GlStateManager.disableBlend();
    GlStateManager.enableAlpha();
    GlStateManager.enableTexture2D();
    GlStateManager.popMatrix();

    mc.gameSettings.viewBobbing = bobbing;
    mc.entityRenderer.setupCameraTransform(event.getPartialTicks(), 0);

    if (flightPath.collided) {
        final RayTraceResult hit = flightPath.target;
        AxisAlignedBB bb = null;

        if (hit.typeOfHit == RayTraceResult.Type.BLOCK) {
            final BlockPos blockpos = hit.getBlockPos();
            final IBlockState iblockstate = mc.world.getBlockState(blockpos);

            if (iblockstate.getMaterial() != Material.AIR && mc.world.getWorldBorder().contains(blockpos)) {
                final Vec3d interp = MathUtil.interpolateEntity(mc.player, mc.getRenderPartialTicks());
                bb = iblockstate.getSelectedBoundingBox(mc.world, blockpos).grow(0.0020000000949949026D).offset(-interp.x, -interp.y, -interp.z);
            }
        } else if (hit.typeOfHit == RayTraceResult.Type.ENTITY && hit.entityHit != null) {
            final AxisAlignedBB entityBB = hit.entityHit.getEntityBoundingBox();
            if (entityBB != null) {
                bb = new AxisAlignedBB(entityBB.minX - mc.getRenderManager().viewerPosX, entityBB.minY - mc.getRenderManager().viewerPosY, entityBB.minZ - mc.getRenderManager().viewerPosZ, entityBB.maxX - mc.getRenderManager().viewerPosX, entityBB.maxY - mc.getRenderManager().viewerPosY, entityBB.maxZ - mc.getRenderManager().viewerPosZ);
            }
        }

        if (bb != null) {
            RenderUtil.drawBoundingBox(bb, width.getValue(), red.getValue() / 255.0f, green.getValue() / 255.0f, blue.getValue() / 255.0f, alpha.getValue() / 255.0f);
        }
    }
}
 
Example 15
Source File: GiantPropellerPartTileEntityRenderer.java    From Valkyrien-Skies with Apache License 2.0 4 votes vote down vote up
@Override
public void render(TileEntityGiantPropellerPart tileentity, double x, double y, double z,
    float partialTick,
    int destroyStage, float alpha) {
    Tessellator tessellator = Tessellator.getInstance();
    this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    GlStateManager.pushMatrix();
    GlStateManager.disableLighting();

    GlStateManager.translate(x, y, z);
    GlStateManager.disableAlpha();
    GlStateManager.disableBlend();

    int brightness = tileentity.getWorld().getCombinedLight(tileentity.getPos(), 0);

    if (!tileentity.isPartOfAssembledMultiblock()) {
        GlStateManager.pushMatrix();
        // GibsModelRegistry.renderGibsModel("aipropeller_geo", brightness);
        GibsAnimationRegistry.getAnimation("giant_propeller").renderAnimation(1, brightness);
        GlStateManager.popMatrix();
    } else if (tileentity.isMaster()) {
        GlStateManager.pushMatrix();
        EnumFacing propellerFacing = tileentity.getPropellerFacing();
        int propellerRadius = (tileentity.getPropellerRadius() * 2) + 1;

        GlStateManager.translate(.5, .5, .5);
        GlStateManager.scale(propellerRadius, propellerRadius, propellerRadius);

        switch (propellerFacing) {
            case NORTH:
                GlStateManager.rotate(180, 0, 1, 0);
                break;
            case EAST:
                GlStateManager.rotate(90, 0, 1, 0);
                break;
            case SOUTH:
                // GlStateManager.rotate(0,0,1,0);
                break;
            case WEST:
                GlStateManager.rotate(270, 0, 1, 0);
                break;
            case UP:
                GlStateManager.rotate(-90, 1, 0, 0);
                break;
            case DOWN:
                GlStateManager.rotate(90, 1, 0, 0);
                break;
        }

        GlStateManager.rotate(tileentity.getPropellerAngle(partialTick), 0, 0, 1);
        GlStateManager.translate(-.5, -.5, -.5);

        // GibsModelRegistry.renderGibsModel("propeller_geo", brightness);
        GibsAnimationRegistry.getAnimation("giant_propeller").renderAnimation(1, brightness);
        GlStateManager.popMatrix();
    }
    GlStateManager.popMatrix();
}
 
Example 16
Source File: MixinGuiSlot.java    From LiquidBounce with GNU General Public License v3.0 4 votes vote down vote up
/**
 * @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 17
Source File: MixinGuiSlot.java    From LiquidBounce with GNU General Public License v3.0 4 votes vote down vote up
/**
 * @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);
        }

        this.drawSelectionBox(k, l + 2, mouseXIn, mouseYIn + 2);
        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((double) this.left, (double) (this.top + i1), 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 0).endVertex();
        worldrenderer.pos((double) this.right, (double) (this.top + i1), 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 0).endVertex();
        worldrenderer.pos((double) this.right, (double) this.top, 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 255).endVertex();
        worldrenderer.pos((double) this.left, (double) 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((double) this.left, (double) this.bottom, 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 255).endVertex();
        worldrenderer.pos((double) this.right, (double) this.bottom, 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 255).endVertex();
        worldrenderer.pos((double) this.right, (double) (this.bottom - i1), 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 0).endVertex();
        worldrenderer.pos((double) this.left, (double) (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((double) i, (double) this.bottom, 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 255).endVertex();
            worldrenderer.pos((double) j, (double) this.bottom, 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 255).endVertex();
            worldrenderer.pos((double) j, (double) this.top, 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 255).endVertex();
            worldrenderer.pos((double) i, (double) 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((double) i, (double) (l1 + k1), 0.0D).tex(0.0D, 1.0D).color(128, 128, 128, 255).endVertex();
            worldrenderer.pos((double) j, (double) (l1 + k1), 0.0D).tex(1.0D, 1.0D).color(128, 128, 128, 255).endVertex();
            worldrenderer.pos((double) j, (double) l1, 0.0D).tex(1.0D, 0.0D).color(128, 128, 128, 255).endVertex();
            worldrenderer.pos((double) i, (double) 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((double) i, (double) (l1 + k1 - 1), 0.0D).tex(0.0D, 1.0D).color(192, 192, 192, 255).endVertex();
            worldrenderer.pos((double) (j - 1), (double) (l1 + k1 - 1), 0.0D).tex(1.0D, 1.0D).color(192, 192, 192, 255).endVertex();
            worldrenderer.pos((double) (j - 1), (double) l1, 0.0D).tex(1.0D, 0.0D).color(192, 192, 192, 255).endVertex();
            worldrenderer.pos((double) i, (double) 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 18
Source File: WrapperGlStateManager.java    From ClientBase with MIT License 4 votes vote down vote up
public static void disableAlpha() {
    GlStateManager.disableAlpha();
}
 
Example 19
Source File: RocketEventHandler.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
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 20
Source File: RenderBeam.java    From TofuCraftReload with MIT License 4 votes vote down vote up
/**
 * 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);
}