Package org.spoutcraft.api.gui

Examples of org.spoutcraft.api.gui.InGameHUD


    } catch (Exception e) {
      e.printStackTrace();
    }
    if (widget != null) {
      allWidgets.put(widgetId, widget);
      InGameHUD mainScreen = SpoutClient.getInstance().getActivePlayer().getMainScreen();
      PopupScreen popup = mainScreen.getActivePopup();
      Screen overlay = null;

      if (SpoutClient.getHandle().currentScreen != null) {
        overlay = SpoutClient.getHandle().currentScreen.getScreen();
      }
      // Determine if this is a popup screen and if we need to update it
      if (widget instanceof PopupScreen) {
        if (popup != null) {
          if (widget.getId().equals(popup.getId())) {
            if (SpoutClient.getHandle().currentScreen instanceof CustomScreen) {
              ((CustomScreen)SpoutClient.getHandle().currentScreen).update((PopupScreen)widget);
            }
          } else {
            mainScreen.closePopup();
            mainScreen.attachPopupScreen((PopupScreen)widget);
          }
        } else {
          mainScreen.attachPopupScreen((PopupScreen)widget);
        }
      } else if (widget instanceof OverlayScreen) { // Determine if this screen overrides another screen
        if (SpoutClient.getHandle().currentScreen != null) {
          SpoutClient.getHandle().currentScreen.update((OverlayScreen)widget);
          overlay = (OverlayScreen)widget;
        }
      } else if (screen.equals(mainScreen.getId())) { // Determine if this is a widget on the main screen
        if (mainScreen.containsWidget(widget.getId())) {
          mainScreen.updateWidget(widget);
          widget.setScreen(mainScreen);
        } else {
          widget.setScreen(mainScreen);
          mainScreen.attachWidget(widget.getAddon(), widget);
        }
      } else if (popup != null && screen.equals(popup.getId())) { // Determine if this is a widget on the popup screen
        if (popup.containsWidget(widget.getId())) {
          popup.updateWidget(widget);
          widget.setScreen(popup);
View Full Code Here


  public void writeData(SpoutOutputStream output) throws IOException {
    output.writeUUID(widget);
  }

  public void run(int playerId) {
    InGameHUD mainScreen = SpoutClient.getInstance().getActivePlayer().getMainScreen();
    PopupScreen popup = mainScreen.getActivePopup();

    Widget w = PacketWidget.allWidgets.get(widget);

    if (w != null && w.getScreen() != null && !(w instanceof Screen)) {
      w.getScreen().removeWidget(w);
    }

    if (w instanceof PopupScreen && popup.getId().equals(w.getId())) {
      // Determine if this is a popup screen and if we need to update it
      mainScreen.closePopup();
    }

    PacketWidget.allWidgets.remove(widget);
  }
View Full Code Here

    output.writeLong(control.getId().getLeastSignificantBits());
    output.writeBoolean(focus);
  }

  public void run(int playerId) {
    InGameHUD screen = SpoutClient.getInstance().getActivePlayer().getMainScreen();
    PopupScreen popup = screen.getActivePopup();
    if (popup != null) {
      Widget w = popup.getWidget(widgetId);
      if (w != null && w instanceof Control) {
        ((Control)w).setFocus(focus);
      }
View Full Code Here

   * Render the ingame overlay with quick icon bar, ...
   */
  // Spout Start - Most of function rewritten
  // TODO: Rewrite again, it's in a horrible state, I'm surprised it works...
  public void renderGameOverlay(float f, boolean flag, int i, int j) {
    InGameHUD mainScreen = SpoutClient.getInstance().getActivePlayer().getMainScreen();

    ScaledResolution scaledRes = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight);
    int screenWidth = scaledRes.getScaledWidth();
    int screenHeight = scaledRes.getScaledHeight();
    FontRenderer font = this.mc.fontRenderer;
    this.mc.entityRenderer.setupOverlayRendering();
    GL11.glEnable(GL11.GL_BLEND);

    if (Minecraft.isFancyGraphicsEnabled()) {
      this.renderVignette(this.mc.thePlayer.getBrightness(f), screenWidth, screenHeight);
    } else {
      GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    }

    ItemStack helmet = this.mc.thePlayer.inventory.armorItemInSlot(3);

    if (this.mc.gameSettings.thirdPersonView == 0 && helmet != null && helmet.itemID == Block.pumpkin.blockID) {
      this.renderPumpkinBlur(screenWidth, screenHeight);
    }

    if (!this.mc.thePlayer.isPotionActive(Potion.confusion)) {
      float var10 = this.mc.thePlayer.prevTimeInPortal + (this.mc.thePlayer.timeInPortal - this.mc.thePlayer.prevTimeInPortal) * f;

      if (var10 > 0.0F) {
        this.func_130015_b(var10, screenWidth, screenHeight); //renderPortalOverlay
      }
    }
    GL11.glBlendFunc(770, 771);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.getTextureManager().bindTexture(widgetsTexPath);
    InventoryPlayer var11 = this.mc.thePlayer.inventory;
    this.zLevel = -90.0F;
    this.drawTexturedModalRect(screenWidth / 2 - 91, screenHeight - 22, 0, 0, 182, 22);
    this.drawTexturedModalRect(screenWidth / 2 - 91 - 1 + var11.currentItem * 20, screenHeight - 22 - 1, 0, 22, 24, 22);
    this.mc.getTextureManager().bindTexture(icons);
    GL11.glEnable(3042 /* GL_BLEND */);
    GL11.glBlendFunc(775, 769);
    this.drawTexturedModalRect(screenWidth / 2 - 7, screenHeight / 2 - 7, 0, 0, 16, 16);
    GL11.glDisable(3042 /* GL_BLEND */);

    GuiIngame.rand.setSeed((long) (this.updateCounter * 312871));
    int var15;
    int var17;

    this.renderBossHealth();
    // Toggle visibility if needed
    if (needsUpdate && mainScreen.getHealthBar().isVisible() == mc.playerController.isInCreativeMode()) {
      mainScreen.toggleSurvivalHUD(!mc.playerController.isInCreativeMode());
    }
    needsUpdate = false;

    // Hunger Bar Begin
    mainScreen.getHungerBar().render();
    // Hunger Bar End

    // Armor Bar Begin
    mainScreen.getArmorBar().render();
    // Armor Bar End

    // Health Bar Begin
    mainScreen.getHealthBar().render();
    // Health Bar End

    // Bubble Bar Begin
    mainScreen.getBubbleBar().render();
    // Bubble Bar End

    // Exp Bar Begin
    mainScreen.getExpBar().render();
    // Exp Bar End

    map.onRenderTick();

    GL11.glDisable(GL11.GL_BLEND);
    this.mc.mcProfiler.startSection("actionBar");
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    RenderHelper.enableGUIStandardItemLighting();

    for (var15 = 0; var15 < 9; ++var15) {
      int x = screenWidth / 2 - 90 + var15 * 20 + 2;
      var17 = screenHeight - 16 - 3;
      this.renderInventorySlot(var15, x, var17, f);
    }

    RenderHelper.disableStandardItemLighting();
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    this.mc.mcProfiler.endSection();

    if (this.mc.thePlayer.getSleepTimer() > 0) {
      GL11.glDisable(2929 /*GL_DEPTH_TEST*/);
      GL11.glDisable(3008 /*GL_ALPHA_TEST*/);
      var15 = this.mc.thePlayer.getSleepTimer();
      float var26 = (float)var15 / 100.0F;
      if (var26 > 1.0F) {
        var26 = 1.0F - (float)(var15 - 100) / 10.0F;
      }

      var17 = (int)(220.0F * var26) << 24 | 1052704;
      this.drawRect(0, 0, screenWidth, screenHeight, var17);
      GL11.glEnable(3008 /*GL_ALPHA_TEST*/);
      GL11.glEnable(2929 /*GL_DEPTH_TEST*/);
    }

    mainScreen.render();
   
    int var111;
    var111 = screenWidth / 2 - 91;
    int var12;
    int var13;
    int var14;
    int var115;
    int var117;
    int var16;
    float var33;
    float var313;
    short var317;   
   
    //ToDo: this will need TLC
    if (this.mc.thePlayer.isRidingHorse()) {
      this.mc.mcProfiler.startSection("jumpBar");
      this.mc.getTextureManager().bindTexture(Gui.icons);
      var313 = this.mc.thePlayer.getHorseJumpPower();
      var317 = 182;
      var14 = (int)(var313 * (float)(var317 + 1));
      var115 = screenHeight - 32 + 3;
      this.drawTexturedModalRect(var111, var115, 0, 84, var317, 5);

      if (var14 > 0) {
        this.drawTexturedModalRect(var111, var115, 0, 89, var14, 5);
      }

      this.mc.mcProfiler.endSection();
    } else if (this.mc.playerController.func_78763_f()) {
     
      // Spout -> Removed, we have our own.
      /*
      this.mc.mcProfiler.startSection("expBar");
      this.mc.getTextureManager().bindTexture(Gui.icons);
      var12 = this.mc.thePlayer.xpBarCap();

      if (var12 > 0) {
        var317 = 182;
        var14 = (int)(this.mc.thePlayer.experience * (float)(var317 + 1));
        var115 = screenHeight - 32 + 3;
        this.drawTexturedModalRect(var111, var115, 0, 64, var317, 5);

        if (var14 > 0) {
          this.drawTexturedModalRect(var111, var115, 0, 69, var14, 5);
        }
      }
     

      this.mc.mcProfiler.endSection();

      // Spout Start -> We have our own
     
      if (this.mc.thePlayer.experienceLevel > 0) {
        this.mc.mcProfiler.startSection("expLevel");
        boolean var35 = false;
        var14 = var35 ? 16777215 : 8453920;
        String var42 = "" + this.mc.thePlayer.experienceLevel;
        var16 = (screenWidth- font.getStringWidth(var42)) / 2;
        var117 = screenHeight - 31 - 4;
        boolean var18 = false;
        font.drawString(var42, var16 + 1, var117, 0);
        font.drawString(var42, var16 - 1, var117, 0);
        font.drawString(var42, var16, var117 + 1, 0);
        font.drawString(var42, var16, var117 - 1, 0);
        font.drawString(var42, var16, var117, var14);
        this.mc.mcProfiler.endSection();
      }
      */
    }
   
    if (this.mc.gameSettings.showDebugInfo) {
      this.mc.mcProfiler.startSection("debug");
      GL11.glPushMatrix();
      if (Configuration.getFastDebug() != 2) {
        font.drawStringWithShadow("Spoutcraft 1.6.4 (" + this.mc.debug + ")", 2, 2, 16777215);
        font.drawStringWithShadow(this.mc.debugInfoRenders(), 2, 12, 16777215);
        font.drawStringWithShadow(this.mc.getEntityDebug(), 2, 22, 16777215);
        font.drawStringWithShadow(this.mc.debugInfoEntities(), 2, 32, 16777215);
        font.drawStringWithShadow(this.mc.getWorldProviderName(), 2, 42, 16777215);
        long var41 = Runtime.getRuntime().maxMemory();
        long var34 = Runtime.getRuntime().totalMemory();
        long var42 = Runtime.getRuntime().freeMemory();
        long var43 = var34 - var42;
        String var45 = "Used memory: " + var43 * 100L / var41 + "% (" + var43 / 1024L / 1024L + "MB) of " + var41 / 1024L / 1024L + "MB";
        this.drawString(font, var45, screenWidth - font.getStringWidth(var45) - 2, 2, 14737632);
        var45 = "Allocated memory: " + var34 * 100L / var41 + "% (" + var34 / 1024L / 1024L + "MB)";
        this.drawString(font, var45, screenWidth - font.getStringWidth(var45) - 2, 12, 14737632);
        int var47 = MathHelper.floor_double(this.mc.thePlayer.posX);
        int var22 = MathHelper.floor_double(this.mc.thePlayer.posY);
        int var23 = MathHelper.floor_double(this.mc.thePlayer.posZ);
        if(SpoutClient.getInstance().isCoordsCheat()) {
          this.drawString(font, String.format("x: %.5f (%d) // c: %d (%d)", new Object[] {Double.valueOf(this.mc.thePlayer.posX), Integer.valueOf(var47), Integer.valueOf(var47 >> 4), Integer.valueOf(var47 & 15)}), 2, 64, 14737632);
          this.drawString(font, String.format("y: %.3f (feet pos, %.3f eyes pos)", new Object[] {Double.valueOf(this.mc.thePlayer.boundingBox.minY), Double.valueOf(this.mc.thePlayer.posY)}), 2, 72, 14737632);
          this.drawString(font, String.format("z: %.5f (%d) // c: %d (%d)", new Object[] {Double.valueOf(this.mc.thePlayer.posZ), Integer.valueOf(var23), Integer.valueOf(var23 >> 4), Integer.valueOf(var23 & 15)}), 2, 80, 14737632);
          int var24 = MathHelper.floor_double((double)(this.mc.thePlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
          this.drawString(font, "f: " + var24 + " (" + Direction.directions[var24] + ") / " + MathHelper.wrapAngleTo180_float(this.mc.thePlayer.rotationYaw), 2, 88, 14737632);
        }

        if (this.mc.theWorld != null && this.mc.theWorld.blockExists(var47, var22, var23)) {
          Chunk var48 = this.mc.theWorld.getChunkFromBlockCoords(var47, var23);
          this.drawString(font, "lc: " + (var48.getTopFilledSegment() + 15) + " b: " + var48.getBiomeGenForWorldCoords(var47 & 15, var23 & 15, this.mc.theWorld.getWorldChunkManager()).biomeName + " bl: " + var48.getSavedLightValue(EnumSkyBlock.Block, var47 & 15, var22, var23 & 15) + " sl: " + var48.getSavedLightValue(EnumSkyBlock.Sky, var47 & 15, var22, var23 & 15) + " rl: " + var48.getBlockLightValue(var47 & 15, var22, var23 & 15, 0), 2, 96, 14737632);
        }

        this.drawString(font, String.format("ws: %.3f, fs: %.3f, g: %b, fl: %d", new Object[] {Float.valueOf(this.mc.thePlayer.capabilities.getWalkSpeed()), Float.valueOf(this.mc.thePlayer.capabilities.getFlySpeed()), Boolean.valueOf(this.mc.thePlayer.onGround), Integer.valueOf(this.mc.theWorld.getHeightValue(var47, var23))}), 2, 104, 14737632);
       
      } else {
        font.drawStringWithShadow(Integer.toString(Minecraft.framesPerSecond), 4, 2, 0xFFE303);
      }
      this.mc.mcProfiler.endSection();
      GL11.glPopMatrix();

      if (this.recordPlayingUpFor > 0) {
        this.mc.mcProfiler.startSection("overlayMessage");
        var33 = (float)this.recordPlayingUpFor - f;
        var12 = (int)(var33 * 256.0F / 20.0F);

        if (var12 > 255) {
          var12 = 255;
        }

        if (var12 > 0) {
          GL11.glPushMatrix();
          GL11.glTranslatef((float)(screenWidth / 2), (float)(screenHeight - 48), 0.0F);
          GL11.glEnable(GL11.GL_BLEND);
          GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
          var13 = 16777215;

          if (this.recordIsPlaying) {
            var13 = Color.HSBtoRGB(var33 / 50.0F, 0.7F, 0.6F) & 16777215;
          }

          font.drawString(this.recordPlaying, -font.getStringWidth(this.recordPlaying) / 2, -4, var13 + (var12 << 24));
          GL11.glDisable(GL11.GL_BLEND);
          GL11.glPopMatrix();
        }

        this.mc.mcProfiler.endSection();
      }
    }
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glPushMatrix();
   
    int var38;
    // Spout Start
    float pHealth;
    float ppHealth;

    // Hotbar Text
    if (Configuration.showHotbarText) {
      String var35;
      String custom = null;
      pHealth = this.mc.thePlayer.getHealth();
      ppHealth = this.mc.thePlayer.prevHealth;
      String var34 = "" + this.mc.thePlayer.experienceLevel;
      var38 = (screenWidth - font.getStringWidth(var34)) / 2;
      this.mc.mcProfiler.startSection("toolHighlight");

      if (this.remainingHighlightTicks > 0 && this.highlightingItemStack != null) {
        if (this.highlightingItemStack.itemID == MaterialData.flint.getRawId()) {
          custom = Spoutcraft.getMaterialManager().getToolTip(new CraftItemStack(this.highlightingItemStack));
        }
        if (custom != null) {
          String[] split = custom.split("\n");
          String newCustom = split[0];
          var35 = newCustom;
        } else {
          var35 = this.highlightingItemStack.getDisplayName();
        }
        var12 = (screenWidth - font.getStringWidth(var35)) / 2;
        var13 = screenHeight - 59;

        if (!mainScreen.getHungerBar().isVisible() || !mainScreen.getHealthBar().isVisible()) {
          var13 += 8;
        }
        if (!mainScreen.getArmorBar().isVisible()) {
          var13 += 8;
        }

        if (!mainScreen.getExpBar().isVisible()) {
          var13 += 6;
        }

        var38 = (int)((float)this.remainingHighlightTicks * 256.0F / 10.0F);

View Full Code Here

TOP

Related Classes of org.spoutcraft.api.gui.InGameHUD

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.