@Override
 public boolean recieveCommand(String cmd) throws Exception {
   String args[] = cmd.split("t ");
   for (DefaultModule mod : Resilience.getInstance().getModuleManager().moduleList) {
     if (mod.getName().equalsIgnoreCase(args[1].trim())) {
       mod.toggle();
       Resilience.getInstance().getLogger().infoChat("Toggled mod: \247b" + mod.getName());
       return true;
     }
   }
   Resilience.getInstance().getLogger().warningChat("Mod not found: \247c" + args[1]);
   return true;
 }
 @Override
 public boolean handleWaterMovement() {
   if (Resilience.getInstance().getValues().flightEnabled) {
     return false;
   }
   return super.handleWaterMovement();
 }
 @Override
 public void onDisable() {
   if (invoker.getWrapper().getPlayer() != null) {
     invoker.setStepHeight(0.5F);
   }
   Resilience.getInstance().getEventManager().unregister(this);
 }
 @Override
 public void moveEntity(double par1, double par3, double par5) {
   super.moveEntity(par1, par3, par5);
   if (Resilience.getInstance().getValues().flightEnabled) {
     this.inWater = false;
   }
 }
  @Override
  public boolean isEntityInsideOpaqueBlock() {
    if (Resilience.getInstance().getValues().freecamEnabled) {
      return false;
    }

    return super.isEntityInsideOpaqueBlock();
  }
  @Override
  protected boolean func_145771_j(double par1, double par3, double par5) {
    if (Resilience.getInstance().getValues().freecamEnabled) {
      return false;
    }

    return super.func_145771_j(par1, par3, par5);
  }
  @Override
  public boolean recieveCommand(String cmd) throws Exception {
    String nick = "XxXN" + cmd.split("irc nick ")[1].trim();

    if (nick.equalsIgnoreCase("Krisp")
        || nick.toLowerCase().contains("krisp")
        || nick.toLowerCase().contains("kirsp")
        || nick.toLowerCase().contains("owner")) {
      Resilience.getInstance().getLogger().warningChat("But, but, but... You're not Krisp! :O");
      return true;
    }

    Resilience.getInstance().getIRCChatManager().bot.changeNick(nick);
    Resilience.getInstance()
        .getLogger()
        .infoChat("Set your IRC nickname to" + cmd.split("irc nick")[1]);
    return true;
  }
  @Override
  public void sendMotionUpdates() {
    if (Resilience.getInstance().getValues().freecamEnabled) return;

    float prevPitch = Resilience.getInstance().getInvoker().getRotationPitch();
    float prevYaw = Resilience.getInstance().getInvoker().getRotationYaw();
    final EventPreMotion eventPre = new EventPreMotion(this);
    eventPre.onEvent();
    if (!eventPre.isCancelled()) {
      super.sendMotionUpdates();
    } else {
      eventPre.setCancelled(false);
      return;
    }
    Resilience.getInstance().getInvoker().setRotationPitch(prevPitch);
    Resilience.getInstance().getInvoker().setRotationYaw(prevYaw);
    final EventPostMotion eventPost = new EventPostMotion(this);
    eventPost.onEvent();
  }
  @Override
  public void draw(int i, int j) {
    TextRadarComponent.players.clear();
    inOrder.clear();
    super.draw(i, j);
    for (Object o : Resilience.getInstance().getInvoker().getEntityList()) {
      if ((Entity) o instanceof EntityOtherPlayerMP) {
        EntityOtherPlayerMP otherPlayer;
        otherPlayer = (EntityOtherPlayerMP) o;
        if (!Resilience.getInstance()
            .getInvoker()
            .getPlayerName(otherPlayer)
            .equalsIgnoreCase(Resilience.getInstance().getInvoker().getSessionUsername())) {
          inOrder.add(
              new TextRadarComponent(
                  Resilience.getInstance()
                      .getInvoker()
                      .stripControlCodes(
                          Resilience.getInstance().getInvoker().getPlayerName(otherPlayer)),
                  (int)
                      Resilience.getInstance()
                          .getInvoker()
                          .getDistanceToEntity(
                              otherPlayer, Resilience.getInstance().getWrapper().getPlayer()),
                  getX() + 3,
                  getY() + count,
                  FriendManager.isFriend(otherPlayer.func_145748_c_().getUnformattedText()),
                  this));
        }
      }
    }

    Collections.sort(inOrder);
    for (TextRadarComponent rad : inOrder) {
      TextRadarComponent.players.add(
          new TextRadarComponent(
              rad.getName(),
              (int) rad.getBlocksAway(),
              getX() + 3,
              count + getY() + 4,
              FriendManager.isFriend(rad.getName()),
              this));
      count += 15;
    }

    if (inOrder.size() != 0 && isExtended()) {
      Utils.drawRect(
          getX(), getY() + 17, getX1(), getY() + (15 * inOrder.size() + 20.5F), 0x99040404);
    }
    for (TextRadarComponent radar1 : TextRadarComponent.players) {
      if (isExtended()) {
        radar1.draw(i, j);
      }
    }
    count = 16;
  }
 @Override
 public void onUpdate(EventOnUpdate event) {
   interval = 300 * 1000;
   if (timer.hasTimePassed(interval)) {
     timer.reset();
     if (index >= idleTips.length) {
       index = 0;
     }
     Resilience.getInstance().getLogger().infoChat("\247f[\247bTIP\247f] \2476" + idleTips[index]);
     index++;
   }
 }
  private void renderPotions() {
    GL11.glPushMatrix();
    int var1 = Resilience.getInstance().getValues().enabledModsEnabled ? 76 : 1;
    int var2 = 0;
    boolean var3 = true;
    Collection var4 = wrapper.getPlayer().getActivePotionEffects();

    if (!var4.isEmpty()) {
      ResourceLocation rL = new ResourceLocation("textures/gui/container/inventory.png");
      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
      GL11.glDisable(GL11.GL_LIGHTING);
      int var5 = 33;

      if (var4.size() > 5) {
        var5 = 132 / (var4.size() - 1);
      }

      for (Iterator var6 = wrapper.getPlayer().getActivePotionEffects().iterator();
          var6.hasNext();
          var2 += var5) {
        PotionEffect var7 = (PotionEffect) var6.next();
        Potion var8 = Potion.potionTypes[var7.getPotionID()];
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        wrapper.getMinecraft().getTextureManager().bindTexture(rL);
        // this.drawTexturedModalRect(var1, var2, 0, 166, 140, 32);

        if (var8.hasStatusIcon()) {
          int var9 = var8.getStatusIconIndex();
          this.drawTexturedModalRect(
              var1 + 6, var2 + 7, 0 + var9 % 8 * 18, 198 + var9 / 8 * 18, 18, 18);
        }

        String var11 = I18n.format(var8.getName(), new Object[0]);

        if (var7.getAmplifier() == 1) {
          var11 = var11 + " II";
        } else if (var7.getAmplifier() == 2) {
          var11 = var11 + " III";
        } else if (var7.getAmplifier() == 3) {
          var11 = var11 + " IV";
        }

        wrapper.getFontRenderer().drawStringWithShadow(var11, var1 + 10 + 18, var2 + 6, 16777215);
        String var10 = Potion.getDurationString(var7);
        wrapper
            .getFontRenderer()
            .drawStringWithShadow(var10, var1 + 10 + 18, var2 + 6 + 10, 8355711);
      }
    }
    GL11.glPopMatrix();
  }
  @Override
  public void onPacketReceive(EventPacketReceive event) {
    if (event.getPacket() instanceof S02PacketChat) {
      S02PacketChat p = (S02PacketChat) event.getPacket();

      String line = p.func_148915_c().getUnformattedText();
      if (line.toLowerCase().contains(".help")
          || line.toLowerCase().contains(".legit")
              && !line.contains(invoker.getSessionUsername())) {
        Resilience.getInstance()
            .getLogger()
            .infoChat(
                "\247f[\247bTIP\247f] \247c"
                    + "Did someone just tell you to type \".help\"? Don't worry! You can type \".say .help\" and it will say it in the chat!");
      }
    }
  }
 @Override
 public void onDisable() {
   Resilience.getInstance().getEventManager().unregister(this);
 }
 @Override
 public void onDisable() {
   Resilience.getInstance().getValues().antiBlindessEnabled = false;
 }
  @Override
  public void sendChatMessage(String s) {
    if (s.startsWith(Resilience.getInstance().getCmdPrefix())
        && Resilience.getInstance().isEnabled()) {
      for (Command cmd : Command.cmdList) {
        try {
          String replaced = s.replaceFirst(Resilience.getInstance().getCmdPrefix(), "");
          String[] inputWords = replaced.split(" ");
          if (replaced.startsWith(cmd.getWords())) {
            try {
              if (cmd.recieveCommand(s.replaceFirst(Resilience.getInstance().getCmdPrefix(), ""))) {
                break;
              }
            } catch (Exception e) {
              Resilience.getInstance()
                  .getLogger()
                  .warningChat(
                      "\247cInternal error! \247fSyntax: \247b"
                          + cmd.getWords().concat(cmd.getExtras()));
            }
          } else if (s.replace(Resilience.getInstance().getCmdPrefix(), "")
              .toLowerCase()
              .startsWith(cmd.getFirstWord())) {
          }
        } catch (Exception ex) {
          Resilience.getInstance()
              .getLogger()
              .warningChat("Reset the command prefix to \".\" due to strange internal exception!");
          Resilience.getInstance().setCmdPrefix(".");
        }
      }
    } else {
      if (s.startsWith(Resilience.getInstance().getIRCPrefix())
          && Resilience.getInstance().isEnabled()) {
        try {
          if (!Resilience.getInstance().getValues().ircEnabled) {
            Resilience.getInstance()
                .getLogger()
                .warningChat("Please enable \"IRC\" to chat in the IRC!");
            return;
          }

          String msg = s.replaceFirst(Resilience.getInstance().getIRCPrefix(), "");

          if (cooldownTimer < 2) {
            cooldownTimer = 30;
            if (!msg.trim().equalsIgnoreCase(prevMessage)) {
              prevMessage = msg;
              Resilience.getInstance()
                  .getIRCChatManager()
                  .bot
                  .sendMessage(
                      Resilience.getInstance().getValues().ircChannel,
                      s.replaceFirst(Resilience.getInstance().getIRCPrefix(), ""));
              System.out.println(
                  "sending message to " + Resilience.getInstance().getValues().ircChannel);
              String msgToPlace = Resilience.getInstance().getIRCChatManager().bot.getNick();

              boolean nick = msgToPlace.startsWith("XxXN");

              if (nick) {
                msgToPlace = msgToPlace.replaceFirst("XxXN", "");
              }
              msgToPlace.replaceFirst("Krisp_", "Krisp");

              boolean krisp = msgToPlace.equals("Krisp_");
              boolean vip = Donator.isDonator(msgToPlace, 5);

              Resilience.getInstance().getLogger().irc(msgToPlace + ": " + msg);
              Resilience.getInstance()
                  .getLogger()
                  .ircChat(
                      (nick ? "\247f[\2473NickName\247f]\247b " : "")
                          + (krisp
                              ? "\247f[\247cOwner\247f] \247b"
                              : vip ? "\247f[\2476VIP\247f]\247b " : "\247b")
                          + msgToPlace
                          + "\2478:"
                          + (krisp ? "\247c " : vip ? "\2476 " : "\247f ")
                          + msg);
            } else {
              Resilience.getInstance()
                  .getLogger()
                  .warningChat("Please don't send the same message twice in a row!");
            }
          } else {
            Resilience.getInstance()
                .getLogger()
                .warningChat("Please wait a bit between IRC chats!");
          }

        } catch (Exception e) {
          Resilience.getInstance()
              .getLogger()
              .warningChat(
                  "Error in IRC. Have you enabled \"IRC\"? To be safe, we have reset the IRC prefix to \"@\"");
          Resilience.getInstance().setIRCPrefix("@");
          e.printStackTrace();
        }
      } else {
        super.sendChatMessage(s);
      }
    }
  }
 public void onUpdate(EventOnUpdate event) {
   invoker.setStepHeight(Resilience.getInstance().getValues().stepHeight.getValue());
 }
public class HookGuiIngame extends GuiIngame {

  private int arrayListCount = 0;
  private boolean go = true;
  public boolean display = false;
  private EntityPlayer toView;
  private MethodInvoker invoker = Resilience.getInstance().getInvoker();
  private Wrapper wrapper = Resilience.getInstance().getWrapper();
  private boolean once = true;
  private int ticks = 0;
  private String notifyString = "";
  private int notifyTicks = 0;

  public HookGuiIngame(Minecraft minecraft) {
    super(minecraft);
  }

  @Override
  public void renderGameOverlay(float par1, boolean par2, int par3, int par4) {
    boolean wasExtended = false;
    ticks++;
    if (ticks == 5) {
      wasExtended = Resilience.getInstance().getClickGui().values.isExtended();
      Resilience.getInstance().getClickGui().values.setExtended(true);
      Resilience.getInstance().getModuleManager().setModuleState("GUI", true);
    }
    if (ticks == 20) {
      Resilience.getInstance().getClickGui().values.setExtended(wasExtended);
    }
    if (once && !Resilience.getInstance().isFirstTime()) {
      once = false;
      Resilience.getInstance()
          .getLogger()
          .infoChat("Want to know how to chat in the IRC? Put the \"@\" sign before your message!");
    }
    if (display) {
      invoker.displayScreen(new GuiInventory(toView));
      display = false;
    }
    ;
    if (go) {
      if (Resilience.getInstance().isFirstTime()) {
        Resilience.getInstance()
            .getLogger()
            .infoChat("Welcome to " + Resilience.getInstance().getName() + "!");
        Resilience.getInstance()
            .getLogger()
            .infoChat(
                "To open the GUI hit the \"Right Shift\" key, and to open the console hit the \"Minus\" key (\"-\").");
        Resilience.getInstance()
            .getLogger()
            .infoChat("Remember to right click a button to get tons of great options :D");
        Resilience.getInstance()
            .getLogger()
            .infoChat("To chat in the IRC, type \"@\" before the message.");
        Resilience.getInstance().getLogger().infoChat("Enjoy! - Krisp");
      }
      go = false;
    }
    int prevArrayListCount = arrayListCount;
    arrayListCount = 0;
    ScaledResolution var5 =
        new ScaledResolution(
            wrapper.getGameSettings(), invoker.getDisplayWidth(), invoker.getDisplayHeight());
    int var6 = invoker.getScaledWidth(var5);
    int var7 = invoker.getScaledHeight(var5);
    FontRenderer var8 = wrapper.getFontRenderer();
    invoker.setupOverlayRendering();
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_LIGHTING);
    if (Resilience.getInstance().isEnabled()) {
      for (DefaultPanel panel : ClickGui.windows) {
        if (panel.isPinned() && !(invoker.getCurrentScreen() instanceof ClickGui)) {
          GL11.glPushMatrix();
          GL11.glDisable(GL11.GL_LIGHTING);
          panel.draw(-1, -1);
          GL11.glPopMatrix();
        }
      }
      int width = 0;

      if (Resilience.getInstance().getValues().enabledModsEnabled) {
        for (DefaultModule mod : Resilience.getInstance().getModuleManager().moduleList) {
          if (mod.isEnabled() && mod.getCategory() != ModuleCategory.GUI && mod.isVisible()) {
            int realWidth =
                (int) Resilience.getInstance().getModListFont().getWidth(mod.getDisplayName());
            if (realWidth > width) {
              width = realWidth + 8;
            }
          }
        }
      }

      if (Resilience.getInstance().getValues().enabledModsEnabled) {
        GL11.glPushMatrix();
        GL11.glDisable(GL11.GL_LIGHTING);
        if (prevArrayListCount > 0) {
          drawRect(0, 0, 75, prevArrayListCount * 12 + 4, 0x88000000);
        }
        GL11.glPopMatrix();
      }
      if (Resilience.getInstance().getValues().enabledModsEnabled) {
        for (DefaultModule mod : Resilience.getInstance().getModuleManager().moduleList) {
          if (mod.isEnabled() && mod.getCategory() != ModuleCategory.GUI && mod.isVisible()) {
            GL11.glPushMatrix();
            GL11.glDisable(GL11.GL_LIGHTING);
            Resilience.getInstance()
                .getModListFont()
                .drawString(mod.getDisplayName(), 2, arrayListCount * 12 + 2, 0xff9ab3ff);
            GL11.glPopMatrix();
            arrayListCount++;
          }
        }
      }

      if (Resilience.getInstance().getValues().noFireEffectEnabled && invoker.isBurning()) {
        Resilience.getInstance()
            .getWrapper()
            .getFontRenderer()
            .drawStringWithShadow(
                "You're on fire",
                invoker.getDisplayWidth() / 2
                    - Resilience.getInstance()
                        .getWrapper()
                        .getFontRenderer()
                        .getStringWidth("You're on fire")
                    - 4,
                invoker.getDisplayHeight() / 2
                    - Resilience.getInstance().getWrapper().getFontRenderer().FONT_HEIGHT
                    - 4,
                0xffff0000);
      }

      if (Resilience.getInstance().getValues().potionEffectsEnabled) {
        renderPotions();
      }

      if (notifyTicks >= 0) {
        notifyTicks--;
        Resilience.getInstance()
            .getStandardFont()
            .drawCenteredString("\247b" + notifyString, invoker.getWidth() / 2, 4, 0xffffffff);
      }
    }

    super.renderGameOverlay(par1, par2, par3, par4);
  }

  private void renderPotions() {
    GL11.glPushMatrix();
    int var1 = Resilience.getInstance().getValues().enabledModsEnabled ? 76 : 1;
    int var2 = 0;
    boolean var3 = true;
    Collection var4 = wrapper.getPlayer().getActivePotionEffects();

    if (!var4.isEmpty()) {
      ResourceLocation rL = new ResourceLocation("textures/gui/container/inventory.png");
      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
      GL11.glDisable(GL11.GL_LIGHTING);
      int var5 = 33;

      if (var4.size() > 5) {
        var5 = 132 / (var4.size() - 1);
      }

      for (Iterator var6 = wrapper.getPlayer().getActivePotionEffects().iterator();
          var6.hasNext();
          var2 += var5) {
        PotionEffect var7 = (PotionEffect) var6.next();
        Potion var8 = Potion.potionTypes[var7.getPotionID()];
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        wrapper.getMinecraft().getTextureManager().bindTexture(rL);
        // this.drawTexturedModalRect(var1, var2, 0, 166, 140, 32);

        if (var8.hasStatusIcon()) {
          int var9 = var8.getStatusIconIndex();
          this.drawTexturedModalRect(
              var1 + 6, var2 + 7, 0 + var9 % 8 * 18, 198 + var9 / 8 * 18, 18, 18);
        }

        String var11 = I18n.format(var8.getName(), new Object[0]);

        if (var7.getAmplifier() == 1) {
          var11 = var11 + " II";
        } else if (var7.getAmplifier() == 2) {
          var11 = var11 + " III";
        } else if (var7.getAmplifier() == 3) {
          var11 = var11 + " IV";
        }

        wrapper.getFontRenderer().drawStringWithShadow(var11, var1 + 10 + 18, var2 + 6, 16777215);
        String var10 = Potion.getDurationString(var7);
        wrapper
            .getFontRenderer()
            .drawStringWithShadow(var10, var1 + 10 + 18, var2 + 6 + 10, 8355711);
      }
    }
    GL11.glPopMatrix();
  }

  public void displayInv(EntityPlayer e) {
    toView = e;
    display = true;
  }

  public void notify(String string, int ticks) {
    notifyString = string;
    this.notifyTicks = ticks;
  }
}
  @Override
  public void renderGameOverlay(float par1, boolean par2, int par3, int par4) {
    boolean wasExtended = false;
    ticks++;
    if (ticks == 5) {
      wasExtended = Resilience.getInstance().getClickGui().values.isExtended();
      Resilience.getInstance().getClickGui().values.setExtended(true);
      Resilience.getInstance().getModuleManager().setModuleState("GUI", true);
    }
    if (ticks == 20) {
      Resilience.getInstance().getClickGui().values.setExtended(wasExtended);
    }
    if (once && !Resilience.getInstance().isFirstTime()) {
      once = false;
      Resilience.getInstance()
          .getLogger()
          .infoChat("Want to know how to chat in the IRC? Put the \"@\" sign before your message!");
    }
    if (display) {
      invoker.displayScreen(new GuiInventory(toView));
      display = false;
    }
    ;
    if (go) {
      if (Resilience.getInstance().isFirstTime()) {
        Resilience.getInstance()
            .getLogger()
            .infoChat("Welcome to " + Resilience.getInstance().getName() + "!");
        Resilience.getInstance()
            .getLogger()
            .infoChat(
                "To open the GUI hit the \"Right Shift\" key, and to open the console hit the \"Minus\" key (\"-\").");
        Resilience.getInstance()
            .getLogger()
            .infoChat("Remember to right click a button to get tons of great options :D");
        Resilience.getInstance()
            .getLogger()
            .infoChat("To chat in the IRC, type \"@\" before the message.");
        Resilience.getInstance().getLogger().infoChat("Enjoy! - Krisp");
      }
      go = false;
    }
    int prevArrayListCount = arrayListCount;
    arrayListCount = 0;
    ScaledResolution var5 =
        new ScaledResolution(
            wrapper.getGameSettings(), invoker.getDisplayWidth(), invoker.getDisplayHeight());
    int var6 = invoker.getScaledWidth(var5);
    int var7 = invoker.getScaledHeight(var5);
    FontRenderer var8 = wrapper.getFontRenderer();
    invoker.setupOverlayRendering();
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_LIGHTING);
    if (Resilience.getInstance().isEnabled()) {
      for (DefaultPanel panel : ClickGui.windows) {
        if (panel.isPinned() && !(invoker.getCurrentScreen() instanceof ClickGui)) {
          GL11.glPushMatrix();
          GL11.glDisable(GL11.GL_LIGHTING);
          panel.draw(-1, -1);
          GL11.glPopMatrix();
        }
      }
      int width = 0;

      if (Resilience.getInstance().getValues().enabledModsEnabled) {
        for (DefaultModule mod : Resilience.getInstance().getModuleManager().moduleList) {
          if (mod.isEnabled() && mod.getCategory() != ModuleCategory.GUI && mod.isVisible()) {
            int realWidth =
                (int) Resilience.getInstance().getModListFont().getWidth(mod.getDisplayName());
            if (realWidth > width) {
              width = realWidth + 8;
            }
          }
        }
      }

      if (Resilience.getInstance().getValues().enabledModsEnabled) {
        GL11.glPushMatrix();
        GL11.glDisable(GL11.GL_LIGHTING);
        if (prevArrayListCount > 0) {
          drawRect(0, 0, 75, prevArrayListCount * 12 + 4, 0x88000000);
        }
        GL11.glPopMatrix();
      }
      if (Resilience.getInstance().getValues().enabledModsEnabled) {
        for (DefaultModule mod : Resilience.getInstance().getModuleManager().moduleList) {
          if (mod.isEnabled() && mod.getCategory() != ModuleCategory.GUI && mod.isVisible()) {
            GL11.glPushMatrix();
            GL11.glDisable(GL11.GL_LIGHTING);
            Resilience.getInstance()
                .getModListFont()
                .drawString(mod.getDisplayName(), 2, arrayListCount * 12 + 2, 0xff9ab3ff);
            GL11.glPopMatrix();
            arrayListCount++;
          }
        }
      }

      if (Resilience.getInstance().getValues().noFireEffectEnabled && invoker.isBurning()) {
        Resilience.getInstance()
            .getWrapper()
            .getFontRenderer()
            .drawStringWithShadow(
                "You're on fire",
                invoker.getDisplayWidth() / 2
                    - Resilience.getInstance()
                        .getWrapper()
                        .getFontRenderer()
                        .getStringWidth("You're on fire")
                    - 4,
                invoker.getDisplayHeight() / 2
                    - Resilience.getInstance().getWrapper().getFontRenderer().FONT_HEIGHT
                    - 4,
                0xffff0000);
      }

      if (Resilience.getInstance().getValues().potionEffectsEnabled) {
        renderPotions();
      }

      if (notifyTicks >= 0) {
        notifyTicks--;
        Resilience.getInstance()
            .getStandardFont()
            .drawCenteredString("\247b" + notifyString, invoker.getWidth() / 2, 4, 0xffffffff);
      }
    }

    super.renderGameOverlay(par1, par2, par3, par4);
  }