@Override
  public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
    if (this.visible) {
      int iconIndex = this.getIconIndex();

      if (this.halfSize) {
        this.width = 8;
        this.height = 8;

        GL11.glPushMatrix();
        GL11.glTranslatef(this.xPosition, this.yPosition, 0.0F);
        GL11.glScalef(0.5f, 0.5f, 0.5f);

        if (this.enabled) {
          GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
        } else {
          GL11.glColor4f(0.5f, 0.5f, 0.5f, 1.0f);
        }

        par1Minecraft.renderEngine.bindTexture(ExtraBlockTextures.GuiTexture("guis/states.png"));
        this.field_146123_n =
            par2 >= this.xPosition
                && par3 >= this.yPosition
                && par2 < this.xPosition + this.width
                && par3 < this.yPosition + this.height;

        int uv_y = (int) Math.floor(iconIndex / 16);
        int uv_x = iconIndex - uv_y * 16;

        this.drawTexturedModalRect(0, 0, 256 - 16, 256 - 16, 16, 16);
        this.drawTexturedModalRect(0, 0, uv_x * 16, uv_y * 16, 16, 16);
        this.mouseDragged(par1Minecraft, par2, par3);

        GL11.glPopMatrix();
      } else {
        if (this.enabled) {
          GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
        } else {
          GL11.glColor4f(0.5f, 0.5f, 0.5f, 1.0f);
        }

        par1Minecraft.renderEngine.bindTexture(ExtraBlockTextures.GuiTexture("guis/states.png"));
        this.field_146123_n =
            par2 >= this.xPosition
                && par3 >= this.yPosition
                && par2 < this.xPosition + this.width
                && par3 < this.yPosition + this.height;

        int uv_y = (int) Math.floor(iconIndex / 16);
        int uv_x = iconIndex - uv_y * 16;

        this.drawTexturedModalRect(this.xPosition, this.yPosition, 256 - 16, 256 - 16, 16, 16);
        this.drawTexturedModalRect(this.xPosition, this.yPosition, uv_x * 16, uv_y * 16, 16, 16);
        this.mouseDragged(par1Minecraft, par2, par3);
      }
    }
    GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
  }
  @Override
  public void renderInventory(
      final BlockSecurity block,
      final ItemStack is,
      final RenderBlocks renderer,
      final ItemRenderType type,
      final Object[] obj) {
    renderer.overrideBlockTexture = ExtraBlockTextures.getMissing();
    this.renderInvBlock(
        EnumSet.of(ForgeDirection.SOUTH), block, is, Tessellator.instance, 0x000000, renderer);

    renderer.overrideBlockTexture = ExtraBlockTextures.MEChest.getIcon();
    this.renderInvBlock(
        EnumSet.of(ForgeDirection.UP),
        block,
        is,
        Tessellator.instance,
        this.adjustBrightness(AEColor.Transparent.whiteVariant, 0.7),
        renderer);

    renderer.overrideBlockTexture = null;
    super.renderInventory(block, is, renderer, type, obj);
  }