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

The following examples show how to use net.minecraft.client.renderer.GlStateManager#depthMask() . 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: RenderAltar.java    From CommunityMod with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void renderShockwave(int progress, int totalProgress, double x, double y, double z) {
	if (totalProgress == 0) return;
	
	double scale = progress * SHOCKWAVE_DIAMETER / (float) totalProgress;
	
	GlStateManager.pushMatrix();
	GlStateManager.translate(x + 0.5, y + 1, z + 0.5);
	GlStateManager.scale(scale, scale, scale);
	GlStateManager.enableBlend();
	GlStateManager.depthMask(false);
	GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GlStateManager.color(1F, 1F, 1F, 1 - progress / (float) totalProgress);
	GlStateManager.enableAlpha();
	
	GlStateManager.callList(ClientProxy.sphereOutId);
	GlStateManager.callList(ClientProxy.sphereInId);
	
	GlStateManager.popMatrix();
}
 
Example 2
Source File: PhasedBlockRenderer.java    From Wizardry with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static BufferBuilder beginRender() {
	GlStateManager.enableAlpha();
	GlStateManager.enableBlend();
	GlStateManager.disableTexture2D();
	GlStateManager.enableCull();
	GlStateManager.cullFace(GlStateManager.CullFace.BACK);
	GlStateManager.depthMask(false);
	GlStateManager.enablePolygonOffset();
	GlStateManager.doPolygonOffset(-0.1f, -1000f);
	GlStateManager.enableColorMaterial();

	GlStateManager.color(1, 1, 1, 1);
	GlStateManager.shadeModel(GL11.GL_SMOOTH);

	GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE);
	GL14.glBlendEquation(GL14.GL_FUNC_SUBTRACT);

	BufferBuilder buffer = Tessellator.getInstance().getBuffer();
	buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL);
	buffer.setTranslation(-TileEntityRendererDispatcher.staticPlayerX, -TileEntityRendererDispatcher.staticPlayerY, -TileEntityRendererDispatcher.staticPlayerZ);

	return buffer;
}
 
Example 3
Source File: ParticleMapleRedLeaf.java    From Sakura_mod with MIT License 5 votes vote down vote up
@Override
public void renderParticle(BufferBuilder buffer, Entity entity, float partialTicks, float rotX, float rotXZ, float rotZ, float rotYZ, float rotXY) {
    // EffectRenderer will by default bind the vanilla particles texture, override with our own
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(ClientProxy.leafTexture);

    GlStateManager.depthMask(false);
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(770, 1);

    super.renderParticle(buffer, entity, partialTicks, rotX, rotXZ, rotZ, rotYZ, rotXY);

    GlStateManager.disableBlend();
    GlStateManager.depthMask(true);
}
 
Example 4
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 5
Source File: AboveHeadRenderer.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void renderName(RenderPlayerEvent event, LevelheadTag tag, EntityPlayer player, double x, double y, double z) {
    FontRenderer fontrenderer = event.getRenderManager().getFontRenderer();
    float f = (float) (1.6F * Levelhead.getInstance().getDisplayManager().getMasterConfig().getFontSize());
    float f1 = 0.016666668F * f;
    GlStateManager.pushMatrix();
    GlStateManager.translate((float) x + 0.0F, (float) y + player.height + 0.5F, (float) z);
    GL11.glNormal3f(0.0F, 1.0F, 0.0F);
    GlStateManager.rotate(-event.getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F);
    GlStateManager.rotate(event.getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F);
    GlStateManager.scale(-f1, -f1, f1);
    GlStateManager.disableLighting();
    GlStateManager.depthMask(false);
    GlStateManager.disableDepth();
    GlStateManager.enableBlend();
    GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    int i = 0;

    int j = fontrenderer.getStringWidth(tag.getString()) / 2;
    GlStateManager.disableTexture2D();
    worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
    worldrenderer.pos(-j - 1, -1 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
    worldrenderer.pos(-j - 1, 8 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
    worldrenderer.pos(j + 1, 8 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
    worldrenderer.pos(j + 1, -1 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
    tessellator.draw();
    GlStateManager.enableTexture2D();

    renderString(fontrenderer, tag);

    GlStateManager.enableLighting();
    GlStateManager.disableBlend();
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    GlStateManager.popMatrix();
}
 
Example 6
Source File: PhasedBlockRenderer.java    From Wizardry with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void finishRender(BufferBuilder buffer) {
	Tessellator.getInstance().draw();
	buffer.setTranslation(0, 0, 0);

	GlStateManager.glBlendEquation(GL14.GL_FUNC_ADD);
	GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
	GlStateManager.depthMask(true);

	GlStateManager.disablePolygonOffset();
	GlStateManager.enableDepth();
	GlStateManager.enableTexture2D();
}
 
Example 7
Source File: RenderItemHook.java    From SkyblockAddons with MIT License 5 votes vote down vote up
public static void renderToxicArrowPoisonEffect(IBakedModel model, ItemStack stack) {
    SkyblockAddons main = SkyblockAddons.getInstance();

    if (main.getUtils().isOnSkyblock() && main.getConfigValues().isEnabled(Feature.TURN_BOW_GREEN_WHEN_USING_TOXIC_ARROW_POISON)
            && main.getInventoryUtils().isUsingToxicArrowPoison() && Items.bow.equals(stack.getItem()) && main.getUtils().itemIsInHotbar(stack)) {
        TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();

        GlStateManager.depthMask(false);
        GlStateManager.depthFunc(514);
        GlStateManager.disableLighting();
        GlStateManager.blendFunc(768, 1);
        textureManager.bindTexture(BLANK);
        GlStateManager.matrixMode(5890);

        GlStateManager.pushMatrix();

        Minecraft.getMinecraft().getRenderItem().renderModel(model, 0x201cba41);
        GlStateManager.popMatrix();

        GlStateManager.matrixMode(5888);
        GlStateManager.blendFunc(770, 771);
        GlStateManager.enableLighting();
        GlStateManager.depthFunc(515);
        GlStateManager.depthMask(true);
        textureManager.bindTexture(TextureMap.locationBlocksTexture);
    }
}
 
Example 8
Source File: ParticleSyrupDrop.java    From Sakura_mod with MIT License 5 votes vote down vote up
@Override
public void renderParticle(BufferBuilder buffer, Entity entity, float partialTicks, float rotX, float rotXZ, float rotZ, float rotYZ, float rotXY) {
    // EffectRenderer will by default bind the vanilla particles texture, override with our own
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(ClientProxy.leafTexture);

    GlStateManager.depthMask(false);
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(770, 1);

    super.renderParticle(buffer, entity, partialTicks, rotX, rotXZ, rotZ, rotYZ, rotXY);

    GlStateManager.disableBlend();
    GlStateManager.depthMask(true);
}
 
Example 9
Source File: RenderCyberZombie.java    From Cyberware 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)
{
	if (entitylivingbaseIn.isBrute())
	{
		this.czRenderer.bindTexture(HIGHLIGHT_BRUTE);
	}
	else
	{
		this.czRenderer.bindTexture(HIGHLIGHT);
	}
	GlStateManager.enableBlend();
	//GlStateManager.disableAlpha();
	GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE);

	if (entitylivingbaseIn.isInvisible())
	{
		GlStateManager.depthMask(false);
	}
	else
	{
		GlStateManager.depthMask(true);
	}

	int i = 61680;
	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);
	this.czRenderer.getMainModel().render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
	i = entitylivingbaseIn.getBrightnessForRender(partialTicks);
	j = i % 65536;
	k = i / 65536;
	OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j, (float)k);
	this.czRenderer.setLightmap(entitylivingbaseIn, partialTicks);
	GlStateManager.disableBlend();
	GlStateManager.enableAlpha();
}
 
Example 10
Source File: ParticleSakuraLeaf.java    From Sakura_mod with MIT License 5 votes vote down vote up
@Override
public void renderParticle(BufferBuilder buffer, Entity entity, float partialTicks, float rotX, float rotXZ, float rotZ, float rotYZ, float rotXY) {
    // EffectRenderer will by default bind the vanilla particles texture, override with our own
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(ClientProxy.leafTexture);

    GlStateManager.depthMask(false);
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(770, 1);

    super.renderParticle(buffer, entity, partialTicks, rotX, rotXZ, rotZ, rotYZ, rotXY);

    GlStateManager.disableBlend();
    GlStateManager.depthMask(true);
}
 
Example 11
Source File: HyperiumRenderItem.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Basically the same as renderEffect, but does not include the depth code and uses custom color
 *
 * @param model the model
 */
private void renderPot(IBakedModel model, int color) {
    GlStateManager.depthMask(false);
    GlStateManager.disableLighting();
    GlStateManager.blendFunc(GL11.GL_SRC_COLOR, 1);
    ((IMixinRenderItem) parent).getTextureManager().bindTexture(RES_ITEM_GLINT);
    GlStateManager.matrixMode(GL11.GL_TEXTURE);
    GlStateManager.pushMatrix();
    GlStateManager.scale(8.0F, 8.0F, 8.0F);
    float f = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F / 8.0F;
    GlStateManager.translate(f, 0.0F, 0.0F);
    GlStateManager.rotate(-50.0F, 0.0F, 0.0F, 1.0F);
    ((IMixinRenderItem2) parent).callRenderModel(model, color);
    GlStateManager.popMatrix();
    GlStateManager.pushMatrix();
    GlStateManager.scale(8.0F, 8.0F, 8.0F);
    float f1 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F / 8.0F;
    GlStateManager.translate(-f1, 0.0F, 0.0F);
    GlStateManager.rotate(10.0F, 0.0F, 0.0F, 1.0F);
    ((IMixinRenderItem2) parent).callRenderModel(model, color);
    GlStateManager.popMatrix();
    GlStateManager.matrixMode(GL11.GL_MODELVIEW);
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GlStateManager.enableLighting();
    GlStateManager.depthMask(true);

    ((IMixinRenderItem) parent).getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
}
 
Example 12
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 13
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);
}
 
Example 14
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 15
Source File: GuiCustom.java    From Custom-Main-Menu with MIT License 4 votes vote down vote up
private void drawPanorama(int p_73970_1_, int p_73970_2_, float p_73970_3_)
{
	Tessellator tessellator = Tessellator.getInstance();
	BufferBuilder vertexBuffer = tessellator.getBuffer();
	GlStateManager.matrixMode(5889);
	GlStateManager.pushMatrix();
	GlStateManager.loadIdentity();
	Project.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F);
	GlStateManager.matrixMode(5888);
	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(770, 771, 1, 0);
	int i = 8;

	for (int j = 0; j < 64; ++j)
	{
		GlStateManager.pushMatrix();
		float f = ((float) (j % i) / (float) i - 0.5F) / 64.0F;
		float f1 = ((float) (j / i) / (float) i - 0.5F) / 64.0F;
		float f2 = 0.0F;
		GlStateManager.translate(f, f1, 0.0F);
		GlStateManager.rotate(MathHelper.sin(this.panoramaTimer / 400.0F) * 25.0F + 20.0F, 1.0F, 0.0F, 0.0F);
		GlStateManager.rotate(-this.panoramaTimer * 0.1F, 0.0F, 1.0F, 0.0F);

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

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

			if (k == 2)
			{
				GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
			}

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

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

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

			titlePanoramaPaths[k].bind();
			vertexBuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
			int l = 255 / (j + 1);
			float f3 = 0.0F;
			vertexBuffer.pos(-1.0D, -1.0D, 1.0D).tex(0.0D, 0.0D).color(255, 255, 255, l).endVertex();
			vertexBuffer.pos(1.0D, -1.0D, 1.0D).tex(1.0D, 0.0D).color(255, 255, 255, l).endVertex();
			vertexBuffer.pos(1.0D, 1.0D, 1.0D).tex(1.0D, 1.0D).color(255, 255, 255, l).endVertex();
			vertexBuffer.pos(-1.0D, 1.0D, 1.0D).tex(0.0D, 1.0D).color(255, 255, 255, l).endVertex();
			tessellator.draw();
			GlStateManager.popMatrix();
		}

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

	vertexBuffer.setTranslation(0.0D, 0.0D, 0.0D);
	GlStateManager.colorMask(true, true, true, true);
	GlStateManager.matrixMode(5889);
	GlStateManager.popMatrix();
	GlStateManager.matrixMode(5888);
	GlStateManager.popMatrix();
	GlStateManager.depthMask(true);
	GlStateManager.enableCull();
	GlStateManager.enableDepth();
}
 
Example 16
Source File: UnicornTrailRenderer.java    From Wizardry with GNU Lesser General Public License v3.0 4 votes vote down vote up
@SubscribeEvent
@SideOnly(Side.CLIENT)
public static void render(RenderWorldLastEvent event) {
	World world = Minecraft.getMinecraft().world;
	EntityPlayer player = Minecraft.getMinecraft().player;
	if (player == null || world == null) return;

	GlStateManager.pushMatrix();

	double interpPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * event.getPartialTicks();
	double interpPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * event.getPartialTicks();
	double interpPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * event.getPartialTicks();

	GlStateManager.translate(-interpPosX, -interpPosY + 0.1, -interpPosZ);

	GlStateManager.disableCull();
	GlStateManager.depthMask(false);
	GlStateManager.enableBlend();
	GlStateManager.disableTexture2D();
	GlStateManager.shadeModel(GL11.GL_SMOOTH);
	GlStateManager.blendFunc(GL_SRC_ALPHA, GL_ONE);
	GlStateManager.enableColorMaterial();
	GlStateManager.disableLighting();

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

	Set<EntityUnicorn> corns = new HashSet<>(positions.keySet());
	for (EntityUnicorn corn : corns) {
		if (corn.world.provider.getDimension() != world.provider.getDimension()) continue;

		List<Point> points = new ArrayList<>(positions.getOrDefault(corn, new ArrayList<>()));
		boolean q = false;

		vb.begin(GL11.GL_TRIANGLE_STRIP, DefaultVertexFormats.POSITION_COLOR);
		for (Point pos : points) {
			if (pos == null) continue;

			float sub = (world.getTotalWorldTime() - pos.time);
			Color color = Color.getHSBColor(sub % 360.0f / 360.0f, 1f, 1f);

			int alpha;
			if (sub < 500) {
				alpha = (int) (MathHelper.clamp(Math.log(sub + 1) / 2.0, 0, 1) * 80.0);
			} else {
				alpha = (int) (MathHelper.clamp(1 - (Math.log(sub) / 2.0), 0, 1) * 80.0);
			}

			pos(vb, pos.origin.subtract(pos.normal.scale(1.5))).color(color.getRed(), color.getGreen(), color.getBlue(), alpha).endVertex();
			pos(vb, pos.origin.add(pos.normal.scale(1.5))).color(color.getRed(), color.getGreen(), color.getBlue(), alpha).endVertex();
			q = !q;
		}

		tessellator.draw();
	}

	GlStateManager.enableCull();
	GlStateManager.depthMask(true);
	GlStateManager.disableBlend();
	GlStateManager.enableTexture2D();
	GlStateManager.shadeModel(GL11.GL_FLAT);
	GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);

	GlStateManager.popMatrix();
}
 
Example 17
Source File: HolesModule.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();

    for (Hole hole : this.holes) {
        final AxisAlignedBB bb = new AxisAlignedBB(
                hole.getX() - mc.getRenderManager().viewerPosX,
                hole.getY() - mc.getRenderManager().viewerPosY,
                hole.getZ() - mc.getRenderManager().viewerPosZ,
                hole.getX() + 1 - mc.getRenderManager().viewerPosX,
                hole.getY() + (hole.isTall() ? 2 : 1) - mc.getRenderManager().viewerPosY,
                hole.getZ() + 1 - mc.getRenderManager().viewerPosZ);

        camera.setPosition(mc.getRenderViewEntity().posX, mc.getRenderViewEntity().posY, mc.getRenderViewEntity().posZ);

        if (camera.isBoundingBoxInFrustum(new AxisAlignedBB(bb.minX + mc.getRenderManager().viewerPosX,
                bb.minY + mc.getRenderManager().viewerPosY,
                bb.minZ + mc.getRenderManager().viewerPosZ,
                bb.maxX + mc.getRenderManager().viewerPosX,
                bb.maxY + mc.getRenderManager().viewerPosY,
                bb.maxZ + mc.getRenderManager().viewerPosZ))) {
            GlStateManager.pushMatrix();
            GlStateManager.enableBlend();
            GlStateManager.disableDepth();
            GlStateManager.tryBlendFuncSeparate(770, 771, 0, 1);
            GlStateManager.disableTexture2D();
            GlStateManager.depthMask(false);
            glEnable(GL_LINE_SMOOTH);
            glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
            glLineWidth(1.5f);

            final double dist = mc.player.getDistance(hole.getX() + 0.5f, hole.getY() + 0.5f, hole.getZ() + 0.5f) * 0.75f;

            float alpha = MathUtil.clamp((float) (dist * 255.0f / (this.radius.getValue()) / 255.0f), 0.0f, 0.3f);

            RenderGlobal.renderFilledBox(bb, 0, 1, 0, this.fade.getValue() ? alpha : 0.25f);
            RenderGlobal.drawBoundingBox(bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ, 0, 1, 0, this.fade.getValue() ? alpha : 0.25f);
            glDisable(GL_LINE_SMOOTH);
            GlStateManager.depthMask(true);
            GlStateManager.enableDepth();
            GlStateManager.enableTexture2D();
            GlStateManager.disableBlend();
            GlStateManager.popMatrix();
        }
    }
}
 
Example 18
Source File: HyperiumMainGui.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
    int yg = (height / 10);  // Y grid
    int xg = (width / 11);   // X grid

    if (Minecraft.getMinecraft().theWorld == null) {
        GlStateManager.disableDepth();
        GlStateManager.depthMask(false);
        GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        GlStateManager.disableAlpha();
        GuiHyperiumScreen.renderBackgroundImage();
        GlStateManager.depthMask(true);
        GlStateManager.enableDepth();
        GlStateManager.enableAlpha();
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    }

    /* Render Header */
    drawRect(xg, yg, xg * 10, yg * 2, new Color(0, 0, 0, (int) Settings.SETTINGS_ALPHA).getRGB());
    drawRect(xg, yg * 2, xg * 10, yg * 9, new Color(0, 0, 0, (int) (Settings.SETTINGS_ALPHA / 2)).getRGB());
    searchField.render(mouseX, mouseY);
    GlStateModifier.INSTANCE.reset();

    title2.drawCenteredString(I18n.format(currentTab.getTitle()), width >> 1,
        yg + ((yg >> 1) - 6), 0xFFFFFF);

    /* Render Body */
    currentTab.setFilter(searchField.getText().isEmpty() ? null : searchField.getText());
    currentTab.render(xg, yg * 2, xg * 9, yg * 7);

    /* Render Footer */
    smol.drawString(Metadata.getVersion(), width - smol.getWidth(Metadata.getVersion()) - 1,
        height - 10, 0xffffffff);

    /* Render Tab Switcher */
    Icons.ARROW_LEFT.bind();
    GlStateManager.pushMatrix();
    Gui.drawScaledCustomSizeModalRect(width / 2 - xg, yg * 9, 0, 0, 144, 144, yg / 2, yg / 2,
        144, 144);
    Icons.ARROW_RIGHT.bind();
    Gui.drawScaledCustomSizeModalRect(width / 2 + xg - (yg / 2), yg * 9, 0, 0, 144, 144, yg / 2,
        yg / 2, 144, 144);
    GlStateManager.popMatrix();

    // Alerts
    if (!alerts.isEmpty() && currentAlert == null) currentAlert = alerts.poll();
    if (currentAlert != null) currentAlert.render(font, width, height);
}
 
Example 19
Source File: RenderSaltPan.java    From TofuCraftReload with MIT License 4 votes vote down vote up
@Override
public void render(TileEntitySaltPan te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
	if(!(te.getBlockType() instanceof BlockSaltPan)) return;
	BlockSaltPan panframe = (BlockSaltPan)te.getBlockType();
	World worldIn = te.getWorld();
	BlockPos framePos = te.getPos();
	BlockSaltPan.Stat myStat = panframe.getStat(worldIn, framePos);
	
	GlStateManager.pushMatrix();
    GlStateManager.enableDepth();
    GlStateManager.enableRescaleNormal();
    GlStateManager.translate(x, y, z);
     
    //content
	ResourceLocation contentTexture;
	int frame = (int)te.getWorld().getWorldInfo().getWorldTime()%64/2;
	if (myStat == BlockSaltPan.Stat.WATER){
		contentTexture = WATER[frame];
	}
	else if (myStat == BlockSaltPan.Stat.BITTERN){
		contentTexture = BITTERN[frame];

	}
	else if (myStat == BlockSaltPan.Stat.SALT){
		contentTexture = SALT_TEXTURE;
	}
	else contentTexture = null;
	
	if (contentTexture != null) {
		
		boolean edgeNorth = this.shouldSideBeRendered(worldIn, myStat, framePos.north(), panframe);
		boolean edgeEast = this.shouldSideBeRendered(worldIn, myStat, framePos.east(), panframe);
		boolean edgeSouth = this.shouldSideBeRendered(worldIn, myStat, framePos.south(), panframe);
		boolean edgeWest = this.shouldSideBeRendered(worldIn, myStat, framePos.west(), panframe);
		
    	this.bindTexture(contentTexture);
    	GlStateManager.enableBlend();
    	GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    	if(myStat != BlockSaltPan.Stat.SALT) GlStateManager.depthMask(false);

    	GlStateManager.enableAlpha();
    	
    	this.modelSaltpan.renderContent();
    	this.modelSaltpan.renderContentEdge(edgeNorth, edgeEast, edgeSouth, edgeWest);
    	
    	GlStateManager.depthMask(true);
	}
    
    GlStateManager.disableRescaleNormal();
    GlStateManager.popMatrix();
}
 
Example 20
Source File: YeetHandler.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
@InvokeEvent
public void render(RenderEntitiesEvent event) {
    for (Yeet yeet : yeets) {
        RenderManager renderManager = Minecraft.getMinecraft().getRenderManager();
        FontRenderer fontrenderer = renderManager.getFontRenderer();
        float f = 1.6F;
        float f1 = 0.016666668F * f;
        GlStateManager.pushMatrix();
        EntityPlayerSP entity = Minecraft.getMinecraft().thePlayer;
        float partialTicks = event.getPartialTicks();

        double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double) partialTicks;
        double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double) partialTicks;
        double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double) partialTicks;

        EntityPlayer sender = yeet.sender;
        if (sender == null) continue;
        double e0 = yeet.sender.lastTickPosX + (yeet.sender.posX - yeet.sender.lastTickPosX) * (double) partialTicks;
        double e1 = yeet.sender.lastTickPosY + (yeet.sender.posY - yeet.sender.lastTickPosY) * (double) partialTicks;
        double e2 = yeet.sender.lastTickPosZ + (yeet.sender.posZ - yeet.sender.lastTickPosZ) * (double) partialTicks;


        GlStateManager.translate(e0 - d0, e1 - d1, e2 - d2);
        GlStateManager.translate(0, 3, 0);

        GL11.glNormal3f(0.0F, 1.0F, 0.0F);
        GlStateManager.rotate(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F);

        int xMultiplier = 1; // Nametag x rotations should flip in front-facing 3rd person

        if (Minecraft.getMinecraft() != null && Minecraft.getMinecraft().gameSettings != null && Minecraft.getMinecraft().gameSettings.thirdPersonView == 2) {
            xMultiplier = -1;
        }

        GlStateManager.rotate(renderManager.playerViewX * xMultiplier, 1.0F, 0.0F, 0.0F);
        GlStateManager.scale(-f1, -f1, f1);
        GlStateManager.disableLighting();
        GlStateManager.depthMask(false);
        GlStateManager.disableDepth();
        GlStateManager.enableBlend();
        GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
        Tessellator tessellator = Tessellator.getInstance();
        WorldRenderer worldrenderer = tessellator.getWorldRenderer();
        int i = 0;

        String string = "YEET";
        int j = fontrenderer.getStringWidth(string) / 2;
        GlStateManager.disableTexture2D();
        GlStateManager.scale(4, 4, 4);
        worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
        worldrenderer.pos(-j - 1, -1 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
        worldrenderer.pos(-j - 1, 8 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
        worldrenderer.pos(j + 1, 8 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
        worldrenderer.pos(j + 1, -1 + i, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
        tessellator.draw();
        GlStateManager.enableTexture2D();

        fontrenderer.drawString(string, -j, 0, 16777215, true);
        GlStateManager.enableLighting();
        GlStateManager.disableBlend();
        GlStateManager.depthMask(true);
        GlStateManager.enableDepth();
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        GlStateManager.popMatrix();
    }
}