Exemple #1
0
  public List func_180506_a(ICommandSender p_180506_1_, String p_180506_2_, BlockPos p_180506_3_) {
    ArrayList var4 = Lists.newArrayList();

    if (p_180506_2_.startsWith("/")) {
      p_180506_2_ = p_180506_2_.substring(1);
      boolean var11 = !p_180506_2_.contains(" ");
      List var12 =
          this.commandManager.getTabCompletionOptions(p_180506_1_, p_180506_2_, p_180506_3_);

      if (var12 != null) {
        Iterator var13 = var12.iterator();

        while (var13.hasNext()) {
          String var14 = (String) var13.next();

          if (var11) {
            var4.add("/" + var14);
          } else {
            var4.add(var14);
          }
        }
      }

      return var4;
    } else {
      String[] var5 = p_180506_2_.split(" ", -1);
      String var6 = var5[var5.length - 1];
      String[] var7 = this.serverConfigManager.getAllUsernames();
      int var8 = var7.length;

      for (int var9 = 0; var9 < var8; ++var9) {
        String var10 = var7[var9];

        if (CommandBase.doesStringStartWith(var6, var10)) {
          var4.add(var10);
        }
      }

      return var4;
    }
  }
  protected void drawToolTip(List par1List, int par2, int par3) {
    if (!par1List.isEmpty()) {
      GL11.glDisable(GL12.GL_RESCALE_NORMAL);
      RenderHelper.disableStandardItemLighting();
      GL11.glDisable(GL11.GL_LIGHTING);
      GL11.glDisable(GL11.GL_DEPTH_TEST);
      int k = 0;
      Iterator iterator = par1List.iterator();

      while (iterator.hasNext()) {
        String s = (String) iterator.next();
        int l = this.fontRenderer.getStringWidth(s);

        if (l > k) {
          k = l;
        }
      }

      int i1 = par2 + 12;
      int j1 = par3 - 12;
      int k1 = 8;

      if (par1List.size() > 1) {
        k1 += 2 + (par1List.size() - 1) * 10;
      }

      if (i1 + k > this.width) {
        i1 -= 28 + k;
      }

      if (j1 + k1 + 6 > this.height) {
        j1 = this.height - k1 - 6;
      }

      this.zLevel = 300.0F;
      itemRenderer.zLevel = 300.0F;
      int l1 = -267386864;
      this.drawGradientRect(i1 - 3, j1 - 4, i1 + k + 3, j1 - 3, l1, l1);
      this.drawGradientRect(i1 - 3, j1 + k1 + 3, i1 + k + 3, j1 + k1 + 4, l1, l1);
      this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 + k1 + 3, l1, l1);
      this.drawGradientRect(i1 - 4, j1 - 3, i1 - 3, j1 + k1 + 3, l1, l1);
      this.drawGradientRect(i1 + k + 3, j1 - 3, i1 + k + 4, j1 + k1 + 3, l1, l1);
      int i2 = 1347420415;
      int j2 = (i2 & 16711422) >> 1 | i2 & -16777216;
      this.drawGradientRect(i1 - 3, j1 - 3 + 1, i1 - 3 + 1, j1 + k1 + 3 - 1, i2, j2);
      this.drawGradientRect(i1 + k + 2, j1 - 3 + 1, i1 + k + 3, j1 + k1 + 3 - 1, i2, j2);
      this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 - 3 + 1, i2, i2);
      this.drawGradientRect(i1 - 3, j1 + k1 + 2, i1 + k + 3, j1 + k1 + 3, j2, j2);

      for (int k2 = 0; k2 < par1List.size(); ++k2) {
        String s1 = (String) par1List.get(k2);
        this.fontRenderer.drawStringWithShadow(s1, i1, j1, -1);

        if (k2 == 0) {
          j1 += 2;
        }

        j1 += 10;
      }

      this.zLevel = 0.0F;
      itemRenderer.zLevel = 0.0F;
    }
  }