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

The following examples show how to use net.minecraft.client.renderer.GlStateManager#disableBlend() . 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: FluidPipeRenderer.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void renderItem(ItemStack rawItemStack, TransformType transformType) {
    ItemStack stack = ModCompatibility.getRealItemStack(rawItemStack);
    if (!(stack.getItem() instanceof ItemBlockFluidPipe)) {
        return;
    }
    CCRenderState renderState = CCRenderState.instance();
    GlStateManager.enableBlend();
    renderState.reset();
    renderState.startDrawing(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
    BlockFluidPipe blockFluidPipe = (BlockFluidPipe) ((ItemBlockFluidPipe) stack.getItem()).getBlock();
    FluidPipeType pipeType = blockFluidPipe.getItemPipeType(stack);
    Material material = blockFluidPipe.getItemMaterial(stack);
    if (pipeType != null && material != null) {
        renderPipeBlock(material, pipeType, IPipeTile.DEFAULT_INSULATION_COLOR, renderState, new IVertexOperation[0], 0);
    }
    renderState.draw();
    GlStateManager.disableBlend();
}
 
Example 2
Source File: RenderEnderminy.java    From EnderZoo with Creative Commons Zero v1.0 Universal 6 votes vote down vote up
@Override
public void doRenderLayer(EntityEnderminy em, float p_177201_2_, float p_177201_3_, float p_177201_4_, float p_177201_5_, float p_177201_6_,
    float p_177201_7_, float p_177201_8_) {

  bindTexture(endermanEyesTexture);
  GlStateManager.enableBlend();
  GlStateManager.disableAlpha();
  GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE);
  GlStateManager.disableLighting();
  GlStateManager.depthMask(!em.isInvisible());
  int i = 61680;
  int j = i % 65536;
  int k = i / 65536;
  OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j, (float)k);
  GlStateManager.enableLighting();
  GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
  getMainModel().render(em, p_177201_2_, p_177201_3_, p_177201_5_, p_177201_6_, p_177201_7_, p_177201_8_);
  setLightmap(em);
  GlStateManager.depthMask(true);
  GlStateManager.disableBlend();
  GlStateManager.enableAlpha();

}
 
Example 3
Source File: GuiPortalPanel.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{
    super.drawGuiContainerForegroundLayer(mouseX, mouseY);

    String s = this.tepp.hasCustomName() ? this.tepp.getName() : I18n.format(this.tepp.getName());
    this.fontRenderer.drawString(s, this.xSize / 2 - this.fontRenderer.getStringWidth(s) / 2, 5, 0x404040);
    this.fontRenderer.drawString(I18n.format("enderutilities.gui.label.settargetname"), 8, 118, 0x404040);
    this.fontRenderer.drawString(I18n.format("container.inventory"), 8, 156, 0x404040);

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

    String name = this.tepp.getPanelDisplayName();

    if (this.nameLast.equals(name) == false)
    {
        this.nameField.setText(name);
        this.nameLast = name;
    }

    this.nameField.drawTextBox();
}
 
Example 4
Source File: Utils.java    From SkyblockAddons with MIT License 5 votes vote down vote up
public void restoreGLOptions() {
    if (depthEnabled) {
        GlStateManager.enableDepth();
    }
    if (!alphaEnabled) {
        GlStateManager.disableAlpha();
    }
    if (!blendEnabled) {
        GlStateManager.disableBlend();
    }
    GlStateManager.blendFunc(blendFunctionSrcFactor, blendFunctionDstFactor);
}
 
Example 5
Source File: MixinGuiInGame.java    From LiquidBounce with GNU General Public License v3.0 5 votes vote down vote up
@Inject(method = "renderTooltip", at = @At("HEAD"), cancellable = true)
private void renderTooltip(ScaledResolution sr, float partialTicks, CallbackInfo callbackInfo) {
    final HUD hud = (HUD) LiquidBounce.moduleManager.getModule(HUD.class);

    if (Minecraft.getMinecraft().getRenderViewEntity() instanceof EntityPlayer && hud.getState() && hud.blackHotbarValue.get()) {
        EntityPlayer entityPlayer = (EntityPlayer) Minecraft.getMinecraft().getRenderViewEntity();

        int middleScreen = sr.getScaledWidth() / 2;

        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        GuiIngame.drawRect(middleScreen - 91, sr.getScaledHeight() - 24, middleScreen + 90, sr.getScaledHeight(), Integer.MIN_VALUE);
        GuiIngame.drawRect(middleScreen - 91 - 1 + entityPlayer.inventory.currentItem * 20 + 1, sr.getScaledHeight() - 24, middleScreen - 91 - 1 + entityPlayer.inventory.currentItem * 20 + 22, sr.getScaledHeight() - 22 - 1 + 24, Integer.MAX_VALUE);

        GlStateManager.enableRescaleNormal();
        GlStateManager.enableBlend();
        GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
        RenderHelper.enableGUIStandardItemLighting();

        for (int j = 0; j < 9; ++j) {
            int k = sr.getScaledWidth() / 2 - 90 + j * 20 + 2;
            int l = sr.getScaledHeight() - 16 - 3;
            this.renderHotbarItem(j, k, l, partialTicks, entityPlayer);
        }

        RenderHelper.disableStandardItemLighting();
        GlStateManager.disableRescaleNormal();
        GlStateManager.disableBlend();

        LiquidBounce.eventManager.callEvent(new Render2DEvent(partialTicks));
        AWTFontRenderer.Companion.garbageCollectionTick();
        callbackInfo.cancel();
    }
}
 
Example 6
Source File: RenderUtil.java    From seppuku with GNU General Public License v3.0 5 votes vote down vote up
public static void drawGradientRect(float left, float top, float right, float bottom, int startColor, int endColor) {
    float f = (float) (startColor >> 24 & 255) / 255.0F;
    float f1 = (float) (startColor >> 16 & 255) / 255.0F;
    float f2 = (float) (startColor >> 8 & 255) / 255.0F;
    float f3 = (float) (startColor & 255) / 255.0F;
    float f4 = (float) (endColor >> 24 & 255) / 255.0F;
    float f5 = (float) (endColor >> 16 & 255) / 255.0F;
    float f6 = (float) (endColor >> 8 & 255) / 255.0F;
    float f7 = (float) (endColor & 255) / 255.0F;
    GlStateManager.disableTexture2D();
    GlStateManager.enableBlend();
    GlStateManager.disableAlpha();
    GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
    GlStateManager.shadeModel(7425);
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder bufferbuilder = tessellator.getBuffer();
    bufferbuilder.begin(7, DefaultVertexFormats.POSITION_COLOR);
    bufferbuilder.pos((double) right, (double) top, (double) 0).color(f1, f2, f3, f).endVertex();
    bufferbuilder.pos((double) left, (double) top, (double) 0).color(f1, f2, f3, f).endVertex();
    bufferbuilder.pos((double) left, (double) bottom, (double) 0).color(f5, f6, f7, f4).endVertex();
    bufferbuilder.pos((double) right, (double) bottom, (double) 0).color(f5, f6, f7, f4).endVertex();
    tessellator.draw();
    GlStateManager.shadeModel(7424);
    GlStateManager.disableBlend();
    GlStateManager.enableAlpha();
    GlStateManager.enableTexture2D();
}
 
Example 7
Source File: LayoutManager.java    From NotEnoughItems with MIT License 5 votes vote down vote up
public static void drawIcon(int x, int y, Rectangle4i image) {
    changeTexture("nei:textures/nei_sprites.png");
    GlStateManager.color(1, 1, 1, 1);
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    drawTexturedModalRect(x, y, image.x, image.y, image.w, image.h);
    GlStateManager.disableBlend();
}
 
Example 8
Source File: TabGui.java    From ClientBase with MIT License 5 votes vote down vote up
public static void drawRect(int glFlag, 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();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    GlStateManager.enableBlend();
    GlStateManager.disableTexture2D();
    GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
    GlStateManager.color(f, f1, f2, f3);
    worldrenderer.begin(glFlag, DefaultVertexFormats.POSITION);
    worldrenderer.pos((double) left, (double) bottom, 0.0D).endVertex();
    worldrenderer.pos((double) right, (double) bottom, 0.0D).endVertex();
    worldrenderer.pos((double) right, (double) top, 0.0D).endVertex();
    worldrenderer.pos((double) left, (double) top, 0.0D).endVertex();
    tessellator.draw();
    GlStateManager.enableTexture2D();
    GlStateManager.disableBlend();
}
 
Example 9
Source File: LogoutSpotsModule.java    From seppuku with GNU General Public License v3.0 5 votes vote down vote up
@Listener
public void onRenderWorld(EventRender3D event) {
    final Minecraft mc = Minecraft.getMinecraft();

    for (String uuid : this.logoutCache.keySet()) {
        final PlayerData data = this.logoutCache.get(uuid);

        if (this.isOutOfRange(data)) {
            this.logoutCache.remove(uuid);
            continue;
        }

        data.ghost.prevLimbSwingAmount = 0;
        data.ghost.limbSwing = 0;
        data.ghost.limbSwingAmount = 0;
        data.ghost.hurtTime = 0;

        GlStateManager.pushMatrix();
        GlStateManager.enableLighting();
        GlStateManager.enableBlend();
        GlStateManager.enableDepth();
        GlStateManager.color(1, 1, 1, 1);
        mc.getRenderManager().renderEntity(data.ghost, data.position.x - mc.getRenderManager().renderPosX, data.position.y - mc.getRenderManager().renderPosY, data.position.z - mc.getRenderManager().renderPosZ, data.ghost.rotationYaw, mc.getRenderPartialTicks(), false);
        GlStateManager.disableLighting();
        GlStateManager.disableBlend();
        GlStateManager.popMatrix();
    }
}
 
Example 10
Source File: GuiCustomizeWorld.java    From YUNoMakeGoodMap with Apache License 2.0 5 votes vote down vote up
protected void drawHeader(int entryRight, int relativeY, Tessellator tess)
{
    int top = relativeY;

    if (logoPath != null)
    {
        GlStateManager.enableBlend();
        GuiCustomizeWorld.this.mc.renderEngine.bindTexture(logoPath);
        BufferBuilder wr = tess.getBuffer();
        int offset = (this.left + this.listWidth/2) - (logoDims.width / 2);
        wr.begin(7, DefaultVertexFormats.POSITION_TEX);
        wr.pos(offset,                  top + logoDims.height, zLevel).tex(0, 1).endVertex();
        wr.pos(offset + logoDims.width, top + logoDims.height, zLevel).tex(1, 1).endVertex();
        wr.pos(offset + logoDims.width, top,                   zLevel).tex(1, 0).endVertex();
        wr.pos(offset,                  top,                   zLevel).tex(0, 0).endVertex();
        tess.draw();
        GlStateManager.disableBlend();
        top += logoDims.height + 10;
    }

    for (ITextComponent line : lines)
    {
        if (line != null)
        {
            GlStateManager.enableBlend();
            GuiCustomizeWorld.this.fontRenderer.drawStringWithShadow(line.getFormattedText(), this.left + 4, top, 0xFFFFFF);
            GlStateManager.disableAlpha();
            GlStateManager.disableBlend();
        }
        top += 10;
    }
}
 
Example 11
Source File: SurfaceHelper.java    From ForgeHax with MIT License 5 votes vote down vote up
public static void drawOutlinedRect(int x, int y, int w, int h, 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_LINE_LOOP, DefaultVertexFormats.POSITION);
  BufferBuilder.pos(x, y, 0.0D).endVertex();
  BufferBuilder.pos(x, (double) y + h, 0.0D).endVertex();
  BufferBuilder.pos((double) x + w, (double) y + h, 0.0D).endVertex();
  BufferBuilder.pos((double) x + w, y, 0.0D).endVertex();
  tessellator.draw();
  
  GlStateManager.enableTexture2D();
  GlStateManager.disableBlend();
}
 
Example 12
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 13
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 14
Source File: HyperiumRendererLivingEntity.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void renderName(T entity, double x, double y, double z, RenderManager renderManager) {
    if (((IMixinRendererLivingEntity<T>) parent).callCanRenderName(entity)) {

        double d0 = entity.getDistanceSqToEntity(renderManager.livingPlayer);
        float f = entity.isSneaking() ? 32.0F : 64.0F;

        if (d0 < (double) (f * f)) {
            String s = entity.getDisplayName().getFormattedText();
            GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F);

            if (entity.isSneaking() && (Settings.SHOW_OWN_NAME || !entity.equals(Minecraft.getMinecraft().thePlayer))) {
                FontRenderer fontrenderer = renderManager.getFontRenderer();
                GlStateManager.pushMatrix();
                float offset = Utils.INSTANCE.calculateDeadmauEarsOffset(entity);
                GlStateManager.translate((float) x, (float) y + offset + entity.height + 0.5F - (entity.isChild() ? entity.height / 2.0F : 0.0F), (float) z);
                GL11.glNormal3f(0.0F, 1.0F, 0.0F);
                GlStateManager.rotate(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
                GlStateManager.rotate(renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
                GlStateManager.scale(-0.02666667F, -0.02666667F, 0.02666667F);
                GlStateManager.translate(0.0F, 9.374999F, 0.0F);
                GlStateManager.disableLighting();
                GlStateManager.depthMask(false);
                GlStateManager.enableBlend();
                GlStateManager.disableTexture2D();
                GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
                int i = fontrenderer.getStringWidth(s) / 2;
                Tessellator tessellator = Tessellator.getInstance();
                WorldRenderer worldrenderer = tessellator.getWorldRenderer();
                worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
                worldrenderer.pos(-i - 1, -1.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
                worldrenderer.pos(-i - 1, 8.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
                worldrenderer.pos(i + 1, 8.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
                worldrenderer.pos(i + 1, -1.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
                tessellator.draw();
                GlStateManager.enableTexture2D();
                GlStateManager.depthMask(true);
                fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, 0, 553648127);
                GlStateManager.enableLighting();
                GlStateManager.disableBlend();
                GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
                GlStateManager.popMatrix();
            } else {
                ((IMixinRender<T>) parent).callRenderOffsetLivingLabel(entity, x, y - (entity.isChild() ? (double)
                    (entity.height / 2.0F) : 0.0D), z, s, 0.02666667F, d0);
            }
        }
    }
}
 
Example 15
Source File: GuiCustom.java    From Custom-Main-Menu with MIT License 4 votes vote down vote up
@Override
public void initGui()
{
	GlStateManager.disableTexture2D();
	GlStateManager.enableBlend();
	GlStateManager.disableAlpha();
	GlStateManager.shadeModel(7425);
	GlStateManager.shadeModel(7424);
	GlStateManager.disableBlend();
	GlStateManager.enableAlpha();
	GlStateManager.enableTexture2D();

	if (!loadedSplashText && guiConfig.splashText != null)
	{
		if (guiConfig.splashText.synced)
		{
			this.splashText = CustomMainMenu.INSTANCE.config.getGUI("mainmenu").splashText;
		}
		else
		{
			loadSplashTexts();
		}

		loadedSplashText = true;
	}

	textLabels = new ArrayList<GuiCustomLabel>();
	buttonCounter = 0;
	this.viewportTexture = new DynamicTexture(256, 256);
	this.field_110351_G = this.mc.getTextureManager().getDynamicTextureLocation("background", this.viewportTexture);
	Calendar calendar = Calendar.getInstance();
	calendar.setTime(new Date());

	if (calendar.get(2) + 1 == 11 && calendar.get(5) == 9)
	{
		this.splashText = "Happy birthday, ez!";
	}
	else if (calendar.get(2) + 1 == 6 && calendar.get(5) == 1)
	{
		this.splashText = "Happy birthday, Notch!";
	}
	else if (calendar.get(2) + 1 == 12 && calendar.get(5) == 24)
	{
		this.splashText = "Merry X-mas!";
	}
	else if (calendar.get(2) + 1 == 1 && calendar.get(5) == 1)
	{
		this.splashText = "Happy new year!";
	}
	else if (calendar.get(2) + 1 == 10 && calendar.get(5) == 31)
	{
		this.splashText = "OOoooOOOoooo! Spooky!";
	}

	int idCounter = 6000;

	// Add Custom Buttons
	for (Button b : guiConfig.customButtons)
	{
		if (b.wrappedButtonID != -1)
		{
			this.buttonList.add(alignButton(b, new GuiCustomWrappedButton(b.wrappedButtonID, b.wrappedButtonID, b)));
		}
		else
		{
			this.buttonList.add(alignButton(b, new GuiCustomButton(idCounter, b)));
			idCounter++;
		}
	}

	// Add Labels
	for (Label t : guiConfig.customLabels)
	{
		textLabels.add(new GuiCustomLabel(this, t, modX(t.posX, t.alignment), modY(t.posY, t.alignment)));
	}
}
 
Example 16
Source File: GuiKnappingButton.java    From TFC2 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void drawButton(Minecraft par1Minecraft, int xPos, int yPos)
{
	if (this.visible)
	{
		this.hovered = xPos >= this.xPosition && yPos >= this.yPosition && xPos < this.xPosition + this.width && yPos < this.yPosition + this.height;
		PlayerInfo pi = PlayerManagerTFC.getInstance().getClientPlayer();
		GL11.glScalef(0.5f, 0.5f, 1f);
		GL11.glTranslatef(xPosition, yPosition, 0);

		if (pi.specialCraftingType != null)
		{
			if(pi.specialCraftingType.getItem() == TFCItems.LooseRock)
			{
				Core.bindTexture(new ResourceLocation(Reference.ModID, "textures/blocks/rocks/" + StoneType.getStoneTypeFromMeta(pi.specialCraftingType.getItemDamage()).name() +" Raw.png"));

				//Same as drawTexturedModalRect except we need to set the UV ourselves
				drawLocal();
			}
			else if(pi.specialCraftingType.getItem() == Items.CLAY_BALL)
			{
				Core.bindTexture(new ResourceLocation(Reference.ModID, "textures/items/pottery/clay flat light.png"));

				//Same as drawTexturedModalRect except we need to set the UV ourselves
				drawLocal();
			}
			else
			{
				Minecraft.getMinecraft().getRenderItem().renderItemAndEffectIntoGUI(pi.specialCraftingType, xPosition, yPosition);
			}
		}

		if (!this.enabled && pi.specialCraftingTypeAlternate != null)
		{
			if(pi.specialCraftingType.getItem() == TFCItems.LooseRock)
			{
				Core.bindTexture(new ResourceLocation(Reference.ModID, "textures/blocks/rocks/" + StoneType.getStoneTypeFromMeta(pi.specialCraftingTypeAlternate.getItemDamage()).name() +" Raw.png"));
				GL11.glColor4f(1f, 1f, 1f, 0.5f);
				//Same as drawTexturedModalRect except we need to set the UV ourselves
				drawLocal();
			}
			else if(pi.specialCraftingType.getItem() == Items.CLAY_BALL)
			{
				Core.bindTexture(new ResourceLocation(Reference.ModID, "textures/items/pottery/clay flat dark.png"));
				GL11.glColor4f(1f, 1f, 1f, 1.0f);
				//Same as drawTexturedModalRect except we need to set the UV ourselves
				drawLocal();
			}
			else
			{
				Minecraft.getMinecraft().getRenderItem().renderItemAndEffectIntoGUI(pi.specialCraftingTypeAlternate, xPosition, yPosition);
			}
		}

		if(pi.shouldDrawKnappingHighlight && highlight)
		{
			Core.bindTexture(GuiKnapping.texture);

			GL11.glColor4f(1.0f, 1.0f, 1.0f, 0.4f);
			GlStateManager.enableBlend();
			//GlStateManager.colorMask(false, true, true, true);
			this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 239, 16, 16);
			//GlStateManager.colorMask(true, true, true, true);
			GlStateManager.disableBlend();
		}

		GL11.glTranslatef(-xPosition, -yPosition, 0);
		GL11.glScalef(2f, 2f, 1);
		GL11.glColor4f(1f, 1f, 1f, 1f);


		this.mouseDragged(par1Minecraft, this.xPosition, this.yPosition);
	}
}
 
Example 17
Source File: PropellerEngineTileEntityRenderer.java    From Valkyrien-Skies with Apache License 2.0 4 votes vote down vote up
@Override
public void render(TileEntityPropellerEngine tileentity, double x, double y, double z,
    float partialTick,
    int destroyStage, float alpha) {
    IBlockState state = tileentity.getWorld().getBlockState(tileentity.getPos());
    if (state.getBlock() instanceof BlockAirshipEngine) {
        EnumFacing facing = state.getValue(BlockAirshipEngine.FACING);

        IBlockState engineRenderState = getRenderState(state);
        IBlockState propellerRenderState = ValkyrienSkiesControl.INSTANCE.vsControlBlocks.shipWheel
            .getStateFromMeta(14);

        this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        GlStateManager.pushMatrix();
        GlStateManager.disableLighting();
        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder BufferBuilder = tessellator.getBuffer();

        double oldX = BufferBuilder.xOffset;
        double oldY = BufferBuilder.yOffset;
        double oldZ = BufferBuilder.zOffset;

        BufferBuilder.setTranslation(0, 0, 0);
        GL11.glTranslated(x, y, z);
        GlStateManager.disableAlpha();
        GlStateManager.disableBlend();

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

        // GL11.glScaled(1.2D, 1.2D, 1.2D);

        GL11.glTranslated(0.5D, 0.5D, 0.5D);

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

        }

        GL11.glTranslated(-0.5D, -0.5D, -0.5D);

        FastBlockModelRenderer.renderBlockModel(tessellator, tileentity.getWorld(),
            engineRenderState, brightness);

        GL11.glPushMatrix();

        GL11.glTranslated(0.5D, 0.214D, 0.5D);
        GL11.glRotated(tileentity.getPropellerAngle(partialTick), 0, 0, 1);
        GL11.glScaled(1.5D, 1.5D, 1);
        GL11.glTranslated(-0.5D, -0.214D, -0.5D);

        FastBlockModelRenderer.renderBlockModel(tessellator, tileentity.getWorld(),
            propellerRenderState, brightness);

        GL11.glPopMatrix();

        GL11.glPopMatrix();

        BufferBuilder.setTranslation(oldX, oldY, oldZ);
    }
}
 
Example 18
Source File: RenderBeam.java    From TofuCraftReload with MIT License 4 votes vote down vote up
/**
 * Renders the desired {@code T} type Entity.
 */
public void doRender(EntityBeam entity, double x, double y, double z, float entityYaw, float partialTicks) {
    this.bindEntityTexture(entity);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    GlStateManager.pushMatrix();
    GlStateManager.disableLighting();
    GlStateManager.translate((float) x, (float) y, (float) z);
    GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks - 90.0F, 0.0F, 1.0F, 0.0F);
    GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, 0.0F, 0.0F, 1.0F);
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder bufferbuilder = tessellator.getBuffer();

    GlStateManager.enableRescaleNormal();

    GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F);
    GlStateManager.scale(0.05625F, 0.05625F, 0.05625F);
    GlStateManager.translate(-4.0F, 0.0F, 0.0F);

    if (this.renderOutlines) {
        GlStateManager.enableColorMaterial();
        GlStateManager.enableOutlineMode(this.getTeamColor(entity));
    }
    GlStateManager.enableBlend();
    GlStateManager.disableAlpha();
    GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE);
    GlStateManager.depthMask(true);

    GlStateManager.glNormal3f(0.05625F, 0.0F, 0.0F);
    bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX);
    bufferbuilder.pos(-7.0D, -2.0D, -2.0D).tex(0.0D, 0.15625D).endVertex();
    bufferbuilder.pos(-7.0D, -2.0D, 2.0D).tex(0.15625D, 0.15625D).endVertex();
    bufferbuilder.pos(-7.0D, 2.0D, 2.0D).tex(0.15625D, 0.3125D).endVertex();
    bufferbuilder.pos(-7.0D, 2.0D, -2.0D).tex(0.0D, 0.3125D).endVertex();
    tessellator.draw();
    GlStateManager.glNormal3f(-0.05625F, 0.0F, 0.0F);
    bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX);
    bufferbuilder.pos(-7.0D, 2.0D, -2.0D).tex(0.0D, 0.15625D).endVertex();
    bufferbuilder.pos(-7.0D, 2.0D, 2.0D).tex(0.15625D, 0.15625D).endVertex();
    bufferbuilder.pos(-7.0D, -2.0D, 2.0D).tex(0.15625D, 0.3125D).endVertex();
    bufferbuilder.pos(-7.0D, -2.0D, -2.0D).tex(0.0D, 0.3125D).endVertex();
    tessellator.draw();

    for (int j = 0; j < 4; ++j) {
        GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
        GlStateManager.glNormal3f(0.0F, 0.0F, 0.05625F);
        bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX);
        bufferbuilder.pos(-8.0D, -2.0D, 0.0D).tex(0.0D, 0.0D).endVertex();
        bufferbuilder.pos(8.0D, -2.0D, 0.0D).tex(0.5D, 0.0D).endVertex();
        bufferbuilder.pos(8.0D, 2.0D, 0.0D).tex(0.5D, 0.15625D).endVertex();
        bufferbuilder.pos(-8.0D, 2.0D, 0.0D).tex(0.0D, 0.15625D).endVertex();
        tessellator.draw();
    }

    if (this.renderOutlines) {
        GlStateManager.disableOutlineMode();
        GlStateManager.disableColorMaterial();
    }
    GlStateManager.disableBlend();
    GlStateManager.enableAlpha();
    GlStateManager.disableRescaleNormal();
    GlStateManager.enableLighting();
    GlStateManager.popMatrix();
    super.doRender(entity, x, y, z, entityYaw, partialTicks);
}
 
Example 19
Source File: GuiEnderUtilities.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Draw the template stacks from a "lockable inventory" for otherwise empty slots
 * @param inv
 */
protected void drawTemplateStacks(ItemStackHandlerLockable inv)
{
    // Draw a faint version of the template item for empty locked slots
    RenderHelper.enableGUIStandardItemLighting();
    GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
    GlStateManager.enableRescaleNormal();
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0f, 240.0f);
    this.zLevel = 100.0F;
    this.itemRender.zLevel = 100.0F;
    int invSize = inv.getSlots();

    for (int slotNum = 0; slotNum < invSize; slotNum++)
    {
        Slot slot = this.inventorySlots.getSlot(slotNum);

        if (inv.isSlotLocked(slotNum) && inv.getStackInSlot(slotNum).isEmpty())
        {
            ItemStack stack = inv.getTemplateStackInSlot(slotNum);

            if (stack.isEmpty() == false)
            {
                int x = this.guiLeft + slot.xPos;
                int y = this.guiTop + slot.yPos;
                GlStateManager.enableLighting();
                GlStateManager.enableDepth();
                GlStateManager.enableBlend();
                OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
                GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
                this.itemRender.renderItemAndEffectIntoGUI(stack, x, y);
            }
        }
    }

    this.itemRender.zLevel = 0.0F;
    this.zLevel = 0.0F;
    GlStateManager.disableBlend();
    GlStateManager.enableLighting();
    GlStateManager.enableDepth();
    RenderHelper.enableStandardItemLighting();
}
 
Example 20
Source File: LitematicaRenderer.java    From litematica with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void piecewiseRenderEntities(float partialTicks)
{
    if (this.renderPiecewiseBlocks)
    {
        this.mc.profiler.startSection("litematica_entities");

        fi.dy.masa.malilib.render.RenderUtils.setupBlend();

        this.startShaderIfEnabled();

        this.getWorldRenderer().renderEntities(this.entity, this.camera, partialTicks);

        this.disableShader();

        GlStateManager.disableBlend();

        this.mc.profiler.endSection();
    }
}