Package de.eydamos.backpack.gui

Examples of de.eydamos.backpack.gui.GuiWorkbenchBackpack


    @Override
    @SideOnly(Side.CLIENT)
    public GuiContainer getGuiContainer(BackpackSave backpack, IInventory[] inventories, EntityPlayer entityPlayer) {
        ContainerAdvanced container = getContainer(backpack, inventories, entityPlayer);
        GuiWorkbenchBackpack guiBackpack = new GuiWorkbenchBackpack(container);

        GuiSlot guiSlot;
        for(int i = 0; i < container.inventorySlots.size(); i++) {
            Slot slot = (Slot) container.inventorySlots.get(i);
            if(i == 0) {
                guiSlot = new GuiSlot(slot.xDisplayPosition - 5, slot.yDisplayPosition - 5, 26);
            } else {
                guiSlot = new GuiSlot(slot.xDisplayPosition - 1, slot.yDisplayPosition - 1);
            }
            guiBackpack.addSubPart(guiSlot);
        }

        if(!backpack.isIntelligent()) {
            // arrow
            guiBackpack.addSubPart(new Icon(0, 238, 90, 35, 22, 15));
            // clear button
            Button btn_clear = new Button(0, 88, 16, 11, 11, "c");
            guiBackpack.addSubPart(btn_clear);
        } else {
            Button btn_clear = new Button(0, 66, 16, 11, 11, "c");
            Button btn_save = new Button(1, 81, 16, 11, 11, "s");
            guiBackpack.addSubPart(btn_clear);
            guiBackpack.addSubPart(btn_save);
        }

        int textPositionX = 28;
        Alignment alignment = Alignment.LEFT;
        if(backpack.isIntelligent()) {
            textPositionX = guiBackpack.getWidth() / 2;
            alignment = Alignment.CENTER;
        }
        int textPositionY = 6;

        int slotsPerRow = backpack.getSlotsPerRow();
        int inventoryRows = (int) Math.ceil(inventories[1].getSizeInventory() / (float) slotsPerRow);
        int textPositionY2 = textPositionY + inventoryRows * SLOT + 3 * SLOT + 19;

        guiBackpack.addSubPart(new Label(textPositionX, textPositionY, 0x404040, "container.crafting", alignment));
        guiBackpack.addSubPart(new Label(X_SPACING, textPositionY2, 0x404040, "container.inventory"));

        return guiBackpack;
    }
View Full Code Here

TOP

Related Classes of de.eydamos.backpack.gui.GuiWorkbenchBackpack

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.