Java Code Examples for codechicken.nei.guihook.GuiContainerManager#drawItem()

The following examples show how to use codechicken.nei.guihook.GuiContainerManager#drawItem() . 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: DefaultOverlayRenderer.java    From NotEnoughItems with MIT License 6 votes vote down vote up
@Override
public void renderOverlay(GuiContainerManager gui, Slot slot) {
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);

    GuiContainerManager.setItemRenderColour(0xA0A0A0B0);
    for (PositionedStack stack : ingreds) {
        if (stack.relx == slot.xPos && stack.rely == slot.yPos) {
            GuiContainerManager.drawItem(stack.relx, stack.rely, stack.item);
        }
    }
    GuiContainerManager.setItemRenderColour(-1);

    GlStateManager.disableBlend();
    GlStateManager.enableLighting();
}
 
Example 2
Source File: ItemPanel.java    From NotEnoughItems with MIT License 6 votes vote down vote up
@Override
public void draw(int mousex, int mousey) {
    if (itemsPerPage == 0)
        return;

    GuiContainerManager.enableMatrixStackLogging();
    int index = firstIndex;
    for (int i = 0; i < rows * columns && index < items.size(); i++) {
        if (validSlotMap[i]) {
            Rectangle4i rect = getSlotRect(i);
            if (rect.contains(mousex, mousey))
                drawRect(rect.x, rect.y, rect.w, rect.h, 0xee555555);//highlight

            GuiContainerManager.drawItem(rect.x + 1, rect.y + 1, items.get(index));

            index++;
        }
    }
    GuiContainerManager.disableMatrixStackLogging();
}
 
Example 3
Source File: SubsetWidget.java    From NotEnoughItems with MIT License 6 votes vote down vote up
@Override
protected void drawSlot(int slot, int x, int y, int mx, int my, float frame) {
    int w = windowBounds().width;
    Rectangle4i r = new Rectangle4i(x, y, w, getSlotHeight(slot));
    if(slot < sorted.size()) {
        SubsetTag tag = sorted.get(slot);
        LayoutManager.getLayoutStyle().drawSubsetTag(tag.displayName(), x, y, r.w, r.h, tag.state.state, r.contains(mx, my));
    }
    else {
        ItemStack stack = state.items.get(slot-sorted.size());
        boolean hidden = SubsetWidget.isHidden(stack);

        int itemx = w/2-8;
        int itemy = 1;

        LayoutManager.getLayoutStyle().drawSubsetTag(null, x, y, r.w, r.h, hidden ? 0 : 2, false);

        GuiContainerManager.drawItem(x+itemx, y+itemy, stack);
        if(new Rectangle4i(itemx, itemy, 16, 16).contains(mx, my))
            SubsetWidget.hoverStack = stack;
    }
}
 
Example 4
Source File: OptionUtilities.java    From NotEnoughItems with MIT License 6 votes vote down vote up
@Override
public void drawIcons()
{
    int x = buttonX();
    LayoutManager.drawIcon(x+4, 4, new Image(120, 24, 12, 12)); x+=24;
    LayoutManager.drawIcon(x+4, 4, new Image(120, 12, 12, 12)); x+=24;
    LayoutManager.drawIcon(x+4, 4, new Image(168, 24, 12, 12)); x+=24;
    LayoutManager.drawIcon(x+4, 4, new Image(144, 12, 12, 12)); x+=24;
    LayoutManager.drawIcon(x+4, 4, new Image(180, 24, 12, 12)); x+=24;
    LayoutManager.drawIcon(x+4, 4, new Image(132, 12, 12, 12)); x+=24;
    RenderHelper.enableGUIStandardItemLighting();
    GlStateManager.enableRescaleNormal();
    ItemStack sword = new ItemStack(Items.diamond_sword);
    sword.addEnchantment(Enchantment.sharpness, 1);
    GuiContainerManager.drawItem(x+2, 2, sword); x+=24;
    GuiContainerManager.drawItem(x+2, 2, new ItemStack(Items.potionitem)); x+=24;
    GuiContainerManager.drawItem(x+2, 2, new ItemStack(Blocks.stone)); x+=24;
}
 
Example 5
Source File: GuiItemIconDumper.java    From NotEnoughItems with MIT License 6 votes vote down vote up
private void drawItems() {
    Dimension d = GuiDraw.displayRes();

    GlStateManager.matrixMode(GL11.GL_PROJECTION);
    GlStateManager.loadIdentity();
    GlStateManager.ortho(0, d.width*16D/iconSize, d.height*16D/iconSize, 0, 1000, 3000);
    GlStateManager.matrixMode(GL11.GL_MODELVIEW);
    GlStateManager.clearColor(0, 0, 0, 0);
    GlStateManager.clear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

    int rows = d.height / boxSize;
    int cols = d.width / boxSize;
    int fit = rows*cols;

    RenderHelper.enableGUIStandardItemLighting();
    GlStateManager.enableRescaleNormal();
    GlStateManager.color(1, 1, 1, 1);

    for(int i = 0; drawIndex < ItemPanel.items.size() && i < fit; drawIndex++, i++) {
        int x = i%cols * 18;
        int y = i/cols * 18;
        GuiContainerManager.drawItem(x+1, y+1, ItemPanel.items.get(drawIndex));
    }

    GL11.glFlush();
}
 
Example 6
Source File: ItemPanel.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@Override
public void postDraw(int mousex, int mousey) {
    if (draggedStack != null) {
        GuiContainerManager.drawItems.zLevel += 100;
        GuiContainerManager.drawItem(mousex - 8, mousey - 8, draggedStack);
        GuiContainerManager.drawItems.zLevel -= 100;
    }
}
 
Example 7
Source File: DefaultOverlayRenderer.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@Override
public void renderOverlay(GuiContainerManager gui, Slot slot) {
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);

    GuiContainerManager.setItemRenderColour(0xA0A0A0B0);
    for (PositionedStack stack : ingreds) {
        if (stack.relx == slot.xDisplayPosition && stack.rely == slot.yDisplayPosition)
            GuiContainerManager.drawItem(stack.relx, stack.rely, stack.item);
    }
    GuiContainerManager.setItemRenderColour(-1);

    GlStateManager.disableBlend();
    GlStateManager.enableLighting();
}