@Override
  @SideOnly(Side.CLIENT)
  protected void drawGuiContainerBackgroundLayer(float f_, int i_, int j_) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.renderEngine.bindTexture(texture);

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

    // int x = 115;
    // int y = 20;
    this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);

    this.mc.renderEngine.bindTexture(flagSquare);

    if (tile != null) {
      int col = tile.getPrimaryPaintColour();
      double[] colourFloats = this.decompressColourFloats(col);
      this.setColour((float) colourFloats[0], (float) colourFloats[1], (float) colourFloats[2]);

      this.drawTexturedModalRect(x + 4, y + 50, 0, 0, 20, 20);
    }

    float r = 0.0F;
    float b = 0.0F;
    float g = 0.0F;

    int xinc = 2;
    int yinc = 2;

    int xpos = x + 4;
    int ypos = y + 104;

    int shades = 16;
    int brights = 12;
    int darks = 12;

    // Draws a textured rectangle at the stored z-value. Args: x, y, u, v, width, height

    // RED ADDING GREEN
    r = 1.0F;
    g = 0.0F;
    b = 0.0F;

    for (int i = 0; i < shades; i++) {
      this.setColour(r, g, b);
      this.drawTexturedModalRect(xpos, ypos, 0, 0, colourXSize, colourYSize);

      this.drawColourBrights(xpos, ypos, brights, r, g, b);
      this.drawColourDarks(xpos, ypos, darks, r, g, b);

      g += colInc;
      xpos += xinc;
    }

    g = 1.0F;
    r = 1.0F;
    b = 0.0F;
    // GREEN SUBTRACTING RED
    for (int i = 0; i < shades; i++) {
      this.setColour(r, g, b);
      this.drawTexturedModalRect(xpos, ypos, 0, 0, colourXSize, colourYSize);

      this.drawColourBrights(xpos, ypos, brights, r, g, b);
      this.drawColourDarks(xpos, ypos, darks, r, g, b);

      r -= colInc;
      xpos += xinc;
    }

    g = 1.0F;
    r = 0.0F;
    b = 0.0F;
    // GREEN ADDING BLUE
    for (int i = 0; i < shades; i++) {
      this.setColour(r, g, b);
      this.drawTexturedModalRect(xpos, ypos, 0, 0, colourXSize, colourYSize);

      this.drawColourBrights(xpos, ypos, brights, r, g, b);
      this.drawColourDarks(xpos, ypos, darks, r, g, b);

      b += colInc;
      xpos += xinc;
    }

    g = 1.0F;
    b = 1.0F;
    r = 0.0F;
    // BLUE SUBTRACTING GREEN
    for (int i = 0; i < shades; i++) {
      this.setColour(r, g, b);
      this.drawTexturedModalRect(xpos, ypos, 0, 0, colourXSize, colourYSize);

      this.drawColourBrights(xpos, ypos, brights, r, g, b);
      this.drawColourDarks(xpos, ypos, darks, r, g, b);

      g -= colInc;
      xpos += xinc;
    }

    b = 1.0F;
    r = 0.0F;
    g = 0.0F;
    // BLUE ADDING RED
    for (int i = 0; i < shades; i++) {
      this.setColour(r, g, b);
      this.drawTexturedModalRect(xpos, ypos, 0, 0, colourXSize, colourYSize);

      this.drawColourBrights(xpos, ypos, brights, r, g, b);
      this.drawColourDarks(xpos, ypos, darks, r, g, b);

      r += colInc;
      xpos += xinc;
    }

    r = 1.0f;
    b = 1.0f;
    g = 0.0F;
    // RED SUBTRACTING BLUE
    for (int i = 0; i < shades; i++) {
      this.setColour(r, g, b);
      this.drawTexturedModalRect(xpos, ypos, 0, 0, colourXSize, colourYSize);

      this.drawColourBrights(xpos, ypos, brights, r, g, b);
      this.drawColourDarks(xpos, ypos, darks, r, g, b);

      b -= colInc;
      xpos += xinc;
    }
  }