net.minecraft.inventory.Slot Java Examples

The following examples show how to use net.minecraft.inventory.Slot. 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: CraftContainer.java    From Thermos with GNU General Public License v3.0 6 votes vote down vote up
private void setupWorkbench(net.minecraft.inventory.IInventory top, net.minecraft.inventory.IInventory bottom) {
    // This code copied from ContainerWorkbench
    this.addSlotToContainer(new net.minecraft.inventory.Slot(top, 0, 124, 35));

    int row;
    int col;

    for (row = 0; row < 3; ++row) {
        for (col = 0; col < 3; ++col) {
            this.addSlotToContainer(new net.minecraft.inventory.Slot(top, 1 + col + row * 3, 30 + col * 18, 17 + row * 18));
        }
    }

    for (row = 0; row < 3; ++row) {
        for (col = 0; col < 9; ++col) {
            this.addSlotToContainer(new net.minecraft.inventory.Slot(bottom, col + row * 9 + 9, 8 + col * 18, 84 + row * 18));
        }
    }

    for (col = 0; col < 9; ++col) {
        this.addSlotToContainer(new net.minecraft.inventory.Slot(bottom, col, 8 + col * 18, 142));
    }
    // End copy from ContainerWorkbench
}
 
Example #2
Source File: ShowContainer.java    From ehacks-pro with GNU General Public License v3.0 6 votes vote down vote up
public ShowContainerContainer(ItemStack[] inventory, String containerName) {
    this.containerName = containerName;
    this.inventory = inventory;
    int x = 0;
    int y = 0;
    int page = 0;
    for (int i = 0; i < inventory.length; i++) {
        if (slots.size() == page) {
            slots.add(new ArrayList<>());
        }
        Slot slot = new ShowContainerSlot(inventory[i], i, page == currentPage ? 12 + x * 18 : -2000, page == currentPage ? 18 + y * 18 : -2000);
        slots.get(page).add(slot);
        this.addSlotToContainer(slot);
        this.putStackInSlot(i, inventory[i]);
        x++;
        y += x / 13;
        x %= 13;
        page += y / 11;
        y %= 11;
    }
    if (slots.isEmpty()) {
        slots.add(new ArrayList<>());
    }
}
 
Example #3
Source File: NEIController.java    From NotEnoughItems with MIT License 6 votes vote down vote up
@Override
public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyCode) {
    if (!NEIClientConfig.isEnabled() ||
            GuiInfo.hasCustomSlots(gui) ||
            isSpreading(gui))
        return false;

    Slot slot = GuiContainerManager.getSlotMouseOver(gui);
    if (slot == null)
        return false;

    int slotIndex = slot.slotNumber;

    if (keyCode == Minecraft.getMinecraft().gameSettings.keyBindDrop.getKeyCode() && NEIClientUtils.shiftKey()) {
        FastTransferManager.clickSlot(gui, slotIndex);
        fastTransferManager.throwAll(gui, slotIndex);
        FastTransferManager.clickSlot(gui, slotIndex);

        return true;
    }

    return false;
}
 
Example #4
Source File: ContainerElevator.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
public ContainerElevator(InventoryPlayer inventoryPlayer, TileEntityElevatorBase te){
    super(te);

    // add the upgrade slots
    addSlotToContainer(new SlotUpgrade(te, 0, 23, 29));
    addSlotToContainer(new SlotUpgrade(te, 1, 41, 29));
    addSlotToContainer(new SlotUpgrade(te, 2, 23, 47));
    addSlotToContainer(new SlotUpgrade(te, 3, 41, 47));

    // Add the camo slots.
    addSlotToContainer(new Slot(te, 4, 77, 36));
    addSlotToContainer(new Slot(te, 5, 77, 55));

    // Add the player's inventory slots to the container
    for(int inventoryRowIndex = 0; inventoryRowIndex < 3; ++inventoryRowIndex) {
        for(int inventoryColumnIndex = 0; inventoryColumnIndex < 9; ++inventoryColumnIndex) {
            addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 8 + inventoryColumnIndex * 18, 84 + inventoryRowIndex * 18));
        }
    }

    // Add the player's action bar slots to the container
    for(int actionBarSlotIndex = 0; actionBarSlotIndex < 9; ++actionBarSlotIndex) {
        addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 8 + actionBarSlotIndex * 18, 142));
    }
}
 
Example #5
Source File: ContainerBloomeryFurnace.java    From GardenCollection with MIT License 6 votes vote down vote up
public ContainerBloomeryFurnace (InventoryPlayer inventory, TileEntityBloomeryFurnace tile) {
    tileFurnace = tile;

    primarySlot = addSlotToContainer(new Slot(tile, 0, 56, 17));
    secondarySlot = addSlotToContainer(new Slot(tile, 1, 35, 17));
    fuelSlot = addSlotToContainer(new Slot(tile, 2, 56, 53));

    outputSlot = addSlotToContainer(new SlotBloomeryOutput(inventory.player, tile, 3, 116, 35));

    playerSlots = new ArrayList<Slot>();
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 9; j++)
            playerSlots.add(addSlotToContainer(new Slot(inventory, j + i * 9 + 9, InventoryX + j * 18, InventoryY + i * 18)));
    }

    hotbarSlots = new ArrayList<Slot>();
    for (int i = 0; i < 9; i++)
        hotbarSlots.add(addSlotToContainer(new Slot(inventory, i, InventoryX + i * 18, HotbarY)));
}
 
Example #6
Source File: GuiChisel.java    From Chisel-2 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void drawGuiContainerBackgroundLayer(float f, int mx, int my) {
	drawDefaultBackground();
	GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

	int i = width - xSize >> 1;
	int j = height - ySize >> 1;

	String texture = "chisel:textures/chisel2Gui.png";

	GeneralClient.bind(texture);
	drawTexturedModalRect(i, j, 0, 0, xSize, ySize);

	int x = (width - xSize) / 2;
	int y = (height - ySize) / 2;

	Slot main = (Slot) container.inventorySlots.get(InventoryChiselSelection.normalSlots);
	if (main.getStack() == null) {
		GuiAutoChisel.drawSlotOverlay(this, x + 14, y + 14, main, 0, ySize, 60);
	}
}
 
Example #7
Source File: FastTransferManager.java    From NotEnoughItems with MIT License 6 votes vote down vote up
public void throwAll(GuiContainer window, int pickedUpFromSlot) {
    ItemStack held = NEIClientUtils.getHeldItem();
    if (held == null)
        return;

    clickSlot(window, -999);

    generateSlotMap(window.inventorySlots, held);
    Integer zone = slotZoneMap.get(pickedUpFromSlot);
    if(zone == null) //something went wrong and we can't work out where the item was picked up from
        return;

    for (int slotIndex : slotZones.get(zone)) {
        Slot slot = window.inventorySlots.getSlot(slotIndex);
        if (areStacksSameType(held, slot.getStack())) {
            clickSlot(window, slotIndex);
            clickSlot(window, -999);
        }
    }
}
 
Example #8
Source File: ContainerTFAggregator.java    From TofuCraftReload with MIT License 6 votes vote down vote up
public ContainerTFAggregator(InventoryPlayer playerInventory, IInventory machineInventory) {
    this.tileMachine = machineInventory;

    this.addSlotToContainer(new Slot(machineInventory, 0, 45, 32));
    this.addSlotToContainer(new Slot(machineInventory, 1, 115, 32){
        @Override
        public boolean isItemValid(ItemStack stack) {
            return false;
        }
    });


    for (int var3 = 0; var3 < 3; var3++) {
        for (int var4 = 0; var4 < 9; var4++) {
            this.addSlotToContainer(new Slot(playerInventory, var4 + var3 * 9 + 9, 8 + var4 * 18, 84 + var3 * 18));
        }
    }

    for (int var3 = 0; var3 < 9; var3++) {
        this.addSlotToContainer(new Slot(playerInventory, var3, 8 + var3 * 18, 142));
    }
}
 
Example #9
Source File: BW_Container_HeatedWaterPump.java    From bartworks with MIT License 6 votes vote down vote up
public BW_Container_HeatedWaterPump(BW_TileEntity_HeatedWaterPump TILE, EntityPlayer INVENTORY) {
    this.TILE = TILE;
    this.INVENTORY = INVENTORY.inventory;

    this.addSlotToContainer(new BW_FuelSlot(TILE, 0, 56, 53));
    this.addSlotToContainer(new GT_Slot_Render(TILE, 1, 86, 33));
    int i;

    for (i = 0; i < 3; ++i) {
        for (int j = 0; j < 9; ++j) {
            this.addSlotToContainer(new Slot(this.INVENTORY, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
        }
    }

    for (i = 0; i < 9; ++i) {
        this.addSlotToContainer(new Slot(this.INVENTORY, i, 8 + i * 18, 142));
    }
}
 
Example #10
Source File: NEIController.java    From NotEnoughItems with MIT License 6 votes vote down vote up
@Override
public boolean mouseScrolled(GuiScreen gui, int mouseX, int mouseY, int scrolled) {
    if (gui instanceof GuiContainer) {
        GuiContainer container = (GuiContainer) gui;
        if (!NEIClientConfig.isEnabled() || GuiInfo.hasCustomSlots(container) || !NEIClientConfig.isMouseScrollTransferEnabled()) {
            return false;
        }

        Point mousePos = getMousePosition();
        Slot mouseover = container.getSlotAtPosition(mousePos.x, mousePos.y);
        if (mouseover != null && mouseover.getHasStack() && !ItemInfo.fastTransferContainerExemptions.contains(container.getClass())) {
            if(NEIClientConfig.shouldInvertMouseScrollTransfer()) {
                scrolled = -scrolled;
            }
            if (scrolled > 0) {
                fastTransferManager.transferItem(container, mouseover.slotNumber);
            } else {
                fastTransferManager.retrieveItem(container, mouseover.slotNumber);
            }
            return true;
        }
    }
    return false;
}
 
Example #11
Source File: ContainerCreationStation.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
protected int getMaxStackSizeFromSlotAndStack(Slot slot, ItemStack stack)
{
    // Our main item inventory or the furnace inventory
    if (slot instanceof SlotItemHandler)
    {
        SlotItemHandler slotItemHandler = (SlotItemHandler) slot;

        if (slotItemHandler.getItemHandler() == this.inventory ||
            slotItemHandler.getItemHandler() == this.tecs.getFurnaceInventory())
        {
            return slotItemHandler.getItemStackLimit(stack);
        }
    }

    // Player inventory, module slots or crafting slots
    return super.getMaxStackSizeFromSlotAndStack(slot, stack);
}
 
Example #12
Source File: RecipeHandlerCreationStation.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public List<Slot> getInventorySlots(ContainerCreationStation container)
{
    List<Slot> slots = new ArrayList<Slot>();
    SlotRange playerInventorySlots = container.getPlayerMainInventorySlotRange();
    SlotRange customInventorySlots = container.getCustomInventorySlotRange();

    for (int slotNum = customInventorySlots.first; slotNum < customInventorySlots.lastExc; slotNum++)
    {
        slots.add(container.getSlot(slotNum));
    }

    for (int slotNum = playerInventorySlots.first; slotNum < playerInventorySlots.lastExc; slotNum++)
    {
        slots.add(container.getSlot(slotNum));
    }

    return slots;
}
 
Example #13
Source File: ContainerPresent.java    From Chisel-2 with GNU General Public License v2.0 6 votes vote down vote up
public ContainerPresent(IInventory player, IInventory chest) {
	lower = chest;
	rows = chest.getSizeInventory() / 9;
	chest.openInventory();
	int a = (rows - 4) * 18;

	for (int d = 0; d < rows; d++) {
		for (int e = 0; e < 9; e++) {
			addSlotToContainer(new Slot(chest, e + d * 9, 8 + e * 18, 18 + d * 18));
		}
	}

	for (int d = 0; d < 3; d++) {
		for (int e = 0; e < 9; e++) {
			addSlotToContainer(new Slot(player, e + d * 9 + 9, 8 + e * 18, 103 + d * 18 + a));
		}
	}

	for (int d = 0; d < 9; d++) {
		addSlotToContainer(new Slot(player, d, 8 + d * 18, 161 + a));
	}
}
 
Example #14
Source File: ContainerCreativeInv.java    From NotEnoughItems with MIT License 6 votes vote down vote up
public ContainerCreativeInv(EntityPlayer player, ExtendedCreativeInv extraInv) {
    this.player = player;
    InventoryPlayer invPlayer = player.inventory;
    for (int row = 0; row < 6; row++) {
        for (int col = 0; col < 9; col++) {
            addSlotToContainer(new Slot(extraInv, col + row * 9, 8 + col * 18, 5 + row * 18));
        }
    }

    for (int row = 0; row < 3; ++row) {
        for (int col = 0; col < 9; ++col) {
            addSlotToContainer(new Slot(invPlayer, col + row * 9 + 9, 8 + col * 18, 118 + row * 18));
        }
    }

    for (int col = 0; col < 9; ++col) {
        addSlotToContainer(new Slot(invPlayer, col, 8 + col * 18, 176));
    }
    for (int i = 0; i < 4; i++) {
        EntityEquipmentSlot entityEquipmentSlot = VALID_EQUIPMENT_SLOTS[i];
        addSlotToContainer(new SlotArmor(invPlayer, 36 + (3 - i), -15, 23 + i * 18, entityEquipmentSlot));
    }
    addSlotToContainer(new SlotArmor(invPlayer, 40, -15, 23 + 4 * 18, VALID_EQUIPMENT_SLOTS[4], 64));
}
 
Example #15
Source File: ContainerExtended.java    From CodeChickenCore with MIT License 6 votes vote down vote up
@Override
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int slotIndex) {
    ItemStack transferredStack = null;
    Slot slot = (Slot) inventorySlots.get(slotIndex);

    if (slot != null && slot.getHasStack()) {
        ItemStack stack = slot.getStack();
        transferredStack = stack.copy();

        if (!doMergeStackAreas(slotIndex, stack))
            return null;

        if (stack.stackSize == 0)
            slot.putStack(null);
        else
            slot.onSlotChanged();
    }

    return transferredStack;
}
 
Example #16
Source File: GuiPressureChamberInterface.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Fired when a control is clicked. This is the equivalent of
 * ActionListener.actionPerformed(ActionEvent e).
 */

@Override
public void actionPerformed(IGuiWidget widget){
    if(widget.getID() == 1) {
        if(filterStat != null) {
            filterStat.closeWindow();
            if(te.filterMode == TileEntityPressureChamberInterface.EnumFilterMode.ITEM) {
                for(int i = 5; i < 14; i++) {
                    ((Slot)inventorySlots.inventorySlots.get(i)).xDisplayPosition += 1000;
                }
            } else if(te.filterMode.ordinal() == TileEntityPressureChamberInterface.EnumFilterMode.values().length - 1) {
                for(int i = 5; i < 14; i++) {
                    ((Slot)inventorySlots.inventorySlots.get(i)).xDisplayPosition -= 1000;
                }
            }
        }
    }
    super.actionPerformed(widget);
}
 
Example #17
Source File: GuiEnderUtilities.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected void drawTooltips(int mouseX, int mouseY)
{
    for (int i = 0; i < this.buttonList.size(); i++)
    {
        GuiButton button = this.buttonList.get(i);

        // Mouse is over the button
        if ((button instanceof GuiButtonHoverText) && button.mousePressed(this.mc, mouseX, mouseY))
        {
            this.drawHoveringText(((GuiButtonHoverText) button).getHoverStrings(), mouseX, mouseY, this.fontRenderer);
        }
    }

    // Draw the colored background for the selected slot (for swapping), if any
    if (this.container instanceof ContainerCustomSlotClick)
    {
        int selectedSlot = ((ContainerCustomSlotClick) this.container).getSelectedSlot();

        if (selectedSlot != -1)
        {
            GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
            this.bindTexture(this.guiTextureWidgets);
            Slot slot = this.container.getSlot(selectedSlot);
            this.drawTexturedModalRect(this.guiLeft + slot.xPos - 1, this.guiTop + slot.yPos - 1, 102, 90, 18, 18);
        }
    }

    // Info text has been set, show it if the mouse is over the designated info area
    if (this.infoArea != null && this.infoArea.isMouseOver(mouseX, mouseY, this.guiLeft, this.guiTop))
    {
        this.drawHoveringText(this.infoArea.getInfoLines(), mouseX, mouseY, this.fontRenderer);
    }

    // Added in vanilla 1.12
    this.renderHoveredToolTip(mouseX, mouseY);
}
 
Example #18
Source File: CellViewer.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
    GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
    int startX = (this.width - this.xSize) / 2;
    int startY = (this.height - this.ySize) / 2;
    MinecraftGuiUtils.drawBack(startX, startY, xSize, ySize);
    int x = 0;
    int y = 0;
    for (Slot get : container.slots.get(container.currentPage)) {
        MinecraftGuiUtils.drawSlotBack(startX + 11 + x * 18, startY + 17 + y * 18);
        x++;
        y += x / 13;
        x %= 13;
    }
}
 
Example #19
Source File: ContainerBusFluidExport.java    From ExtraCells1 with MIT License 5 votes vote down vote up
protected void bindPlayerInventory(IInventory inventoryPlayer)
{
	for (int i = 0; i < 3; i++)
	{
		for (int j = 0; j < 9; j++)
		{
			addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, 8 + j * 18, i * 18 + 79));
		}
	}

	for (int i = 0; i < 9; i++)
	{
		addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 137));
	}
}
 
Example #20
Source File: MaterialListHudRenderer.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void renderSlotHilights(GuiContainer gui)
{
    MaterialListBase materialList = DataManager.getMaterialList();

    if (materialList != null)
    {
        materialList.getHudRenderer().refreshList(2000L);
        List<MaterialListEntry> list = materialList.getMaterialsMissingOnly(false);

        if (list.isEmpty() == false)
        {
            HashMap<ItemType, MaterialListEntry> map = new HashMap<>();
            list.forEach((entry) -> map.put(entry.getItemType(), entry));
            List<Pair<Slot, Color4f>> hilightedSlots = getHilightedSlots(gui, map);

            if (hilightedSlots.isEmpty() == false)
            {
                GlStateManager.disableTexture2D();
                RenderUtils.setupBlend();
                int guiX = InventoryScreenUtils.getGuiPosX(gui);
                int guiY = InventoryScreenUtils.getGuiPosY(gui);

                for (Pair<Slot, Color4f> pair : hilightedSlots)
                {
                    Slot slot = pair.getLeft();
                    Color4f color = pair.getRight();
                    RenderUtils.drawOutlinedBox(guiX + slot.xPos, guiY + slot.yPos, 16, 16, color.intValue, color.intValue | 0xFF000000, 1f);
                }

                GlStateManager.enableTexture2D();
            }
        }
    }
}
 
Example #21
Source File: BrewingOverlayHandler.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@Override
public Slot[][] mapIngredSlots(GuiContainer gui, List<PositionedStack> ingredients) {
    Slot[][] map = super.mapIngredSlots(gui, ingredients);
    Slot[] potSlots = new Slot[3];
    for (int i = 0; i < 3; i++) {
        potSlots[i] = gui.inventorySlots.inventorySlots.get(i);
    }
    map[1] = potSlots;
    return map;
}
 
Example #22
Source File: FastTransferManager.java    From NotEnoughItems with MIT License 5 votes vote down vote up
public void retrieveItem(GuiContainer window, int toSlot) {
    Slot slot = window.inventorySlots.getSlot(toSlot);
    ItemStack slotStack = slot.getStack();
    if (slotStack == null ||
            slotStack.stackSize == slot.getSlotStackLimit() ||
            slotStack.stackSize == slotStack.getMaxStackSize())
        return;

    generateSlotMap(window.inventorySlots, slotStack);

    Integer destZone = slotZoneMap.get(toSlot);
    if (destZone == null)//slots that don't accept
        return;

    int firstZoneSlot = findShiftClickDestinationSlot(window.inventorySlots, toSlot);
    int firstZone = -1;
    if (firstZoneSlot != -1) {
        Integer integer = slotZoneMap.get(firstZoneSlot);
        if (integer != null) {
            firstZone = integer;
            if (retrieveItemFromZone(window, firstZone, toSlot))
                return;
        }
    }

    for (int zone = 0; zone < slotZones.size(); zone++) {
        if (zone == destZone || zone == firstZone)
            continue;

        if (retrieveItemFromZone(window, zone, toSlot))
            return;
    }

    retrieveItemFromZone(window, destZone, toSlot);
}
 
Example #23
Source File: ContainerBusFluidStorage.java    From ExtraCells1 with MIT License 5 votes vote down vote up
protected void bindPlayerInventory(IInventory inventoryPlayer)
{
	for (int i = 0; i < 3; i++)
	{
		for (int j = 0; j < 9; j++)
		{
			addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, 8 + j * 18, i * 18 + 112));
		}
	}

	for (int i = 0; i < 9; i++)
	{
		addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 170));
	}
}
 
Example #24
Source File: ModuleSatellite.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@Override
public void renderBackground(GuiContainer gui, int x, int y, int mouseX, int mouseY,
		FontRenderer font) {
	
	for(Slot slot : slotList) {
		gui.drawTexturedModalRect(x + slot.xPos - 1, y + slot.yPos - 1, satelliteSlot.getxLoc(), satelliteSlot.getyLoc(), satelliteSlot.getxSize(), satelliteSlot.getySize());
	}
}
 
Example #25
Source File: GuiContainerTFC.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void drawScreen(int par1, int par2, float par3)
{
	super.drawScreen(par1, par2, par3);
	for (int j1 = 0; j1 < this.inventorySlots.inventorySlots.size(); ++j1)
	{
		Slot slot = (Slot) this.inventorySlots.inventorySlots.get(j1);
		if (this.isMouseOverSlot(slot, par1, par2) && slot.getHasStack())
			this.activeSlot = slot;
	}
}
 
Example #26
Source File: LayoutManager.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@Override
public void renderSlotOverlay(GuiContainer window, Slot slot) {
    ItemStack item = slot.getStack();
    if (world.nbt.getBoolean("searchinventories") && (item == null ? !getSearchExpression().equals("") : !ItemList.getItemListFilter().matches(item))) {
        GlStateManager.disableLighting();
        //GlStateManager.depthFunc(GL11.GL_EQUAL);
        GlStateManager.translate(0, 0, 350);
        drawRect(slot.xPos, slot.yPos, 16, 16, 0x80000000);
        GlStateManager.translate(0, 0, -350);
        //GlStateManager.depthFunc(GL11.GL_LESS);
        GlStateManager.enableLighting();
    }
}
 
Example #27
Source File: ContainerBlueprintArchive.java    From Cyberware with MIT License 5 votes vote down vote up
public ContainerBlueprintArchive(IInventory playerInventory, TileEntityBlueprintArchive archive)
{
	this.archive = archive;
	this.numRows = archive.slots.getSlots() / 9;
	int i = (this.numRows - 4) * 18;

	for (int j = 0; j < this.numRows; ++j)
	{
		for (int k = 0; k < 9; ++k)
		{
			this.addSlotToContainer(new SlotItemHandler(archive.slots, k + j * 9, 8 + k * 18, 18 + j * 18));
		}
	}

	for (int l = 0; l < 3; ++l)
	{
		for (int j1 = 0; j1 < 9; ++j1)
		{
			this.addSlotToContainer(new Slot(playerInventory, j1 + l * 9 + 9, 8 + j1 * 18, 103 + l * 18 + i));
		}
	}

	for (int i1 = 0; i1 < 9; ++i1)
	{
		this.addSlotToContainer(new Slot(playerInventory, i1, 8 + i1 * 18, 161 + i));
	}
}
 
Example #28
Source File: GuiContainerManager.java    From NotEnoughItems with MIT License 5 votes vote down vote up
public static ItemStack getStackMouseOver(GuiContainer window) {
    Point mousePos = getMousePosition();

    for (IContainerObjectHandler objectHandler : objectHandlers) {
        ItemStack item = objectHandler.getStackUnderMouse(window, mousePos.x, mousePos.y);
        if (item != null)
            return item;
    }

    Slot slot = getSlotMouseOver(window);
    if (slot != null)
        return slot.getStack();

    return null;
}
 
Example #29
Source File: ItemDropChecker.java    From SkyblockAddons with MIT License 5 votes vote down vote up
/**
 * Checks if this item can be dropped or sold.
 *
 * @param slot the inventory slot to check
 * @return {@code true} if this item can be dropped or sold, {@code false} otherwise
 */
public boolean canDropItem(Slot slot) {
    if (slot != null && slot.getHasStack()) {
        return canDropItem(slot.getStack());
    }
    else {
        return true;
    }
}
 
Example #30
Source File: ModularUIGui.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void drawSlotContents(Slot slot) {
    GlStateManager.enableDepth();
    RenderHelper.enableGUIStandardItemLighting();
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    drawSlot(slot);
    GlStateManager.enableDepth();
    GlStateManager.enableBlend();
    GlStateManager.disableLighting();
}