Java Code Examples for net.minecraft.client.renderer.RenderHelper#disableStandardItemLighting()

The following examples show how to use net.minecraft.client.renderer.RenderHelper#disableStandardItemLighting() . 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: ArmorComponent.java    From seppuku with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
    super.render(mouseX, mouseY, partialTicks);
   // RenderUtil.drawRect(this.getX(), this.getY(), this.getX() + this.getW(), this.getY() + this.getH(), 0x90222222);
    final Minecraft mc = Minecraft.getMinecraft();

    int space = 0;

    for (int i = 0; i <= 3; i++) {
        final ItemStack stack = mc.player.inventoryContainer.getSlot(8 - i).getStack();
        if (stack != ItemStack.EMPTY) {
            GlStateManager.pushMatrix();
            RenderHelper.enableGUIStandardItemLighting();
            mc.getRenderItem().renderItemAndEffectIntoGUI(stack, (int)this.getX() + space, (int)this.getY());
            mc.getRenderItem().renderItemOverlays(mc.fontRenderer, stack, (int)this.getX() + space, (int)this.getY());
            RenderHelper.disableStandardItemLighting();
            GlStateManager.popMatrix();
            space += 18;
        }
    }

    this.setW(space);
    this.setH(16);
}
 
Example 2
Source File: GuiSelectionScreen.java    From XRay-Mod with GNU General Public License v3.0 6 votes vote down vote up
@Override // @mcp: func_230432_a_  = render
public void func_230432_a_(MatrixStack stack, int entryIdx, int top, int left, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean p_194999_5_, float partialTicks) {
    BlockData blockData = this.block;

    FontRenderer font = Minecraft.getInstance().fontRenderer;
    // @mcp: func_238407_a_ = drawString
    font.func_238407_a_(stack, ITextProperties.func_240652_a_(blockData.getEntryName()), left + 40, top + 7, 0xFFFFFF);
    font.func_238407_a_(stack, ITextProperties.func_240652_a_(blockData.isDrawing() ? "Enabled" : "Disabled"), left + 40, top + 17, blockData.isDrawing() ? Color.GREEN.getRGB() : Color.RED.getRGB());

    RenderHelper.enableStandardItemLighting();
    Minecraft.getInstance().getItemRenderer().renderItemAndEffectIntoGUI(blockData.getItemStack(), left + 15, top + 7);
    RenderHelper.disableStandardItemLighting();
    if (mouseX > left && mouseX < (left + entryWidth) && mouseY > top && mouseY < (top + entryHeight) && mouseY < (this.parent.getTop() + this.parent.getHeight()) && mouseY > this.parent.getTop()) {
        this.parent.parent.func_238654_b_(
                stack,
                Arrays.asList(new TranslationTextComponent("xray.tooltips.edit1"), new TranslationTextComponent("xray.tooltips.edit2")),
                left + 15,
                (entryIdx == this.parent.func_231039_at__().size() - 1 ? (top - (entryHeight - 20)) : (top + (entryHeight + 15))) // @mcp: func_231039_at__ = getEntries
        );  // @mcp: func_230457_a_ = renderTooltip
    }

    RenderSystem.enableAlphaTest();
    RenderSystem.enableBlend();
    RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
    Minecraft.getInstance().getRenderManager().textureManager.bindTexture(GuiSelectionScreen.CIRCLE);
    GuiBase.drawTexturedQuadFit((left + entryWidth) - 37, top + (entryHeight / 2f) - 9, 14, 14, new int[]{255, 255, 255}, 50f);
    GuiBase.drawTexturedQuadFit((left + entryWidth) - 35, top + (entryHeight / 2f) - 7, 10, 10, blockData.getColor());
    RenderSystem.disableAlphaTest();
    RenderSystem.disableBlend();
}
 
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: GuiButtonSpecial.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void drawButton(Minecraft mc, int x, int y){
    if(thisVisible) super.drawButton(mc, x, y);

    if(visible) {
        if(renderedStacks != null) {
            int middleX = xPosition + width / 2;
            int startX = middleX - renderedStacks.length * 9 + 1;
            GL11.glEnable(GL12.GL_RESCALE_NORMAL);
            RenderHelper.enableGUIStandardItemLighting();
            for(int i = 0; i < renderedStacks.length; i++) {
                itemRenderer.renderItemAndEffectIntoGUI(FMLClientHandler.instance().getClient().fontRenderer, FMLClientHandler.instance().getClient().renderEngine, renderedStacks[i], startX + i * 18, yPosition + 2);
            }
            RenderHelper.disableStandardItemLighting();
            GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        }
        if(resLoc != null) {
            mc.getTextureManager().bindTexture(resLoc);
            func_146110_a(xPosition + width / 2 - 8, yPosition + 2, 0, 0, 16, 16, 16, 16);
        }
        if(enabled && !thisVisible && x >= xPosition && y >= yPosition && x < xPosition + width && y < yPosition + height) {
            Gui.drawRect(xPosition, yPosition, xPosition + width, yPosition + height, invisibleHoverColor);
        }
    }
}
 
Example 5
Source File: ScreenEntityEntry.java    From WearableBackpacks with MIT License 6 votes vote down vote up
@Override
public void draw(int mouseX, int mouseY, float partialTicks) {
	int w = getWidth();
	int h = getHeight();
	
	enableBlendAlphaStuffs();
	setRenderColorARGB(_colorBackground); drawRect(1, 1, w - 2, h - 2);
	setRenderColorARGB(_colorBorder);     drawOutline(0, 0, w, h);
	disableBlendAlphaStuffs();
	
	ItemStack stack = getStack();
	if (stack.isEmpty()) return;
	
	GlStateManager.enableDepth();
	GlStateManager.enableRescaleNormal();
	RenderHelper.enableGUIStandardItemLighting();
	getMC().getRenderItem().renderItemIntoGUI(stack, w / 2 - 8, h / 2 - 8);
	RenderHelper.disableStandardItemLighting();
	GlStateManager.disableRescaleNormal();
	GlStateManager.disableDepth();
}
 
Example 6
Source File: BaseComponent.java    From OpenModsLib with MIT License 5 votes vote down vote up
protected void drawItemStack(@Nonnull ItemStack stack, int x, int y) {
	if (stack.isEmpty()) return;

	RenderHelper.enableGUIStandardItemLighting();
	final RenderItem itemRenderer = parent.getItemRenderer();
	GlStateManager.translate(0.0F, 0.0F, 32.0F);
	this.zLevel = 200.0F;
	itemRenderer.zLevel = 200.0F;

	itemRenderer.renderItemAndEffectIntoGUI(stack, x, y);
	this.zLevel = 0.0F;
	itemRenderer.zLevel = 0.0F;
	RenderHelper.disableStandardItemLighting();
}
 
Example 7
Source File: GuiInventoryExpandedCrafting.java    From Cyberware with MIT License 5 votes vote down vote up
public static void drawEntityOnScreen(int posX, int posY, int scale, float mouseX, float mouseY, EntityLivingBase ent)
{
	GlStateManager.enableColorMaterial();
	GlStateManager.pushMatrix();
	GlStateManager.translate((float)posX, (float)posY, 50.0F);
	GlStateManager.scale((float)(-scale), (float)scale, (float)scale);
	GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
	float f = ent.renderYawOffset;
	float f1 = ent.rotationYaw;
	float f2 = ent.rotationPitch;
	float f3 = ent.prevRotationYawHead;
	float f4 = ent.rotationYawHead;
	GlStateManager.rotate(135.0F, 0.0F, 1.0F, 0.0F);
	RenderHelper.enableStandardItemLighting();
	GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F);
	GlStateManager.rotate(-((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F);
	ent.renderYawOffset = (float)Math.atan((double)(mouseX / 40.0F)) * 20.0F;
	ent.rotationYaw = (float)Math.atan((double)(mouseX / 40.0F)) * 40.0F;
	ent.rotationPitch = -((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F;
	ent.rotationYawHead = ent.rotationYaw;
	ent.prevRotationYawHead = ent.rotationYaw;
	GlStateManager.translate(0.0F, 0.0F, 0.0F);
	RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager();
	rendermanager.setPlayerViewY(180.0F);
	rendermanager.setRenderShadow(false);
	rendermanager.doRenderEntity(ent, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, false);
	rendermanager.setRenderShadow(true);
	ent.renderYawOffset = f;
	ent.rotationYaw = f1;
	ent.rotationPitch = f2;
	ent.prevRotationYawHead = f3;
	ent.rotationYawHead = f4;
	GlStateManager.popMatrix();
	RenderHelper.disableStandardItemLighting();
	GlStateManager.disableRescaleNormal();
	GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
	GlStateManager.disableTexture2D();
	GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);
}
 
Example 8
Source File: EditBlockListScreen.java    From ForgeWurst with GNU General Public License v3.0 5 votes vote down vote up
private String renderIconAndGetName(ItemStack stack, int y)
{
	if(WItem.isNullOrEmpty(stack))
	{
		GL11.glPushMatrix();
		GL11.glTranslated(52, y, 0);
		GL11.glScaled(0.75, 0.75, 0.75);
		
		RenderHelper.enableGUIStandardItemLighting();
		mc.getRenderItem().renderItemAndEffectIntoGUI(
			new ItemStack(Blocks.GRASS), 0, 0);
		RenderHelper.disableStandardItemLighting();
		GL11.glPopMatrix();
		
		GL11.glDisable(GL11.GL_DEPTH_TEST);
		FontRenderer fr = WMinecraft.getFontRenderer();
		fr.drawString("?", 55, y + 2, 0xf0f0f0, true);
		GL11.glEnable(GL11.GL_DEPTH_TEST);
		
		return ChatFormatting.ITALIC + "unknown block"
			+ ChatFormatting.RESET;
		
	}else
	{
		GL11.glPushMatrix();
		GL11.glTranslated(52, y, 0);
		GL11.glScaled(0.75, 0.75, 0.75);
		
		RenderHelper.enableGUIStandardItemLighting();
		mc.getRenderItem().renderItemAndEffectIntoGUI(stack, 0, 0);
		RenderHelper.disableStandardItemLighting();
		
		GL11.glPopMatrix();
		
		return stack.getDisplayName();
	}
}
 
Example 9
Source File: GuiBlockList.java    From XRay-Mod with GNU General Public License v3.0 5 votes vote down vote up
@Override // @mcp; render
public void func_230432_a_(MatrixStack stack, int entryIdx, int top, int left, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean p_194999_5_, float partialTicks) {
    FontRenderer font = this.parent.field_230668_b_.fontRenderer; // @mcp: field_230668_b_ = minecraft

    ResourceLocation resource = this.block.getItemStack().getItem().getRegistryName();
    font.func_238407_a_(stack,this.block.getItemStack().getItem().getName(), left + 40, top + 7, Color.WHITE.getRGB()); // @mcp: func_238407_a_ = drawString
    font.func_238407_a_(stack, ITextProperties.func_240652_a_(resource != null ? resource.getNamespace() : ""), left + 40, top + 17, Color.WHITE.getRGB()); // @mcp: func_238407_a_ = drawString
    // @mcp: func_240652_a_ = unknown... Code recommendation

    RenderHelper.enableStandardItemLighting();
    this.parent.field_230668_b_.getItemRenderer().renderItemAndEffectIntoGUI(this.block.getItemStack(), left + 15, top + 7); // @mcp: field_230668_b_ = minecraft
    RenderHelper.disableStandardItemLighting();
}
 
Example 10
Source File: ItemTabInfo.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void renderTab(TextureArea tabTexture, int posX, int posY, int xSize, int ySize, boolean isSelected) {
    tabTexture.draw(posX, posY, xSize, ySize);
    GlStateManager.enableRescaleNormal();
    RenderHelper.enableGUIStandardItemLighting();
    Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(iconStack, posX + xSize / 2 - 8, posY + ySize / 2 - 8);
    RenderHelper.disableStandardItemLighting();
    GlStateManager.disableRescaleNormal();
}
 
Example 11
Source File: GuiUtils.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
public static void drawItemStack(ItemStack stack, int x, int y){
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    RenderHelper.enableGUIStandardItemLighting();
    itemRenderer.renderItemAndEffectIntoGUI(FMLClientHandler.instance().getClient().fontRenderer, FMLClientHandler.instance().getClient().renderEngine, stack, x, y);
    RenderHelper.disableStandardItemLighting();
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
}
 
Example 12
Source File: GuiAddBlock.java    From XRay-Mod with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void renderExtra(MatrixStack stack, int x, int y, float partialTicks) {
    // @mcp: func_238405_a_ = drawStringWithShadow
    // @mcp: func_235333_g_ = getNameTextComponent
    getFontRender().func_238405_a_(stack, selectBlock.func_235333_g_().getString(), getWidth() / 2f - 100, getHeight() / 2f - 90, 0xffffff);

    oreName.func_230430_a_(stack, x, y, partialTicks); // @mcp: func_230430_a_ = render
    renderPreview(getWidth() / 2 - 100, getHeight() / 2 - 40, (float) redSlider.getValue(), (float) greenSlider.getValue(), (float) blueSlider.getValue());

    RenderHelper.enableStandardItemLighting();
    this.field_230707_j_.renderItemAndEffectIntoGUI(this.itemStack, getWidth() / 2 + 85, getHeight() / 2 - 105); // @mcp: field_230707_j_ = itemRender
    RenderHelper.disableStandardItemLighting();
}
 
Example 13
Source File: GuiEdit.java    From XRay-Mod with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void renderExtra(MatrixStack stack, int x, int y, float partialTicks) {
    getFontRender().func_238405_a_(stack, this.block.getItemStack().getDisplayName().getString(), getWidth() / 2f - 138, getHeight() / 2f - 90, 0xffffff); // @mcp: func_238405_a_ = drawtextwithshadow

    oreName.func_230430_a_(stack, x, y, partialTicks); // @mcp: func_230430_a_ = render

    GuiAddBlock.renderPreview(getWidth() / 2 - 138, getHeight() / 2 - 40, (float) redSlider.getValue(), (float) greenSlider.getValue(), (float) blueSlider.getValue());

    RenderHelper.enableStandardItemLighting();
    this.field_230707_j_.renderItemAndEffectIntoGUI(this.block.getItemStack(), getWidth() / 2 + 50, getHeight() / 2 - 105); // @mcp: field_230707_j_ = itemRenderer
    RenderHelper.disableStandardItemLighting();
}
 
Example 14
Source File: MixinItemRenderer.java    From LiquidBounce with GNU General Public License v3.0 4 votes vote down vote up
/**
 * @author CCBlueX
 */
@Overwrite
public void renderItemInFirstPerson(float partialTicks) {
    float f = 1.0F - (this.prevEquippedProgress + (this.equippedProgress - this.prevEquippedProgress) * partialTicks);
    AbstractClientPlayer abstractclientplayer = this.mc.thePlayer;
    float f1 = abstractclientplayer.getSwingProgress(partialTicks);
    float f2 = abstractclientplayer.prevRotationPitch + (abstractclientplayer.rotationPitch - abstractclientplayer.prevRotationPitch) * partialTicks;
    float f3 = abstractclientplayer.prevRotationYaw + (abstractclientplayer.rotationYaw - abstractclientplayer.prevRotationYaw) * partialTicks;
    this.rotateArroundXAndY(f2, f3);
    this.setLightMapFromPlayer(abstractclientplayer);
    this.rotateWithPlayerRotations((EntityPlayerSP) abstractclientplayer, partialTicks);
    GlStateManager.enableRescaleNormal();
    GlStateManager.pushMatrix();

    if(this.itemToRender != null) {
        final KillAura killAura = (KillAura) LiquidBounce.moduleManager.getModule(KillAura.class);

        if(this.itemToRender.getItem() instanceof net.minecraft.item.ItemMap) {
            this.renderItemMap(abstractclientplayer, f2, f, f1);
        } else if (abstractclientplayer.getItemInUseCount() > 0 || (itemToRender.getItem() instanceof ItemSword && killAura.getBlockingStatus())) {
            EnumAction enumaction = killAura.getBlockingStatus() ? EnumAction.BLOCK : this.itemToRender.getItemUseAction();

            switch(enumaction) {
                case NONE:
                    this.transformFirstPersonItem(f, 0.0F);
                    break;
                case EAT:
                case DRINK:
                    this.performDrinking(abstractclientplayer, partialTicks);
                    this.transformFirstPersonItem(f, f1);
                    break;
                case BLOCK:
                    this.transformFirstPersonItem(f + 0.1F, f1);
                    this.doBlockTransformations();
                    GlStateManager.translate(-0.5F, 0.2F, 0.0F);
                    break;
                case BOW:
                    this.transformFirstPersonItem(f, f1);
                    this.doBowTransformations(partialTicks, abstractclientplayer);
            }
        }else{
            if (!LiquidBounce.moduleManager.getModule(SwingAnimation.class).getState())
                this.doItemUsedTransformations(f1);
            this.transformFirstPersonItem(f, f1);
        }

        this.renderItem(abstractclientplayer, this.itemToRender, ItemCameraTransforms.TransformType.FIRST_PERSON);
    }else if(!abstractclientplayer.isInvisible()) {
        this.renderPlayerArm(abstractclientplayer, f, f1);
    }

    GlStateManager.popMatrix();
    GlStateManager.disableRescaleNormal();
    RenderHelper.disableStandardItemLighting();
}
 
Example 15
Source File: ModularUIGui.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
    this.hoveredSlot = null;
    drawDefaultBackground();

    GlStateManager.disableRescaleNormal();
    RenderHelper.disableStandardItemLighting();
    GlStateManager.disableLighting();
    GlStateManager.disableDepth();

    drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY);

    RenderHelper.enableGUIStandardItemLighting();
    GlStateManager.pushMatrix();
    GlStateManager.translate(guiLeft, guiTop, 0.0F);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    GlStateManager.enableRescaleNormal();

    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);

    for (int i = 0; i < this.inventorySlots.inventorySlots.size(); ++i) {
        Slot slot = this.inventorySlots.inventorySlots.get(i);
        if (slot.isEnabled()) {
            this.drawSlotContents(slot);
        }
        if (isPointInRegion(slot.xPos, slot.yPos, 16, 16, mouseX, mouseY) && slot.isEnabled()) {
            renderSlotOverlay(slot);
            setHoveredSlot(slot);
        }
    }

    RenderHelper.disableStandardItemLighting();
    GlStateManager.popMatrix();

    drawGuiContainerForegroundLayer(mouseX, mouseY);

    GlStateManager.pushMatrix();
    GlStateManager.translate(guiLeft, guiTop, 0.0F);
    RenderHelper.enableGUIStandardItemLighting();

    MinecraftForge.EVENT_BUS.post(new GuiContainerEvent.DrawForeground(this, mouseX, mouseY));

    GlStateManager.enableDepth();
    renderItemStackOnMouse(mouseX, mouseY);
    renderReturningItemStack();

    GlStateManager.popMatrix();
    GlStateManager.enableLighting();
    RenderHelper.enableStandardItemLighting();

    renderHoveredToolTip(mouseX, mouseY);
}
 
Example 16
Source File: HyperiumItemRenderer.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void renderItemInFirstPerson(float partialTicks, float prevEquippedProgress, float equippedProgress, ItemStack itemToRender) {
    float f = 1.0F - (prevEquippedProgress + (equippedProgress - prevEquippedProgress) * partialTicks);
    EntityPlayerSP entityPlayerSP = mc.thePlayer;
    float f1 = entityPlayerSP.getSwingProgress(partialTicks);
    float f2 = entityPlayerSP.prevRotationPitch + (entityPlayerSP.rotationPitch - entityPlayerSP.prevRotationPitch) * partialTicks;
    float f3 = entityPlayerSP.prevRotationYaw + (entityPlayerSP.rotationYaw - entityPlayerSP.prevRotationYaw) * partialTicks;
    ((IMixinItemRenderer) parent).callRotateArroundXAndY(f2, f3);
    ((IMixinItemRenderer) parent).callSetLightMapFromPlayer(entityPlayerSP);
    ((IMixinItemRenderer) parent).callRotateWithPlayerRotations(entityPlayerSP, partialTicks);
    GlStateManager.enableRescaleNormal();
    GlStateManager.pushMatrix();

    if (itemToRender != null) {
        if (itemToRender.getItem() == Items.filled_map) {
            ((IMixinItemRenderer) parent).callRenderItemMap(entityPlayerSP, f2, f, f1);
        } else if ((itemToRender.getItem() instanceof ItemSword) && !mc.thePlayer.isBlocking() && Settings.CUSTOM_SWORD_ANIMATION) {
            transformFirstPersonItem(f, f1);
        } else if (entityPlayerSP.getItemInUseCount() > 0) {
            EnumAction enumaction = itemToRender.getItemUseAction();

            switch (enumaction) {
                case NONE:
                    transformFirstPersonItem(f, 0.0F);
                    break;
                case EAT:
                case DRINK:
                    ((IMixinItemRenderer) parent).callPerformDrinking(entityPlayerSP, partialTicks);
                    if (Settings.OLD_EATING) {
                        transformFirstPersonItem(f, f1);
                    } else {
                        transformFirstPersonItem(f, 0.0F);
                    }
                    break;
                case BLOCK:
                    if (Settings.OLD_BLOCKHIT) {
                        transformFirstPersonItem(f, f1);
                        ((IMixinItemRenderer) parent).callDoBlockTransformations();
                        GlStateManager.scale(0.83f, 0.88f, 0.85f);
                        GlStateManager.translate(-0.3f, 0.1f, 0.0f);
                    } else {
                        transformFirstPersonItem(f, 0f);
                        ((IMixinItemRenderer) parent).callDoBlockTransformations();
                    }
                    break;

                case BOW:
                    if (Settings.OLD_BOW) {
                        transformFirstPersonItem(f, f1);
                        ((IMixinItemRenderer) parent).callDoBowTransformations(partialTicks, entityPlayerSP);
                        GlStateManager.translate(0.0F, 0.1F, -0.15F);
                    } else {
                        transformFirstPersonItem(f, 0.0F);
                        ((IMixinItemRenderer) parent).callDoBowTransformations(partialTicks, entityPlayerSP);
                    }
            }
        } else {
            ((IMixinItemRenderer) parent).callDoItemUsedTransformations(f1);
            transformFirstPersonItem(f, f1);
        }

        parent.renderItem(entityPlayerSP, itemToRender, ItemCameraTransforms.TransformType.FIRST_PERSON);
    } else if (!entityPlayerSP.isInvisible()) {
        ((IMixinItemRenderer) parent).callRenderPlayerArm(entityPlayerSP, f, f1);
    }

    GlStateManager.popMatrix();
    GlStateManager.disableRescaleNormal();
    RenderHelper.disableStandardItemLighting();
}
 
Example 17
Source File: GuiContainerTFC.java    From TFC2 with GNU General Public License v3.0 4 votes vote down vote up
protected void drawHoveringTextZLevel(List par1List, int par2, int par3, FontRenderer font, float z)
{
	if (!par1List.isEmpty())
	{
		GL11.glDisable(GL12.GL_RESCALE_NORMAL);
		RenderHelper.disableStandardItemLighting();
		GL11.glDisable(GL11.GL_LIGHTING);
		//GL11.glDisable(GL11.GL_DEPTH_TEST);
		int k = 0;
		Iterator iterator = par1List.iterator();

		while (iterator.hasNext())
		{
			String s = (String) iterator.next();
			int l = font.getStringWidth(s);
			if (l > k)
				k = l;
		}

		int i1 = par2 + 12;
		int j1 = par3 - 12;
		int k1 = 8;

		if (par1List.size() > 1)
			k1 += 2 + (par1List.size() - 1) * 10;

		if (i1 + k > this.width)
			i1 -= 28 + k;

		if (j1 + k1 + 6 > this.height)
			j1 = this.height - k1 - 6;

		this.zLevel = z;
		itemRender.zLevel = 300.0F;
		int l1 = -267386864;
		this.drawGradientRect(i1 - 3, j1 - 4, i1 + k + 3, j1 - 3, l1, l1);
		this.drawGradientRect(i1 - 3, j1 + k1 + 3, i1 + k + 3, j1 + k1 + 4, l1, l1);
		this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 + k1 + 3, l1, l1);
		this.drawGradientRect(i1 - 4, j1 - 3, i1 - 3, j1 + k1 + 3, l1, l1);
		this.drawGradientRect(i1 + k + 3, j1 - 3, i1 + k + 4, j1 + k1 + 3, l1, l1);
		int i2 = 1347420415;
		int j2 = (i2 & 16711422) >> 1 | i2 & -16777216;
		this.drawGradientRect(i1 - 3, j1 - 3 + 1, i1 - 3 + 1, j1 + k1 + 3 - 1, i2, j2);
		this.drawGradientRect(i1 + k + 2, j1 - 3 + 1, i1 + k + 3, j1 + k1 + 3 - 1, i2, j2);
		this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 - 3 + 1, i2, i2);
		this.drawGradientRect(i1 - 3, j1 + k1 + 2, i1 + k + 3, j1 + k1 + 3, j2, j2);

		for (int k2 = 0; k2 < par1List.size(); ++k2)
		{
			String s1 = (String) par1List.get(k2);
			font.drawStringWithShadow(s1, i1, j1, -1);

			if (k2 == 0)
				j1 += 2;
			j1 += 10;
		}

		this.zLevel = 0.0F;
		itemRender.zLevel = 0.0F;
		/*GL11.glEnable(GL11.GL_LIGHTING);
		RenderHelper.enableStandardItemLighting();
		GL11.glEnable(GL12.GL_RESCALE_NORMAL);*/
	}
}
 
Example 18
Source File: ShulkerPreviewModule.java    From seppuku with GNU General Public License v3.0 4 votes vote down vote up
@Listener
public void onRenderTooltip(EventRenderTooltip event) {
    if (event.getItemStack() == null)
        return;

    final Minecraft mc = Minecraft.getMinecraft();

    if (event.getItemStack().getItem() instanceof ItemShulkerBox) {
        ItemStack shulker = event.getItemStack();
        NBTTagCompound tagCompound = shulker.getTagCompound();
        if (tagCompound != null && tagCompound.hasKey("BlockEntityTag", 10)) {
            NBTTagCompound blockEntityTag = tagCompound.getCompoundTag("BlockEntityTag");
            if (blockEntityTag.hasKey("Items", 9)) {
                event.setCanceled(true); // cancel rendering the old tooltip

                NonNullList<ItemStack> nonnulllist = NonNullList.<ItemStack>withSize(27, ItemStack.EMPTY);
                ItemStackHelper.loadAllItems(blockEntityTag, nonnulllist); // load the itemstacks from the tag to the list

                // store mouse/event coords
                int x = event.getX();
                int y = event.getY();

                // translate to mouse x, y
                GlStateManager.translate(x + 10, y - 5, 0);

                GlStateManager.disableLighting();
                GlStateManager.disableDepth();
                // background
                RenderUtil.drawRect(-3, -mc.fontRenderer.FONT_HEIGHT - 4, 9 * 16 + 3, 3 * 16 + 3, 0x99101010);
                RenderUtil.drawRect(-2, -mc.fontRenderer.FONT_HEIGHT - 3, 9 * 16 + 2, 3 * 16 + 2, 0xFF202020);
                RenderUtil.drawRect(0, 0, 9 * 16, 3 * 16, 0xFF101010);

                // text
                mc.fontRenderer.drawStringWithShadow(shulker.getDisplayName(), 0, -mc.fontRenderer.FONT_HEIGHT - 1, 0xFFFFFFFF);

                GlStateManager.enableDepth();
                mc.getRenderItem().zLevel = 150.0F;
                RenderHelper.enableGUIStandardItemLighting();

                // loop through items in shulker inventory
                for (int i = 0; i < nonnulllist.size(); i++) {
                    ItemStack itemStack = nonnulllist.get(i);
                    int offsetX = (i % 9) * 16;
                    int offsetY = (i / 9) * 16;
                    mc.getRenderItem().renderItemAndEffectIntoGUI(itemStack, offsetX, offsetY);
                    mc.getRenderItem().renderItemOverlayIntoGUI(mc.fontRenderer, itemStack, offsetX, offsetY, null);
                }

                RenderHelper.disableStandardItemLighting();
                mc.getRenderItem().zLevel = 0.0F;
                GlStateManager.enableLighting();

                // reverse the translate
                GlStateManager.translate(-(x + 10), -(y - 5), 0);
            }
        }

        if(this.middleClick.getValue()) {
            if (Mouse.isButtonDown(2)) {
                if (!this.clicked) {
                    final BlockShulkerBox shulkerBox = (BlockShulkerBox) Block.getBlockFromItem(shulker.getItem());
                    if (shulkerBox != null) {
                        final NBTTagCompound tag = shulker.getTagCompound();
                        if (tag != null && tag.hasKey("BlockEntityTag", 10)) {
                            final NBTTagCompound entityTag = tag.getCompoundTag("BlockEntityTag");

                            final TileEntityShulkerBox te = new TileEntityShulkerBox();
                            te.setWorld(mc.world);
                            te.readFromNBT(entityTag);
                            mc.displayGuiScreen(new GuiShulkerBox(mc.player.inventory, te));
                        }
                    }
                }
                this.clicked = true;
            } else {
                this.clicked = false;
            }
        }
    }
}
 
Example 19
Source File: RenderUtility.java    From NOVA-Core with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Disables lighting and turns glow on.
 */
public static void disableLighting() {
	RenderHelper.disableStandardItemLighting();
	OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F);
}
 
Example 20
Source File: RenderCrucible.java    From ExNihiloAdscensio with MIT License 4 votes vote down vote up
@Override
public void renderTileEntityAt(TileCrucible te, double x, double y, double z,
		float partialTicks, int destroyStage) 
{
	Tessellator tes = Tessellator.getInstance();
	VertexBuffer wr = tes.getBuffer();

	RenderHelper.disableStandardItemLighting();
	GlStateManager.pushMatrix();
	GlStateManager.translate(x, y, z);
	SpriteColor sprite = te.getSpriteAndColor();
	if (sprite != null)
	{
		TextureAtlasSprite icon = sprite.getSprite();
		double minU = (double) icon.getMinU();
		double maxU = (double) icon.getMaxU();
		double minV = (double) icon.getMinV();
		double maxV = (double) icon.getMaxV();
		
		// determine the tint for the fluid/block
		Color color = sprite.getColor();

		this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);

		wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL);
		//wr.begin(GL11.GL_QUADS, new VertexFormat().addElement(DefaultVertexFormats.POSITION_3F).addElement(DefaultVertexFormats.COLOR_4UB).addElement(DefaultVertexFormats.NORMAL_3B));
		// Offset by bottome of crucible, which is 4 pixels above the base of the block
		float fillAmount = (12F / 16F) * te.getFilledAmount() + (4F / 16F);
		
		wr.pos(0.125F, fillAmount, 0.125F).tex(minU, minV).color(color.r, color.g, color.b, color.a).normal(0, 1, 0).endVertex();
		wr.pos(0.125F, fillAmount, 0.875F).tex(minU, maxV).color(color.r, color.g, color.b, color.a).normal(0, 1, 0).endVertex();
		wr.pos(0.875F, fillAmount, 0.875F).tex(maxU, maxV).color(color.r, color.g, color.b, color.a).normal(0, 1, 0).endVertex();
		wr.pos(0.875F, fillAmount, 0.125F).tex(maxU, minV).color(color.r, color.g, color.b, color.a).normal(0, 1, 0).endVertex();

		tes.draw();
	}

	GlStateManager.disableBlend();
	GlStateManager.enableLighting();
	GlStateManager.popMatrix();
	RenderHelper.enableStandardItemLighting();

}