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

The following examples show how to use net.minecraft.client.renderer.GlStateManager#disableCull() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OptionScrollPane.java    From NotEnoughItems with MIT License 6 votes vote down vote up
public static void drawOverlayGrad(int x1, int x2, int y1, int y2, float zLevel) {
    GlStateManager.disableTexture2D();
    GlStateManager.disableCull();
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GlStateManager.shadeModel(GL11.GL_SMOOTH);
    WorldRenderer r = CCRenderState.startDrawing();
    r.setColorRGBA_I(0, 255);
    r.addVertex(x2, y1, zLevel);
    r.addVertex(x1, y1, zLevel);
    r.setColorRGBA_I(0, 0);
    r.addVertex(x1, y2, zLevel);
    r.addVertex(x2, y2, zLevel);
    CCRenderState.draw();
    GlStateManager.disableBlend();
    GlStateManager.enableCull();
    GlStateManager.enableTexture2D();
}
 
Example 2
Source File: OptionScrollPane.java    From NotEnoughItems with MIT License 6 votes vote down vote up
public static void drawOverlayGrad(int x1, int x2, int y1, int y2, float zLevel) {
    GlStateManager.disableTexture2D();
    GlStateManager.disableCull();
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GlStateManager.shadeModel(GL11.GL_SMOOTH);
    CCRenderState ccrs = CCRenderState.instance();

    BufferBuilder buffer = ccrs.startDrawing(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
    buffer.pos(x2, y1, zLevel).color(0, 0, 0, 255).endVertex();
    buffer.pos(x1, y1, zLevel).color(0, 0, 0, 255).endVertex();

    buffer.pos(x1, y2, zLevel).color(0, 0, 0, 0).endVertex();
    buffer.pos(x2, y2, zLevel).color(0, 0, 0, 0).endVertex();

    ccrs.draw();
    GlStateManager.disableBlend();
    GlStateManager.enableCull();
    GlStateManager.enableTexture2D();
}
 
Example 3
Source File: MetaTileEntityTESR.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void renderTileEntityFastPart(MetaTileEntityHolder te, double x, double y, double z, float partialTicks, int destroyStage) {
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder buffer = tessellator.getBuffer();
    this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    RenderHelper.disableStandardItemLighting();
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GlStateManager.enableBlend();
    GlStateManager.disableCull();

    if (Minecraft.isAmbientOcclusionEnabled()) {
        GlStateManager.shadeModel(GL11.GL_SMOOTH);
    }
    else {
        GlStateManager.shadeModel(GL11.GL_FLAT);
    }
    buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);

    renderTileEntityFast(te, x, y, z, partialTicks, destroyStage, partialTicks, buffer);
    buffer.setTranslation(0, 0, 0);
    tessellator.draw();

    RenderHelper.enableStandardItemLighting();
}
 
Example 4
Source File: GuiButton.java    From WearableBackpacks with MIT License 6 votes vote down vote up
@Override
public void draw(int mouseX, int mouseY, float partialTicks) {
	if (!isVisible()) return;
	boolean isHighlighted = isHighlighted(mouseX, mouseY);
	if (isSwitchOn()) {
		GlStateManager.disableCull();
		GlStateManager.pushMatrix();
		GlStateManager.translate(0, getHeight(), 0);
		GlStateManager.scale(1, -1, 1);
		drawButtonBackground(isHighlighted, partialTicks);
		GlStateManager.popMatrix();
		GlStateManager.enableCull();
		
		GlStateManager.pushMatrix();
		GlStateManager.translate(0, 1, 0);
		drawButtonForeground(isHighlighted, partialTicks);
		GlStateManager.popMatrix();
	} else {
		drawButtonBackground(isHighlighted, partialTicks);
		drawButtonForeground(isHighlighted, partialTicks);
	}
}
 
Example 5
Source File: TileManaMagnetRenderer.java    From Wizardry with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void render(TileManaMagnet te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
	if (te.manaOrb != null) {
		GlStateManager.pushMatrix();
		GlStateManager.enableBlend();
		GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

		GlStateManager.translate(x + 0.5, y + 0.5, z + 0.5);
		GlStateManager.translate(0, MathHelper.sin(ClientTickHandler.getTicks()) / 2.0, 0);
		GlStateManager.disableRescaleNormal();
		{
			GlStateManager.enableRescaleNormal();
			GlStateManager.disableCull();
			GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
			GlStateManager.enableLighting();
			GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
			RenderHelper.disableStandardItemLighting();

			Minecraft.getMinecraft().getTextureManager().bindTexture(manaPearlCubeTexture);
			TileOrbHolderRenderer.renderCube(0.1, Color.WHITE);

			GlStateManager.disableRescaleNormal();
		}

		GlStateManager.disableBlend();
		GlStateManager.popMatrix();
	}
}
 
Example 6
Source File: RenderCyberlimbHand.java    From Cyberware with MIT License 5 votes vote down vote up
private void renderArms()
{
	if (!this.mc.thePlayer.isInvisible())
	{
		GlStateManager.disableCull();
		GlStateManager.pushMatrix();
		GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F);
		this.renderArm(EnumHandSide.RIGHT);
		this.renderArm(EnumHandSide.LEFT);
		GlStateManager.popMatrix();
		GlStateManager.enableCull();
	}
}
 
Example 7
Source File: RenderCyberlimbHand.java    From Cyberware with MIT License 5 votes vote down vote up
private void renderArmFirstPerson(float p_187456_1_, float p_187456_2_, EnumHandSide p_187456_3_)
{
	boolean flag = p_187456_3_ != EnumHandSide.LEFT;
	float f = flag ? 1.0F : -1.0F;
	float f1 = MathHelper.sqrt_float(p_187456_2_);
	float f2 = -0.3F * MathHelper.sin(f1 * (float)Math.PI);
	float f3 = 0.4F * MathHelper.sin(f1 * ((float)Math.PI * 2F));
	float f4 = -0.4F * MathHelper.sin(p_187456_2_ * (float)Math.PI);
	GlStateManager.translate(f * (f2 + 0.64000005F), f3 + -0.6F + p_187456_1_ * -0.6F, f4 + -0.71999997F);
	GlStateManager.rotate(f * 45.0F, 0.0F, 1.0F, 0.0F);
	float f5 = MathHelper.sin(p_187456_2_ * p_187456_2_ * (float)Math.PI);
	float f6 = MathHelper.sin(f1 * (float)Math.PI);
	GlStateManager.rotate(f * f6 * 70.0F, 0.0F, 1.0F, 0.0F);
	GlStateManager.rotate(f * f5 * -20.0F, 0.0F, 0.0F, 1.0F);
	AbstractClientPlayer abstractclientplayer = this.mc.thePlayer;
	this.mc.getTextureManager().bindTexture(abstractclientplayer.getLocationSkin());
	GlStateManager.translate(f * -1.0F, 3.6F, 3.5F);
	GlStateManager.rotate(f * 120.0F, 0.0F, 0.0F, 1.0F);
	GlStateManager.rotate(200.0F, 1.0F, 0.0F, 0.0F);
	GlStateManager.rotate(f * -135.0F, 0.0F, 1.0F, 0.0F);
	GlStateManager.translate(f * 5.6F, 0.0F, 0.0F);
	RenderPlayer renderplayer = getEntityRenderObject(this.mc.thePlayer, p_187456_3_);
	GlStateManager.disableCull();

	if (flag)
	{
		renderplayer.renderRightArm(abstractclientplayer);
	}
	else
	{
		renderplayer.renderLeftArm(abstractclientplayer);
	}

	GlStateManager.enableCull();
}
 
Example 8
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 9
Source File: OverlayRenderer.java    From litematica with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void renderSchematicRebuildTargetingOverlay(float partialTicks)
{
    RayTraceWrapper traceWrapper = null;
    Entity entity = fi.dy.masa.malilib.util.EntityUtils.getCameraEntity();
    Color4f color = null;
    boolean direction = false;

    if (Hotkeys.SCHEMATIC_REBUILD_BREAK_ALL.getKeybind().isKeybindHeld())
    {
        traceWrapper = RayTraceUtils.getGenericTrace(this.mc.world, entity, 20, true);
        color = Configs.Colors.REBUILD_BREAK_OVERLAY_COLOR.getColor();
    }
    else if (Hotkeys.SCHEMATIC_REBUILD_BREAK_DIRECTION.getKeybind().isKeybindHeld())
    {
        traceWrapper = RayTraceUtils.getGenericTrace(this.mc.world, entity, 20, true);
        color = Configs.Colors.REBUILD_BREAK_OVERLAY_COLOR.getColor();
        direction = true;
    }
    else if (Hotkeys.SCHEMATIC_REBUILD_REPLACE_ALL.getKeybind().isKeybindHeld())
    {
        traceWrapper = RayTraceUtils.getGenericTrace(this.mc.world, entity, 20, true);
        color = Configs.Colors.REBUILD_REPLACE_OVERLAY_COLOR.getColor();
    }
    else if (Hotkeys.SCHEMATIC_REBUILD_REPLACE_DIRECTION.getKeybind().isKeybindHeld())
    {
        traceWrapper = RayTraceUtils.getGenericTrace(this.mc.world, entity, 20, true);
        color = Configs.Colors.REBUILD_REPLACE_OVERLAY_COLOR.getColor();
        direction = true;
    }

    if (traceWrapper != null && traceWrapper.getHitType() == RayTraceWrapper.HitType.SCHEMATIC_BLOCK)
    {
        RayTraceResult trace = traceWrapper.getRayTraceResult();
        BlockPos pos = trace.getBlockPos();

        GlStateManager.depthMask(false);
        GlStateManager.disableLighting();
        GlStateManager.disableCull();
        GlStateManager.disableTexture2D();
        fi.dy.masa.malilib.render.RenderUtils.setupBlend();

        if (direction)
        {
            fi.dy.masa.malilib.render.RenderUtils.renderBlockTargetingOverlay(
                    entity, pos, trace.sideHit, trace.hitVec, color, partialTicks);
        }
        else
        {
            fi.dy.masa.malilib.render.RenderUtils.renderBlockTargetingOverlaySimple(
                    entity, pos, trace.sideHit, color, partialTicks);
        }

        GlStateManager.enableTexture2D();
        //GlStateManager.enableDepth();
        GlStateManager.disableBlend();
        GlStateManager.enableCull();
        GlStateManager.depthMask(true);
    }
}
 
Example 10
Source File: TileOrbHolderRenderer.java    From Wizardry with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void render(TileOrbHolder te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
	if (te.containsCell()) {

		GlStateManager.pushMatrix();
		GlStateManager.enableBlend();
		GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

		GlStateManager.translate(x + 0.5, y + 0.5, z + 0.5);
		GlStateManager.disableRescaleNormal();

		float sin = (float) Math.sin((ClientTickHandler.getTicks() + partialTicks + te.getPos().hashCode()) / 10.0);

		boolean gravitating = false;
		// Hover towards block
		if (te.containsCell()) {
			BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(te.getPos());
			for (int i = -6; i < 6; i++)
				for (int j = -6; j < 6; j++)
					for (int k = -6; k < 6; k++) {
						pos.setPos(te.getPos().getX() + i, te.getPos().getY() + j, te.getPos().getZ() + k);
						Block block = te.getWorld().getBlockState(pos).getBlock();

						if (te.containsCell() && block == ModBlocks.MANA_BATTERY) {
							gravitating = true;
							Vec3d direction = new Vec3d(te.getPos()).subtract(new Vec3d(pos)).normalize();
							GlStateManager.translate(sin * direction.x / 5.0, sin * direction.y / 5.0, sin * direction.z / 5.0);
							break;
						}
					}
		}


		if (!gravitating) GlStateManager.translate(0, sin / 10.0, 0);

		GlStateManager.rotate((ClientTickHandler.getTicks() + partialTicks) * 4.0f, 0, 1, 0);

		GlStateManager.translate(0, 0.6, 0);
		GlStateManager.rotate(45f, 1, 0, 1);

		{
			GlStateManager.disableCull();
			GlStateManager.enableLighting();
			GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
			GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
			RenderHelper.disableStandardItemLighting();

			if (te.containsCell()) {
				Color c = new Color(1f, 1f, 1f, (float) (ManaManager.getMana(te.getWizardryCap()) / ManaManager.getMaxMana(te.getWizardryCap())));
				Minecraft.getMinecraft().getTextureManager().bindTexture(manaOrb);
				renderCube(0.13, c);
				Minecraft.getMinecraft().getTextureManager().bindTexture(glassOrb);
				renderCube(0.135, new Color(1, 1, 1, 0.8f));
			}
			GlStateManager.disableRescaleNormal();
		}

		GlStateManager.disableBlend();
		GlStateManager.popMatrix();
	}
}
 
Example 11
Source File: GuiDownloadTofuTerrain.java    From TofuCraftReload with MIT License 4 votes vote down vote up
private void drawPanorama(float ticks) {
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder buffer = tessellator.getBuffer();
    GlStateManager.matrixMode(GL11.GL_PROJECTION);
    GlStateManager.pushMatrix();
    GlStateManager.loadIdentity();
    Project.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F);
    GlStateManager.matrixMode(GL11.GL_MODELVIEW);
    GlStateManager.pushMatrix();
    GlStateManager.loadIdentity();
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F);
    GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
    GlStateManager.enableBlend();
    GlStateManager.disableAlpha();
    GlStateManager.disableCull();
    GlStateManager.depthMask(false);
    GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
    byte b0 = 8;

    for (int k = 0; k < b0 * b0; ++k) {
        GlStateManager.pushMatrix();
        float f1 = ((float) (k % b0) / (float) b0 - 0.5F) / 64.0F;
        float f2 = ((float) (k / b0) / (float) b0 - 0.5F) / 64.0F;
        float f3 = 0.0F;
        GlStateManager.translate(f1, f2, f3);
        GlStateManager.rotate(MathHelper.sin((panoramaTimer + ticks) / 400.0F) * 15.0F + 10.0F, 1.0F, 0.0F, 0.0F);
        GlStateManager.rotate(-(panoramaTimer + ticks) * 0.08F, 0.0F, 1.0F, 0.0F);

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

            switch (l) {
                case 1:
                    GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F);
                    break;
                case 2:
                    GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
                    break;
                case 3:
                    GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F);
                    break;
                case 4:
                    GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
                    break;
                case 5:
                    GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F);
                    break;
            }

            mc.getTextureManager().bindTexture(getPanoramaPaths().getPath(l));
            buffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
            int i = 255 / (k + 1);
            buffer.pos(-1.0D, -1.0D, 1.0D).tex(0.0D, 0.0D).color(255, 255, 255, i).endVertex();
            buffer.pos(1.0D, -1.0D, 1.0D).tex(1.0D, 0.0D).color(255, 255, 255, i).endVertex();
            buffer.pos(1.0D, 1.0D, 1.0D).tex(1.0D, 1.0D).color(255, 255, 255, i).endVertex();
            buffer.pos(-1.0D, 1.0D, 1.0D).tex(0.0D, 1.0D).color(255, 255, 255, i).endVertex();
            tessellator.draw();
            GlStateManager.popMatrix();
        }

        GlStateManager.popMatrix();
        GlStateManager.colorMask(true, true, true, false);
    }

    buffer.setTranslation(0.0D, 0.0D, 0.0D);
    GlStateManager.colorMask(true, true, true, true);
    GlStateManager.matrixMode(GL11.GL_PROJECTION);
    GlStateManager.popMatrix();
    GlStateManager.matrixMode(GL11.GL_MODELVIEW);
    GlStateManager.popMatrix();
    GlStateManager.depthMask(true);
    GlStateManager.enableCull();
    GlStateManager.enableDepth();
}
 
Example 12
Source File: TileEntityRendererEnergyBridge.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void renderBeamVertical(double x, double y, double z, double yMin, double yMax, double radius, double rot, double flowSpeed, boolean powered)
{
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder vertexBuffer = tessellator.getBuffer();
    double tx1 = 0.0d, tx2 = 0.0d;
    double tz1 = 0.0d, tz2 = 0.0d;
    double angle = 0.0d;

    double vScale = yMax - yMin;
    double v1 = -rot * flowSpeed;
    double v2 = (vScale * 2.0d) + v1;

    int r_i = (powered ? 160 : 255);
    int g_i = (powered ? 255 : 160);
    int b_i = (powered ? 230 : 160);
    int r_o = (powered ? 210 : 255);
    int g_o = (powered ? 255 : 160);
    int b_o = (powered ? 230 : 160);

    GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F);
    GlStateManager.pushMatrix();
    GlStateManager.translate(x, y, z);

    this.bindTexture(TEXTURE);
    GlStateManager.disableFog();
    GlStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497);
    GlStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497);
    GlStateManager.disableLighting();
    GlStateManager.disableCull();
    GlStateManager.disableBlend();
    GlStateManager.depthMask(true);
    GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);

    // Beam (inner part)
    vertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);

    for (int i = 0; i < 8; ++i)
    {
        tx1 = Math.sin(rot + angle) * radius;
        tz1 = Math.cos(rot + angle) * radius;
        angle += Math.PI / 4.0d;
        tx2 = Math.sin(rot + angle) * radius;
        tz2 = Math.cos(rot + angle) * radius;
        vertexBuffer.pos(tx1, yMin, tz1).tex(0.125, v1).color(r_i, g_i, b_i, 200).endVertex();
        vertexBuffer.pos(tx1, yMax, tz1).tex(0.125, v2).color(r_i, g_i, b_i, 200).endVertex();
        vertexBuffer.pos(tx2, yMax, tz2).tex(0.875, v2).color(r_i, g_i, b_i, 200).endVertex();
        vertexBuffer.pos(tx2, yMin, tz2).tex(0.875, v1).color(r_i, g_i, b_i, 200).endVertex();
    }

    tessellator.draw();

    // Glow (outer part)
    GlStateManager.enableBlend();
    GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
    GlStateManager.depthMask(false);

    v1 = -rot * flowSpeed * 3.0d;
    v2 = (vScale * 2.0d) + v1;
    radius *= 2.0d;
    rot = Math.PI / 8.0d;
    vertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);

    for (int i = 0; i < 8; ++i)
    {
        tx1 = Math.sin(rot + angle) * radius;
        tz1 = Math.cos(rot + angle) * radius;
        angle += Math.PI / 4.0d;
        tx2 = Math.sin(rot + angle) * radius;
        tz2 = Math.cos(rot + angle) * radius;
        vertexBuffer.pos(tx1, yMin, tz1).tex(0.125, v1).color(r_o, g_o, b_o, 80).endVertex();
        vertexBuffer.pos(tx1, yMax, tz1).tex(0.125, v2).color(r_o, g_o, b_o, 80).endVertex();
        vertexBuffer.pos(tx2, yMax, tz2).tex(0.875, v2).color(r_o, g_o, b_o, 80).endVertex();
        vertexBuffer.pos(tx2, yMin, tz2).tex(0.875, v1).color(r_o, g_o, b_o, 80).endVertex();
    }

    tessellator.draw();

    GlStateManager.enableLighting();
    GlStateManager.enableTexture2D();
    GlStateManager.depthMask(true);
    GlStateManager.enableFog();
    GlStateManager.popMatrix();
}
 
Example 13
Source File: SmallVesselHighlightHandler.java    From TFC2 with GNU General Public License v3.0 4 votes vote down vote up
@SubscribeEvent
public void drawBlockHighlightEvent(DrawBlockHighlightEvent evt) 
{
	RayTraceResult target = evt.getTarget();
	if(target.typeOfHit != RayTraceResult.Type.BLOCK)
		return;

	World world = evt.getPlayer().world;
	EntityPlayer player = evt.getPlayer();
	IBlockState state = world.getBlockState(target.getBlockPos());

	double posX = player.lastTickPosX + (player.posX - player.lastTickPosX) * evt.getPartialTicks();
	double posY = player.lastTickPosY + (player.posY - player.lastTickPosY) * evt.getPartialTicks();
	double posZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * evt.getPartialTicks();

	double hitX = Math.round((target.hitVec.xCoord - target.getBlockPos().getX())*100)/100.0d;
	double hitY = Math.round((target.hitVec.yCoord - target.getBlockPos().getY())*100)/100.0d;
	double hitZ = Math.round((target.hitVec.zCoord - target.getBlockPos().getZ())*100)/100.0d;

	AxisAlignedBB box = null;
	int index = getIndex(hitX, hitZ);

	if((state.getBlock() == TFCBlocks.SmallVessel) || (target.sideHit == EnumFacing.UP && player.getHeldItemMainhand().getItem() == TFCItems.PotteryVessel && 
			state.getBlock().isSideSolid(state, world, target.getBlockPos(), EnumFacing.UP) && player.isSneaking() && player.getHeldItemMainhand().getItemDamage() == 1))
	{

		GlStateManager.enableBlend();
		GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
		GlStateManager.disableCull();

		if(index == 0)
			box = aabb0.offset(target.getBlockPos());
		else if(index == 1)
			box = aabb1.offset(target.getBlockPos());
		else if(index == 2)
			box = aabb2.offset(target.getBlockPos());
		else
			box = aabb3.offset(target.getBlockPos());

		if(state.getBlock() != TFCBlocks.SmallVessel)
			box = box.offset(0, 1, 0);

		GlStateManager.enableTexture2D();
		Core.bindTexture(selectTex);
		drawFace(box.expand(0.002F, 0.002F, 0.002F).offset(-posX, -posY, -posZ), new float[]{1f,1f,1f, 1f}, EnumFacing.UP);

		GlStateManager.disableTexture2D();
		GlStateManager.enableCull();
		GlStateManager.disableBlend();
	}
}
 
Example 14
Source File: WorldProviderTorikki.java    From Wizardry with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void render(float partialTicks, WorldClient world, Minecraft mc) {
	EntityPlayer p = Minecraft.getMinecraft().player;
	if (p != null) {
		if (p.getEntityWorld().provider instanceof WorldProviderTorikki) {
			ResourceLocation img = new ResourceLocation(Wizardry.MODID, "textures/misc/torikki_sky.png");
			Minecraft.getMinecraft().renderEngine.bindTexture(img);
			GlStateManager.pushMatrix();
			GlStateManager.disableCull();
			GlStateManager.disableFog();
			GlStateManager.disableLighting();

			GlStateManager.depthMask(false);
			Tessellator tessellator = Tessellator.getInstance();
			BufferBuilder vertexbuffer = tessellator.getBuffer();

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

				Minecraft.getMinecraft().renderEngine.bindTexture(img);
				if (i == 3) {
					Minecraft.getMinecraft().renderEngine.bindTexture(img);
					GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F);
				}
				if (i == 1) {
					Minecraft.getMinecraft().renderEngine.bindTexture(img);
					GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
				}
				if (i == 2) {
					Minecraft.getMinecraft().renderEngine.bindTexture(img);
					GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F);
					GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
				}
				if (i == 4) {
					Minecraft.getMinecraft().renderEngine.bindTexture(img);
					GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
					GlStateManager.rotate(270.0F, 0.0F, 1.0F, 0.0F);
				}
				if (i == 5) {
					Minecraft.getMinecraft().renderEngine.bindTexture(img);
					GlStateManager.rotate(-90.0F, 0.0F, 0.0F, 1.0F);
					GlStateManager.rotate(-270.0F, 0.0F, 1.0F, 0.0F);
				}

				vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
				vertexbuffer.pos(-100.0D, -100.0D, -100.0D).tex(0.0D, 0.0D).endVertex();
				vertexbuffer.pos(-100.0D, -100.0D, 100.0D).tex(0.0D, 1.0D).endVertex();
				vertexbuffer.pos(100.0D, -100.0D, 100.0D).tex(1.0D, 1.0D).endVertex();
				vertexbuffer.pos(100.0D, -100.0D, -100.0D).tex(1.0D, 0.0D).endVertex();
				tessellator.draw();
				GlStateManager.popMatrix();
			}

			GlStateManager.depthMask(true);
			GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
			GlStateManager.enableCull();
			GlStateManager.enableLighting();
			GlStateManager.disableAlpha();
			GlStateManager.enableFog();
			GlStateManager.disableBlend();
			GlStateManager.popMatrix();
		}
	}
}
 
Example 15
Source File: WrapperGlStateManager.java    From ClientBase with MIT License 4 votes vote down vote up
public static void disableCull() {
    GlStateManager.disableCull();
}
 
Example 16
Source File: MixinTileEntityItemStackRenderer.java    From LiquidBounce with GNU General Public License v3.0 4 votes vote down vote up
/**
 * @author CCBlueX
 */
@Overwrite
public void renderByItem(ItemStack itemStackIn) {
    if(itemStackIn.getItem() == Items.banner) {
        this.banner.setItemValues(itemStackIn);
        TileEntityRendererDispatcher.instance.renderTileEntityAt(this.banner, 0.0D, 0.0D, 0.0D, 0.0F);
    }else if(itemStackIn.getItem() == Items.skull) {
        GameProfile gameprofile = null;

        if(itemStackIn.hasTagCompound()) {
            NBTTagCompound nbttagcompound = itemStackIn.getTagCompound();

            try {
                if(nbttagcompound.hasKey("SkullOwner", 10)) {
                    gameprofile = NBTUtil.readGameProfileFromNBT(nbttagcompound.getCompoundTag("SkullOwner"));
                }else if(nbttagcompound.hasKey("SkullOwner", 8) && nbttagcompound.getString("SkullOwner").length() > 0) {
                    GameProfile lvt_2_2_ = new GameProfile(null, nbttagcompound.getString("SkullOwner"));
                    gameprofile = TileEntitySkull.updateGameprofile(lvt_2_2_);
                    nbttagcompound.removeTag("SkullOwner");
                    nbttagcompound.setTag("SkullOwner", NBTUtil.writeGameProfile(new NBTTagCompound(), gameprofile));
                }
            }catch(Exception ignored) {
            }
        }

        if(TileEntitySkullRenderer.instance != null) {
            GlStateManager.pushMatrix();
            GlStateManager.translate(-0.5F, 0.0F, -0.5F);
            GlStateManager.scale(2.0F, 2.0F, 2.0F);
            GlStateManager.disableCull();
            TileEntitySkullRenderer.instance.renderSkull(0.0F, 0.0F, 0.0F, EnumFacing.UP, 0.0F, itemStackIn.getMetadata(), gameprofile, -1);
            GlStateManager.enableCull();
            GlStateManager.popMatrix();
        }
    }else{
        Block block = Block.getBlockFromItem(itemStackIn.getItem());

        if(block == Blocks.ender_chest) {
            TileEntityRendererDispatcher.instance.renderTileEntityAt(this.enderChest, 0.0D, 0.0D, 0.0D, 0.0F);
        }else if(block == Blocks.trapped_chest) {
            TileEntityRendererDispatcher.instance.renderTileEntityAt(this.field_147718_c, 0.0D, 0.0D, 0.0D, 0.0F);
        }else{
            TileEntityRendererDispatcher.instance.renderTileEntityAt(this.field_147717_b, 0.0D, 0.0D, 0.0D, 0.0F);
        }
    }
}
 
Example 17
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 18
Source File: ParticleRenderer.java    From Logistics-Pipes-2 with MIT License 4 votes vote down vote up
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 19
Source File: MixinTileEntityItemStackRenderer.java    From LiquidBounce with GNU General Public License v3.0 4 votes vote down vote up
/**
 * @author CCBlueX
 */
@Overwrite
public void renderByItem(ItemStack itemStackIn) {
    if(itemStackIn.getItem() == Items.banner) {
        this.banner.setItemValues(itemStackIn);
        TileEntityRendererDispatcher.instance.renderTileEntityAt(this.banner, 0.0D, 0.0D, 0.0D, 0.0F);
    }else if(itemStackIn.getItem() == Items.skull) {
        GameProfile gameprofile = null;

        if(itemStackIn.hasTagCompound()) {
            NBTTagCompound nbttagcompound = itemStackIn.getTagCompound();

            try {
                if(nbttagcompound.hasKey("SkullOwner", 10)) {
                    gameprofile = NBTUtil.readGameProfileFromNBT(nbttagcompound.getCompoundTag("SkullOwner"));
                }else if(nbttagcompound.hasKey("SkullOwner", 8) && nbttagcompound.getString("SkullOwner").length() > 0) {
                    GameProfile lvt_2_2_ = new GameProfile(null, nbttagcompound.getString("SkullOwner"));
                    gameprofile = TileEntitySkull.updateGameprofile(lvt_2_2_);
                    nbttagcompound.removeTag("SkullOwner");
                    nbttagcompound.setTag("SkullOwner", NBTUtil.writeGameProfile(new NBTTagCompound(), gameprofile));
                }
            }catch(Exception ignored) {
            }
        }

        if(TileEntitySkullRenderer.instance != null) {
            GlStateManager.pushMatrix();
            GlStateManager.translate(-0.5F, 0.0F, -0.5F);
            GlStateManager.scale(2.0F, 2.0F, 2.0F);
            GlStateManager.disableCull();
            TileEntitySkullRenderer.instance.renderSkull(0.0F, 0.0F, 0.0F, EnumFacing.UP, 0.0F, itemStackIn.getMetadata(), gameprofile, -1);
            GlStateManager.enableCull();
            GlStateManager.popMatrix();
        }
    }else{
        Block block = Block.getBlockFromItem(itemStackIn.getItem());

        if(block == Blocks.ender_chest) {
            TileEntityRendererDispatcher.instance.renderTileEntityAt(this.enderChest, 0.0D, 0.0D, 0.0D, 0.0F);
        }else if(block == Blocks.trapped_chest) {
            TileEntityRendererDispatcher.instance.renderTileEntityAt(this.field_147718_c, 0.0D, 0.0D, 0.0D, 0.0F);
        }else if(block != Blocks.chest)
            net.minecraftforge.client.ForgeHooksClient.renderTileItem(itemStackIn.getItem(), itemStackIn.getMetadata());
        else{
            TileEntityRendererDispatcher.instance.renderTileEntityAt(this.field_147717_b, 0.0D, 0.0D, 0.0D, 0.0F);
        }
    }
}
 
Example 20
Source File: RenderTileEntityStoneMortar.java    From Sakura_mod with MIT License 4 votes vote down vote up
@Override
public void render(TileEntityStoneMortar te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
    GlStateManager.enableDepth();
    GlStateManager.depthFunc(515);
    GlStateManager.depthMask(true);
    GlStateManager.disableCull();

    if (destroyStage >= 0) {
        this.bindTexture(DESTROY_STAGES[destroyStage]);
        GlStateManager.matrixMode(5890);
        GlStateManager.pushMatrix();
        GlStateManager.scale(4.0F, 4.0F, 1.0F);
        GlStateManager.translate(0.0625F, 0.0625F, 0.0625F);
        GlStateManager.matrixMode(5888);
    } else {
        this.bindTexture(TEXTURES);
    }

    GlStateManager.pushMatrix();
    GlStateManager.enableRescaleNormal();

    if (destroyStage < 0) {
        GlStateManager.color(1.0F, 1.0F, 1.0F, alpha);
    }

    GlStateManager.translate((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    GlStateManager.scale(1.0F, -1.0F, -1.0F);
    GlStateManager.translate(0.0F, 1.0F, 0.0F);
    GlStateManager.scale(0.9995F, 0.9995F, 0.9995F);
    GlStateManager.translate(0.0F, -1.0F, 0.0F);

    this.model.block1.render(0.0625F);

    if(te.getUpdateTag().getInteger("processTimer")!=0){
        float rot = te.getWorld().getTotalWorldTime() % 360;
        rot = rot * 2;
        GlStateManager.rotate(rot, 0.0F, 1.0F, 0.0F);
    }

    this.model.block2.render(0.0625F);
    this.model.handle.render(0.0625F);
    GlStateManager.enableCull();
    GlStateManager.disableRescaleNormal();
    GlStateManager.popMatrix();
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);

    if (destroyStage >= 0) {
        GlStateManager.matrixMode(5890);
        GlStateManager.popMatrix();
        GlStateManager.matrixMode(5888);
    }
}