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

The following examples show how to use net.minecraft.client.renderer.GlStateManager#disableTexture2D() . 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: RenderUtils.java    From Hyperium with GNU Lesser General Public License v3.0 7 votes vote down vote up
public static void drawLine(float x, float y, float x1, float y1, float width, int colour) {
    float red = (float) (colour >> 16 & 0xFF) / 255F;
    float green = (float) (colour >> 8 & 0xFF) / 255F;
    float blue = (float) (colour & 0xFF) / 255F;
    float alpha = (float) (colour >> 24 & 0xFF) / 255F;

    GlStateManager.enableBlend();
    GlStateManager.disableTexture2D();
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);

    GlStateManager.pushMatrix();
    GlStateManager.color(red, green, blue, alpha);
    GL11.glLineWidth(width);
    GL11.glBegin(GL11.GL_LINE_STRIP);
    GL11.glVertex2f(x, y);
    GL11.glVertex2f(x1, y1);
    GL11.glEnd();
    GlStateManager.popMatrix();

    GlStateManager.enableTexture2D();
    GlStateManager.disableBlend();
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
 
Example 2
Source File: RenderUtil.java    From seppuku with GNU General Public License v3.0 6 votes vote down vote up
public static void drawRect(float x, float y, float w, float h, int color) {
    float alpha = (float) (color >> 24 & 255) / 255.0F;
    float red = (float) (color >> 16 & 255) / 255.0F;
    float green = (float) (color >> 8 & 255) / 255.0F;
    float blue = (float) (color & 255) / 255.0F;
    final Tessellator tessellator = Tessellator.getInstance();
    final BufferBuilder bufferbuilder = tessellator.getBuffer();
    GlStateManager.enableBlend();
    GlStateManager.disableTexture2D();
    GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
    bufferbuilder.begin(7, DefaultVertexFormats.POSITION_COLOR);
    bufferbuilder.pos((double) x, (double) h, 0.0D).color(red, green, blue, alpha).endVertex();
    bufferbuilder.pos((double) w, (double) h, 0.0D).color(red, green, blue, alpha).endVertex();
    bufferbuilder.pos((double) w, (double) y, 0.0D).color(red, green, blue, alpha).endVertex();
    bufferbuilder.pos((double) x, (double) y, 0.0D).color(red, green, blue, alpha).endVertex();
    tessellator.draw();
    GlStateManager.enableTexture2D();
    GlStateManager.disableBlend();
}
 
Example 3
Source File: GuiItemHandlerDestination.java    From Signals with GNU General Public License v3.0 6 votes vote down vote up
private static void drawRedCross(int x, int y){
    int size = 16;
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder bufferBuilder = tessellator.getBuffer();
    GlStateManager.disableTexture2D();
    GlStateManager.disableDepth();
    GlStateManager.color(1, 0, 0);
    bufferBuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);

    bufferBuilder.pos(x, y + 1, 0.0D).endVertex();
    bufferBuilder.pos(x + size - 1, y + size, 0.0D).endVertex();
    bufferBuilder.pos(x + size, y + size - 1, 0.0D).endVertex();
    bufferBuilder.pos(x + 1, y, 0.0D).endVertex();

    bufferBuilder.pos(x, y + size - 1, 0.0D).endVertex();
    bufferBuilder.pos(x + 1, y + size, 0.0D).endVertex();
    bufferBuilder.pos(x + size, y + 1, 0.0D).endVertex();
    bufferBuilder.pos(x + size - 1, y, 0.0D).endVertex();

    tessellator.draw();
    GlStateManager.enableTexture2D();
    GlStateManager.enableDepth();
}
 
Example 4
Source File: PlayerOverlay.java    From MediaMod with GNU General Public License v3.0 5 votes vote down vote up
public static void drawRect(double left, double top, double right, double bottom, int color) {
    if (left < right) {
        double i = left;
        left = right;
        right = i;
    }

    if (top < bottom) {
        double j = top;
        top = bottom;
        bottom = j;
    }

    float f3 = (float) (color >> 24 & 255) / 255.0F;
    float f = (float) (color >> 16 & 255) / 255.0F;
    float f1 = (float) (color >> 8 & 255) / 255.0F;
    float f2 = (float) (color & 255) / 255.0F;
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    GlStateManager.enableBlend();
    GlStateManager.disableTexture2D();
    GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
    GlStateManager.color(f, f1, f2, f3);
    worldrenderer.begin(7, DefaultVertexFormats.POSITION);
    worldrenderer.pos(left, bottom, 0.0D).endVertex();
    worldrenderer.pos(right, bottom, 0.0D).endVertex();
    worldrenderer.pos(right, top, 0.0D).endVertex();
    worldrenderer.pos(left, top, 0.0D).endVertex();
    tessellator.draw();
    GlStateManager.enableTexture2D();
    GlStateManager.disableBlend();
}
 
Example 5
Source File: LitematicaRenderer.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void renderSchematicOverlay()
{
    boolean invert = Hotkeys.INVERT_OVERLAY_RENDER_STATE.getKeybind().isKeybindHeld();

    if (Configs.Visuals.ENABLE_SCHEMATIC_OVERLAY.getBooleanValue() != invert)
    {
        boolean renderThrough = Configs.Visuals.SCHEMATIC_OVERLAY_RENDER_THROUGH.getBooleanValue() || Hotkeys.RENDER_OVERLAY_THROUGH_BLOCKS.getKeybind().isKeybindHeld();
        float lineWidth = (float) (renderThrough ? Configs.Visuals.SCHEMATIC_OVERLAY_OUTLINE_WIDTH_THROUGH.getDoubleValue() : Configs.Visuals.SCHEMATIC_OVERLAY_OUTLINE_WIDTH.getDoubleValue());

        GlStateManager.pushMatrix();
        GlStateManager.disableTexture2D();
        GlStateManager.disableCull();
        GlStateManager.alphaFunc(GL11.GL_GREATER, 0.001F);
        GlStateManager.enablePolygonOffset();
        GlStateManager.doPolygonOffset(-0.4f, -0.8f);
        fi.dy.masa.malilib.render.RenderUtils.setupBlend();
        GlStateManager.glLineWidth(lineWidth);
        fi.dy.masa.malilib.render.RenderUtils.color(1f, 1f, 1f, 1f);
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);

        if (renderThrough)
        {
            GlStateManager.disableDepth();
        }

        this.getWorldRenderer().renderBlockOverlays();

        GlStateManager.enableDepth();
        GlStateManager.doPolygonOffset(0f, 0f);
        GlStateManager.disablePolygonOffset();
        GlStateManager.enableTexture2D();
        GlStateManager.popMatrix();
    }
}
 
Example 6
Source File: MixinRenderGlobal.java    From Valkyrien-Skies with Apache License 2.0 5 votes vote down vote up
private void drawSelectionBoxOriginal(EntityPlayer player,
    RayTraceResult movingObjectPositionIn,
    int execute, float partialTicks) {
    if (execute == 0 && movingObjectPositionIn.typeOfHit == RayTraceResult.Type.BLOCK) {
        GlStateManager.enableBlend();
        GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA,
            GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE,
            GlStateManager.DestFactor.ZERO);
        GlStateManager.glLineWidth(2.0F);
        GlStateManager.disableTexture2D();
        GlStateManager.depthMask(false);
        BlockPos blockpos = movingObjectPositionIn.getBlockPos();
        IBlockState iblockstate = this.world.getBlockState(blockpos);

        if (iblockstate.getMaterial() != Material.AIR && this.world.getWorldBorder()
            .contains(blockpos)) {
            double d0 =
                player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks;
            double d1 =
                player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks;
            double d2 =
                player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks;
            drawSelectionBoundingBox(iblockstate.getSelectedBoundingBox(this.world, blockpos)
                .grow(0.0020000000949949026D).offset(-d0, -d1, -d2), 0.0F, 0.0F, 0.0F, 0.4F);
        }

        GlStateManager.depthMask(true);
        GlStateManager.enableTexture2D();
        GlStateManager.disableBlend();
    }
}
 
Example 7
Source File: Notification.java    From ClientBase with MIT License 5 votes vote down vote up
public static void drawRect(double left, double top, double right, double bottom, int color) {
    if (left < right) {
        double i = left;
        left = right;
        right = i;
    }

    if (top < bottom) {
        double j = top;
        top = bottom;
        bottom = j;
    }

    float f3 = (float) (color >> 24 & 255) / 255.0F;
    float f = (float) (color >> 16 & 255) / 255.0F;
    float f1 = (float) (color >> 8 & 255) / 255.0F;
    float f2 = (float) (color & 255) / 255.0F;
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    GlStateManager.enableBlend();
    GlStateManager.disableTexture2D();
    GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
    GlStateManager.color(f, f1, f2, f3);
    worldrenderer.begin(7, DefaultVertexFormats.POSITION);
    worldrenderer.pos(left, bottom, 0.0D).endVertex();
    worldrenderer.pos(right, bottom, 0.0D).endVertex();
    worldrenderer.pos(right, top, 0.0D).endVertex();
    worldrenderer.pos(left, top, 0.0D).endVertex();
    tessellator.draw();
    GlStateManager.enableTexture2D();
    GlStateManager.disableBlend();
}
 
Example 8
Source File: WrenchOverlayRenderer.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
public static void onDrawBlockHighlight(DrawBlockHighlightEvent event) {
    EntityPlayer player = event.getPlayer();
    World world = player.world;
    RayTraceResult target = event.getTarget();

    if (target.typeOfHit != RayTraceResult.Type.BLOCK) {
        return; //magically, draw block highlight is called not only for blocks (see forge issues)
    }

    BlockPos pos = target.getBlockPos();
    IBlockState blockState = world.getBlockState(pos);
    TileEntity tileEntity = world.getTileEntity(pos);
    ItemStack heldItem = player.getHeldItem(EnumHand.MAIN_HAND);

    if (tileEntity != null && shouldDrawOverlayForItem(heldItem, tileEntity) && useGridForRayTraceResult(target)) {
        EnumFacing facing = target.sideHit;
        GlStateManager.enableBlend();
        GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
        GlStateManager.glLineWidth(2.0F);
        GlStateManager.disableTexture2D();
        GlStateManager.depthMask(false);

        if (world.getWorldBorder().contains(pos)) {
            double d3 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) event.getPartialTicks();
            double d4 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) event.getPartialTicks();
            double d5 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) event.getPartialTicks();
            AxisAlignedBB box = blockState.getSelectedBoundingBox(world, pos).grow(0.002D).offset(-d3, -d4, -d5);
            RenderGlobal.drawSelectionBoundingBox(box, 0.0F, 0.0F, 0.0F, 0.4F);
            drawOverlayLines(facing, box);
        }

        GlStateManager.depthMask(true);
        GlStateManager.enableTexture2D();
        GlStateManager.disableBlend();

        event.setCanceled(true);
    }
}
 
Example 9
Source File: Hud.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Draws a solid color rectangle with the specified coordinates and color.
 */
public static void drawRect(int left, int top, int right, int bottom, int color) {
	if (left < right) {
		int i = left;
		left = right;
		right = i;
	}

	if (top < bottom) {
		int j = top;
		top = bottom;
		bottom = j;
	}



	float f3 = (float) (color >> 24 & 255) / 255.0F;
	float f = (float) (color >> 16 & 255) / 255.0F;
	float f1 = (float) (color >> 8 & 255) / 255.0F;
	float f2 = (float) (color & 255) / 255.0F;
	Tessellator tessellator = Tessellator.getInstance();
	BufferBuilder vertexbuffer = tessellator.getBuffer();
	GlStateManager.enableBlend();
	GlStateManager.disableTexture2D();
	GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
	GlStateManager.color(f, f1, f2, f3);
	vertexbuffer.begin(7, DefaultVertexFormats.POSITION);
	vertexbuffer.pos((double) left, (double) bottom, 0.0D).endVertex();
	vertexbuffer.pos((double) right, (double) bottom, 0.0D).endVertex();
	vertexbuffer.pos((double) right, (double) top, 0.0D).endVertex();
	vertexbuffer.pos((double) left, (double) top, 0.0D).endVertex();
	tessellator.draw();
	GlStateManager.enableTexture2D();
	GlStateManager.disableBlend();
}
 
Example 10
Source File: SurfaceHelper.java    From ForgeHax with MIT License 5 votes vote down vote up
public static void drawLine(int x1, int y1, int x2, int y2, int color, float width) {
  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;
  Tessellator tessellator = Tessellator.getInstance();
  BufferBuilder BufferBuilder = tessellator.getBuffer();
  
  GlStateManager.enableBlend();
  GlStateManager.disableTexture2D();
  GlStateManager.tryBlendFuncSeparate(
      GlStateManager.SourceFactor.SRC_ALPHA,
      GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA,
      GlStateManager.SourceFactor.ONE,
      GlStateManager.DestFactor.ZERO);
  GlStateManager.color(r, g, b, a);
  
  GL11.glLineWidth(width);
  
  BufferBuilder.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION);
  BufferBuilder.pos(x1, y1, 0.0D).endVertex();
  BufferBuilder.pos(x2, y2, 0.0D).endVertex();
  tessellator.draw();
  
  GlStateManager.color(1f, 1f, 1f);
  GlStateManager.enableTexture2D();
  GlStateManager.disableBlend();
}
 
Example 11
Source File: GlyphPageFontRenderer.java    From ClientBase with MIT License 5 votes vote down vote up
private void doDraw(float f, GlyphPage glyphPage) {
    if (this.strikethroughStyle) {
        Tessellator tessellator = Tessellator.getInstance();
        WorldRenderer worldrenderer = tessellator.getWorldRenderer();
        GlStateManager.disableTexture2D();
        worldrenderer.begin(7, DefaultVertexFormats.POSITION);
        worldrenderer.pos((double) this.posX, (double) (this.posY + (float) (glyphPage.getMaxFontHeight() / 2)), 0.0D).endVertex();
        worldrenderer.pos((double) (this.posX + f), (double) (this.posY + (float) (glyphPage.getMaxFontHeight() / 2)), 0.0D).endVertex();
        worldrenderer.pos((double) (this.posX + f), (double) (this.posY + (float) (glyphPage.getMaxFontHeight() / 2) - 1.0F), 0.0D).endVertex();
        worldrenderer.pos((double) this.posX, (double) (this.posY + (float) (glyphPage.getMaxFontHeight() / 2) - 1.0F), 0.0D).endVertex();
        tessellator.draw();
        GlStateManager.enableTexture2D();
    }

    if (this.underlineStyle) {
        Tessellator tessellator1 = Tessellator.getInstance();
        WorldRenderer worldrenderer1 = tessellator1.getWorldRenderer();
        GlStateManager.disableTexture2D();
        worldrenderer1.begin(7, DefaultVertexFormats.POSITION);
        int l = this.underlineStyle ? -1 : 0;
        worldrenderer1.pos((double) (this.posX + (float) l), (double) (this.posY + (float) glyphPage.getMaxFontHeight()), 0.0D).endVertex();
        worldrenderer1.pos((double) (this.posX + f), (double) (this.posY + (float) glyphPage.getMaxFontHeight()), 0.0D).endVertex();
        worldrenderer1.pos((double) (this.posX + f), (double) (this.posY + (float) glyphPage.getMaxFontHeight() - 1.0F), 0.0D).endVertex();
        worldrenderer1.pos((double) (this.posX + (float) l), (double) (this.posY + (float) glyphPage.getMaxFontHeight() - 1.0F), 0.0D).endVertex();
        tessellator1.draw();
        GlStateManager.enableTexture2D();
    }

    this.posX += f;
}
 
Example 12
Source File: WrapperGlStateManager.java    From ClientBase with MIT License 4 votes vote down vote up
public static void disableTexture2D() {
    GlStateManager.disableTexture2D();
}
 
Example 13
Source File: RenderPrimedCharge.java    From EnderZoo with Creative Commons Zero v1.0 Universal 4 votes vote down vote up
@Override
public void doRender(EntityPrimedCharge entity, double x, double y, double z, float p_76986_8_, float partialTicks) {

  BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
  GlStateManager.pushMatrix();
  GlStateManager.translate((float) x, (float) y + 0.5F, (float) z);
  float f2;

  if ((float) entity.fuse - partialTicks + 1.0F < 10.0F) {
    f2 = 1.0F - ((float) entity.fuse - partialTicks + 1.0F) / 10.0F;
    f2 = MathHelper.clamp(f2, 0.0F, 1.0F);
    f2 *= f2;
    f2 *= f2;
    float f3 = 1.0F + f2 * 0.3F;
    GlStateManager.scale(f3, f3, f3);
  }

  f2 = (1.0F - ((float) entity.fuse - partialTicks + 1.0F) / 100.0F) * 0.8F;
  this.bindEntityTexture(entity);
  GlStateManager.translate(-0.5F, -0.5F, 0.5F);
  blockrendererdispatcher.renderBlockBrightness(entity.getBlock().getDefaultState(), entity.getBrightness());
  GlStateManager.translate(0.0F, 0.0F, 1.0F);

  if (entity.fuse / 5 % 2 == 0) {
    GlStateManager.disableTexture2D();
    GlStateManager.disableLighting();
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(770, 772);
    GlStateManager.color(1.0F, 1.0F, 1.0F, f2);
    GlStateManager.doPolygonOffset(-3.0F, -3.0F);
    GlStateManager.enablePolygonOffset();
    blockrendererdispatcher.renderBlockBrightness(entity.getBlock().getDefaultState(), 1.0F);
    GlStateManager.doPolygonOffset(0.0F, 0.0F);
    GlStateManager.disablePolygonOffset();
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    GlStateManager.disableBlend();
    GlStateManager.enableLighting();
    GlStateManager.enableTexture2D();
  }

  GlStateManager.popMatrix();
  super.doRender(entity, x, y, z, p_76986_8_, partialTicks);
}
 
Example 14
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 15
Source File: TextureHelper.java    From malmo with MIT License 4 votes vote down vote up
public void render(float partialTicks, WorldClient world, Minecraft mc)
{
    // Adapted from the End sky renderer - just fill with solid colour.
    GlStateManager.disableFog();
    GlStateManager.disableAlpha();
    GlStateManager.disableBlend();
    RenderHelper.disableStandardItemLighting();
    GlStateManager.depthMask(false);
    GlStateManager.disableTexture2D();
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();

    for (int i = 0; i < 6; ++i)
    {
        GlStateManager.pushMatrix();

        if (i == 1)
        {
            GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
        }

        if (i == 2)
        {
            GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F);
        }

        if (i == 3)
        {
            GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F);
        }

        if (i == 4)
        {
            GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
        }

        if (i == 5)
        {
            GlStateManager.rotate(-90.0F, 0.0F, 0.0F, 1.0F);
        }

        vertexbuffer.begin(7, DefaultVertexFormats.POSITION_COLOR);
        vertexbuffer.pos(-100.0D, -100.0D, -100.0D).color(this.r, this.g, this.b, 255).endVertex();
        vertexbuffer.pos(-100.0D, -100.0D, 100.0D).color(this.r, this.g, this.b, 255).endVertex();
        vertexbuffer.pos(100.0D, -100.0D, 100.0D).color(this.r, this.g, this.b, 255).endVertex();
        vertexbuffer.pos(100.0D, -100.0D, -100.0D).color(this.r, this.g, this.b, 255).endVertex();
        tessellator.draw();
        GlStateManager.popMatrix();
    }

    GlStateManager.depthMask(true);
    GlStateManager.enableTexture2D();
    GlStateManager.enableAlpha();
}
 
Example 16
Source File: ClientEventHandler.java    From Signals with GNU General Public License v3.0 4 votes vote down vote up
@SubscribeEvent
public void onWorldRender(RenderWorldLastEvent event){
    Tessellator t = Tessellator.getInstance();
    BufferBuilder b = t.getBuffer();

    EntityPlayer player = Minecraft.getMinecraft().player;
    if(!shouldRender()) return;

    double playerX = player.prevPosX + (player.posX - player.prevPosX) * event.getPartialTicks();
    double playerY = player.prevPosY + (player.posY - player.prevPosY) * event.getPartialTicks();
    double playerZ = player.prevPosZ + (player.posZ - player.prevPosZ) * event.getPartialTicks();
    int dimensionID = player.world.provider.getDimension();
    GL11.glPushMatrix();
    GL11.glTranslated(-playerX, -playerY, -playerZ);

    GL11.glPointSize(10);

    GlStateManager.disableTexture2D();
    GlStateManager.disableLighting();
    b.setTranslation(0, 0, 0);

    NetworkVisualizationSettings visualizationSettings = player.isSneaking() ? SignalsConfig.client.networkVisualization.sneaking : SignalsConfig.client.networkVisualization.notSneaking;
    switch(visualizationSettings.renderType){
        case EDGES:
            edgeRenderer.render(dimensionID, b);
            break;
        case PATHS:
            pathRenderer.render(dimensionID, b);
            break;
        case SECTION:
            blockSectionRenderer.render(dimensionID, b);
            break;
    }
    //claimRenderer.render(b);
    if(visualizationSettings.renderDirectionality) {
        directionalityRenderer.render(dimensionID, b);
    }

    b.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);

    List<NetworkStation<MCPos>> stations = RailNetworkManager.getClientInstance().getNetwork().railObjects.getStations();
    for(int i = 0; i < stations.size(); i++) {
        NetworkStation<MCPos> station1 = stations.get(i);
        if(station1.getPos().getDimID() != dimensionID) continue;
        for(int j = 0; j < i; j++) {
            NetworkStation<MCPos> station2 = stations.get(j);
            if(station2.getPos().getDimID() != dimensionID) continue;

            if(station1.stationName.equals(station2.stationName) && station1.getPos().getDimID() == station2.getPos().getDimID()) {
                drawBetween(b, station1.getPos().getPos(), station2.getPos().getPos(), 1, 0, 1, 0, 1);
            }
        }
    }

    t.draw();

    GlStateManager.enableTexture2D();
    GlStateManager.enableLighting();
    GL11.glPopMatrix();
}
 
Example 17
Source File: SurfaceBuilder.java    From ForgeHax with MIT License 4 votes vote down vote up
public static void disableTexture2D() {
  GlStateManager.disableTexture2D();
}
 
Example 18
Source File: RenderCodex.java    From Wizardry with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void renderItemStack(ItemStack stack) {
	GlStateManager.enableAlpha();
	GlStateManager.enableBlend();
	GlStateManager.enableRescaleNormal();

	GlStateManager.pushMatrix();

	RenderItem itemRender = Minecraft.getMinecraft().getRenderItem();
	itemRender.renderItemAndEffectIntoGUI(stack, 0, 0);

	GlStateManager.translate(0, 0, 150);

	FontRenderer font = stack.getItem().getFontRenderer(stack);
	if (font == null) font = Minecraft.getMinecraft().fontRenderer;

	if (font != null && stack.getCount() != 1) {
		GlStateManager.translate(0, 0, 5);
		GlStateManager.disableLighting();
		GlStateManager.disableBlend();
		font.drawStringWithShadow(stack.getCount() + "",
				17F - font.getStringWidth(stack.getCount() + ""),
				9F,
				0xFFFFFF);
		GlStateManager.enableDepth();
		GlStateManager.enableBlend();
		GlStateManager.translate(0, 0, -5);
	}

	if (stack.getItem().showDurabilityBar(stack)) {
		GlStateManager.disableLighting();
		GlStateManager.disableTexture2D();
		GlStateManager.disableAlpha();
		GlStateManager.disableBlend();
		Tessellator tessellator = Tessellator.getInstance();
		BufferBuilder bufferbuilder = tessellator.getBuffer();
		double health = stack.getItem().getDurabilityForDisplay(stack);
		int rgbfordisplay = stack.getItem().getRGBDurabilityForDisplay(stack);
		int i = Math.round(13.0F - (float) health * 13.0F);
		draw(bufferbuilder, 2, 13, 13, 2, 0, 0, 0, 255);
		draw(bufferbuilder, 2, 13, i, 1, rgbfordisplay >> 16 & 255, rgbfordisplay >> 8 & 255, rgbfordisplay & 255, 255);
		GlStateManager.enableBlend();
		GlStateManager.enableAlpha();
		GlStateManager.enableTexture2D();
		GlStateManager.enableLighting();
	}


	EntityPlayerSP entityplayersp = Minecraft.getMinecraft().player;
	float f3 = entityplayersp == null ? 0.0F : entityplayersp.getCooldownTracker().getCooldown(stack.getItem(), Minecraft.getMinecraft().getRenderPartialTicks());

	if (f3 > 0.0F) {
		GlStateManager.disableLighting();
		GlStateManager.disableTexture2D();
		Tessellator tessellator1 = Tessellator.getInstance();
		BufferBuilder bufferbuilder1 = tessellator1.getBuffer();
		this.draw(bufferbuilder1, 0, MathHelper.floor(16.0F * (1.0F - f3)), 16, MathHelper.ceil(16.0F * f3), 255, 255, 255, 127);
		GlStateManager.enableTexture2D();
		GlStateManager.enableLighting();
	}

	GlStateManager.popMatrix();

	GlStateManager.enableLighting();
	GlStateManager.enableAlpha();
	GlStateManager.enableBlend();
	GlStateManager.disableRescaleNormal();
}
 
Example 19
Source File: BasicNodeTileEntityRenderer.java    From Valkyrien-Skies with Apache License 2.0 4 votes vote down vote up
private void renderWire(double x, double y, double z, double entity1x, double entity1y,
    double entity1z,
    double entity2x, double entity2y, double entity2z) {
    GlStateManager.enableAlpha();
    GlStateManager.enableBlend();
    float wireR = .6f;
    float wireG = .25f;
    float wireB = .02f;
    float wireAlpha = 1.0f;
    // Vec3d vec = new Vec3d(x,y,z);
    // if (vec.lengthSquared() < .01D) {
    // System.out.println("REE");
    // }
    // y = .5D;
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder bufferbuilder = tessellator.getBuffer();
    double d0 = 0;// this.interpolateValue(entity.prevRotationYaw, entity.rotationYaw,
    // partialTicks * 0.5F) * 0.01745329238474369D;
    double d1 = 0;// this.interpolateValue(entity.prevRotationPitch, entity.rotationPitch,
    // partialTicks * 0.5F) * 0.01745329238474369D;
    double d2 = Math.cos(d0);
    double d3 = Math.sin(d0);
    double d4 = Math.sin(d1);

    // if (entity instanceof EntityHanging)
    // {
    d4 = -1.0D;
    // }

    double fakeYaw = 0;// Math.PI / 6D;

    double d6 = entity1x;
    double d7 = entity1y;
    double d8 = entity1z;
    double d9 = fakeYaw;

    d2 = 0;// fakeWidth;;
    d3 = 0;// fakeWidth;
    double d10 = entity2x + d2;
    double d11 = entity2y;
    double d12 = entity2z + d3;
    x = x + d2;
    z = z + d3;
    double d13 = ((float) (d6 - d10));
    double d14 = ((float) (d7 - d11));
    double d15 = ((float) (d8 - d12));
    GlStateManager.disableTexture2D();
    GlStateManager.disableLighting();
    GlStateManager.disableCull();
    int i = 24;
    double d16 = 0.025D;
    bufferbuilder.begin(5, DefaultVertexFormats.POSITION_COLOR);

    for (int j = 0; j <= 24; ++j) {
        float f3 = j / 24.0F;
        bufferbuilder.pos(x + d13 * f3 + 0.0D,
            y + d14 * (f3 * f3 + f3) * 0.5D + ((24.0F - j) / 18.0F + 0.125F),
            z + d15 * f3).color(wireR, wireG, wireB, wireAlpha).endVertex();
        bufferbuilder
            .pos(x + d13 * f3 + 0.025D,
                y + d14 * (f3 * f3 + f3) * 0.5D + ((24.0F - j) / 18.0F + 0.125F) + 0.025D,
                z + d15 * f3)
            .color(wireR, wireG, wireB, wireAlpha).endVertex();
    }

    tessellator.draw();
    bufferbuilder.begin(5, DefaultVertexFormats.POSITION_COLOR);

    for (int k = 0; k <= 24; ++k) {
        float f4 = 204F / 255F;// .282F;//0.5F;
        float f5 = 122F / 255F;// .176F;//0.4F;
        float f6 = 0;// 0.078F;//0.3F;

        // f4 *= 2.2F;
        // f5 *= 2.2F;
        // f6 *= 2.2F;

        if (k % 2 == 0) {
            f4 *= 0.7F;
            f5 *= 0.7F;
            f6 *= 0.7F;
        }

        float f7 = k / 24.0F;
        bufferbuilder.pos(x + d13 * f7 + 0.0D,
            y + d14 * (f7 * f7 + f7) * 0.5D + ((24.0F - k) / 18.0F + 0.125F) + 0.025D,
            z + d15 * f7)
            .color(wireR, wireG, wireB, wireAlpha).endVertex();
        bufferbuilder.pos(x + d13 * f7 + 0.025D,
            y + d14 * (f7 * f7 + f7) * 0.5D + ((24.0F - k) / 18.0F + 0.125F),
            z + d15 * f7 + 0.025D).color(wireR, wireG, wireB, wireAlpha).endVertex();
    }

    tessellator.draw();
    GlStateManager.enableLighting();
    GlStateManager.enableTexture2D();
    GlStateManager.enableCull();

    GlStateManager.disableAlpha();
    GlStateManager.disableBlend();
}
 
Example 20
Source File: RenderUtils.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
public static void renderEntityDebugBoundingBox(Entity entityIn, float partialTicks, boolean renderLook, boolean renderEyeHeight)
{
    Entity renderViewEntity = Minecraft.getMinecraft().getRenderViewEntity();
    double x = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double)partialTicks;
    double y = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double)partialTicks;
    double z = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double)partialTicks;
    x -= renderViewEntity.lastTickPosX + (renderViewEntity.posX - renderViewEntity.lastTickPosX) * (double)partialTicks;
    y -= renderViewEntity.lastTickPosY + (renderViewEntity.posY - renderViewEntity.lastTickPosY) * (double)partialTicks;
    z -= renderViewEntity.lastTickPosZ + (renderViewEntity.posZ - renderViewEntity.lastTickPosZ) * (double)partialTicks;

    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    GlStateManager.depthMask(false);
    GlStateManager.disableTexture2D();
    GlStateManager.disableLighting();
    GlStateManager.disableCull();
    GlStateManager.disableBlend();
    GlStateManager.glLineWidth(1.0F);

    double entityRadius = entityIn.width / 2.0D;
    AxisAlignedBB bb = entityIn.getEntityBoundingBox();

    RenderGlobal.drawBoundingBox(bb.minX - entityIn.posX + x,
                                 bb.minY - entityIn.posY + y,
                                 bb.minZ - entityIn.posZ + z,
                                 bb.maxX - entityIn.posX + x,
                                 bb.maxY - entityIn.posY + y,
                                 bb.maxZ - entityIn.posZ + z,
                                 1.0F, 1.0F, 1.0F, 1.0F);

    if (renderEyeHeight && entityIn instanceof EntityLivingBase)
    {
        RenderGlobal.drawBoundingBox(x - entityRadius,
                                     y + entityIn.getEyeHeight() - 0.01D,
                                     z - entityRadius,
                                     x + entityRadius,
                                     y + entityIn.getEyeHeight() + 0.01D,
                                     z + entityRadius, 1.0F, 0.0F, 0.0F, 1.0F);
    }

    if (renderLook)
    {
        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder vertexbuffer = tessellator.getBuffer();
        Vec3d look = entityIn.getLook(partialTicks);
        vertexbuffer.begin(3, DefaultVertexFormats.POSITION_COLOR);
        vertexbuffer.pos(x, y + entityIn.getEyeHeight(), z).color(0, 0, 255, 255).endVertex();
        vertexbuffer.pos(x + look.x * 2.0D, y + entityIn.getEyeHeight() + look.y * 2.0D, z + look.z * 2.0D).color(0, 0, 255, 255).endVertex();
        tessellator.draw();
    }

    GlStateManager.enableTexture2D();
    GlStateManager.enableLighting();
    GlStateManager.enableCull();
    GlStateManager.disableBlend();
    GlStateManager.depthMask(true);
}