protected int drawSlots(int xPos, int yPos) {
    int width = columns * slot.w;
    int height = ySize - border.h * 2;

    int fullRows = (lastSlotId - firstSlotId) / columns;
    int y;
    for (y = 0; y < fullRows * slot.h && y < height; y += slot.h) {
      slot.drawScaledX(xPos, yPos + y, width);
    }

    // draw partial row and unused slots
    int slotsLeft = (lastSlotId - firstSlotId) % columns;
    if (slotsLeft > 0) {
      slot.drawScaledX(xPos, yPos + y, slotsLeft * slot.w);
      // empty slots that don't exist
      slotEmpty.drawScaledX(xPos + slotsLeft * slot.w, yPos + y, width - slotsLeft * slot.w);
    }

    return width;
  }
  @Override
  protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
    this.mc.getTextureManager().bindTexture(GuiGeneric.LOCATION);
    if (!slider.isHidden()) {
      slider.draw();

      updateSlots();
    }
    // fully filled rows
    int fullRows = (lastSlotId - firstSlotId) / columns;
    int w = columns * slot.w;
    int y;
    for (y = 0; y < fullRows * slot.h && y < ySize; y += slot.h) {
      slot.drawScaledX(guiLeft, guiTop + y, w);
    }

    // draw partial row and unused slots
    int slotsLeft = (lastSlotId - firstSlotId) % columns;
    if (slotsLeft > 0) {
      slot.drawScaledX(guiLeft, guiTop + y, slotsLeft * slot.w);
      // empty slots that don't exist
      slotEmpty.drawScaledX(guiLeft + slotsLeft * slot.w, guiTop + y, w - slotsLeft * slot.w);
    }
  }
  @Override
  protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
    guiLeft += border.w;
    guiTop += border.h;

    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.getTextureManager().bindTexture(GUI_INVENTORY);

    int x = guiLeft; // + border.w;
    int y = guiTop; // + border.h;
    int midW = xSize - border.w * 2;
    int midH = ySize - border.h * 2;

    border.draw();

    if (shouldDrawName()) {
      textBackground.drawScaledX(x, y, midW);
      y += textBackground.h;
    }

    this.mc.getTextureManager().bindTexture(GUI_INVENTORY);
    drawSlots(x, y);
    /*
        // draw the connection to the main thing
        if(right) {
          x = guiLeft;
          y = guiTop;

          if(guiTop == parent.cornerY) {
            borderTop.drawScaledX(x, y, overlapTopLeft.w);
          }
          else {
            overlapTopLeft.draw(x, y);
          }
          y += cornerTopLeft.h;
          overlap.drawScaledY(x, y, midH);
          y += midH;
          if(guiBottom() == parent.cornerX + parent.realHeight) {
            borderBottom.drawScaledX(x, y, overlapBottomLeft.w);
          }
          else {
            overlapBottomLeft.draw(x, y);
          }
        }
        else if(slider.isEnabled()) {
          y = guiTop;

          borderTop.drawScaledX(x, y, cornerTopRight.w);
          y += cornerTopRight.h;
          overlap.drawScaledY(x, y, midH);
          y += midH;
          borderBottom.drawScaledX(x, y, cornerBottomRight.w);

          x = guiRight() - 1;
          y = guiTop;
          if(guiTop == parent.cornerY) {
            borderTop.drawScaledX(x, y, overlapTopRight.w);
          }
          else {
            overlapTopRight.draw(x, y);
          }
          y += cornerTopRight.h;
          overlap.drawScaledY(x, y, midH);
          y += midH;
          if(guiBottom() == parent.cornerX + parent.realHeight) {
            borderBottom.drawScaledX(x, y, overlapBottomRight.w);
          }
          else {
            overlapBottomRight.draw(x, y);
          }
        }
    */
    // slider
    if (slider.isEnabled()) {
      slider.update(
          mouseX, mouseY, !isMouseOverFullSlot(mouseX, mouseY) && isMouseInModule(mouseX, mouseY));
      slider.draw();

      updateSlots();
    }

    guiLeft -= border.w;
    guiTop -= border.h;
  }