private void drawMachineRender(int posX, int posY) {
    RenderHelper.enableGUIStandardItemLighting();
    GL11.glTranslated(0, 0, 32);
    HandbookEntry h = this.getEntry();
    double x = posX + 167;
    double y = posY + 44;
    // float q = 12.5F + fscale*(float)Math.sin(System.nanoTime()/1000000000D); //wobble
    // ReikaJavaLibrary.pConsole(y-ReikaGuiAPI.instance.getMouseScreenY(height));
    int range = 64;
    boolean rotate =
        ReikaGuiAPI.instance.isMouseInBox(
            (int) x - range / 2, (int) x + range / 2, (int) y - range, (int) y + range);
    if (Mouse.isButtonDown(0) && rotate) {
      int mvy = Mouse.getDY();
      if (mvy < 0 && renderq < 45) {
        renderq++;
      }
      if (mvy > 0 && renderq > -45) {
        renderq--;
      }
    }
    y -= 8 * Math.sin(Math.abs(Math.toRadians(renderq)));

    if (h.hasMachineRender()) {
      GL11.glEnable(GL11.GL_BLEND);
      this.doRenderMachine(x, y, h);
      GL11.glDisable(GL11.GL_BLEND);
    }
    GL11.glTranslated(0, 0, -32);
  }
  @SideOnly(Side.CLIENT)
  public static void renderItem(GuiScreen gui, ItemStack stack, int x, int y, float scale) {
    GL11.glPushMatrix();
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    RenderHelper.enableGUIStandardItemLighting();
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glTranslated(x, y, 0);
    GL11.glScalef(scale, scale, scale);

    boolean flagBefore = gui.mc.fontRenderer.getUnicodeFlag();
    gui.mc.fontRenderer.setUnicodeFlag(false);
    RenderItem.getInstance()
        .renderItemAndEffectIntoGUI(gui.mc.fontRenderer, gui.mc.getTextureManager(), stack, 0, 0);
    RenderItem.getInstance()
        .renderItemOverlayIntoGUI(gui.mc.fontRenderer, gui.mc.getTextureManager(), stack, 0, 0);
    gui.mc.fontRenderer.setUnicodeFlag(flagBefore);

    // GL+MC+NEI suck
    if (gui instanceof GuiBooklet) {
      RenderHelper.disableStandardItemLighting();
    }
    GL11.glPopMatrix();
  }
 @Override
 protected void drawSlot(int id, int x, int y, int var4, int var5, int var6) {
   Block block = blocks.get(id);
   ItemStack itemStack = new ItemStack(Item.getItemFromBlock(block));
   GlStateManager.enableRescaleNormal();
   GlStateManager.enableBlend();
   RenderHelper.enableGUIStandardItemLighting();
   GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
   if (itemStack.getItem() != null)
     try {
       Minecraft.getMinecraft()
           .getRenderItem()
           .renderItemAndEffectIntoGUI(itemStack, x + 4, y + 4);
     } catch (Exception e) {
       e.printStackTrace();
     }
   else mc.fontRendererObj.drawString("?", x + 10, y + 9, 10526880);
   Minecraft.getMinecraft()
       .getRenderItem()
       .func_175030_a(Minecraft.getMinecraft().fontRendererObj, itemStack, x + 4, y + 4);
   RenderHelper.disableStandardItemLighting();
   GlStateManager.disableRescaleNormal();
   GlStateManager.disableBlend();
   glDisable(GL_LIGHTING);
   mc.fontRendererObj.drawString(
       "Name: "
           + (itemStack.getItem() == null ? block.getLocalizedName() : itemStack.getDisplayName()),
       x + 31,
       y + 3,
       10526880);
   int blockID = Block.getIdFromBlock(block);
   mc.fontRendererObj.drawString("ID: " + blockID, x + 31, y + 15, 10526880);
 }
  @SideOnly(Side.CLIENT)
  @Override
  public void renderHUD(Minecraft mc, ScaledResolution res) {
    super.renderHUD(mc, res);

    IBlockState filter = getUnderlyingBlock();
    ItemStack recieverStack =
        new ItemStack(
            Item.getItemFromBlock(filter.getBlock()),
            1,
            filter.getBlock().getMetaFromState(filter));
    int color = getColor();

    GlStateManager.enableBlend();
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    if (recieverStack.getItem() != null) {
      String stackName = recieverStack.getDisplayName();
      int width = 16 + mc.fontRendererObj.getStringWidth(stackName) / 2;
      int x = res.getScaledWidth() / 2 - width;
      int y = res.getScaledHeight() / 2 + 30;

      mc.fontRendererObj.drawStringWithShadow(stackName, x + 20, y + 5, color);
      RenderHelper.enableGUIStandardItemLighting();
      mc.getRenderItem().renderItemAndEffectIntoGUI(recieverStack, x, y);
      RenderHelper.disableStandardItemLighting();
    }

    GlStateManager.disableLighting();
    GlStateManager.disableBlend();
  }
Example #5
0
  protected void func_180479_a(ScaledResolution p_180479_1_, float p_180479_2_) {
    if (this.mc.func_175606_aa() instanceof EntityPlayer) {
      GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
      this.mc.getTextureManager().bindTexture(widgetsTexPath);
      EntityPlayer var3 = (EntityPlayer) this.mc.func_175606_aa();
      int var4 = p_180479_1_.getScaledWidth() / 2;
      float var5 = this.zLevel;
      this.zLevel = -90.0F;
      this.drawTexturedModalRect(var4 - 91, p_180479_1_.getScaledHeight() - 22, 0, 0, 182, 22);
      this.drawTexturedModalRect(
          var4 - 91 - 1 + var3.inventory.currentItem * 20,
          p_180479_1_.getScaledHeight() - 22 - 1,
          0,
          22,
          24,
          22);
      this.zLevel = var5;
      GlStateManager.enableRescaleNormal();
      GlStateManager.enableBlend();
      GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
      RenderHelper.enableGUIStandardItemLighting();

      for (int var6 = 0; var6 < 9; ++var6) {
        int var7 = p_180479_1_.getScaledWidth() / 2 - 90 + var6 * 20 + 2;
        int var8 = p_180479_1_.getScaledHeight() - 16 - 3;
        this.func_175184_a(var6, var7, var8, p_180479_2_, var3);
      }

      RenderHelper.disableStandardItemLighting();
      GlStateManager.disableRescaleNormal();
      GlStateManager.disableBlend();
    }
  }
Example #6
0
    @Override
    public void draw(int startX, int startY) {
      GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
      GL11.glDisable(GL11.GL_LIGHTING);
      GL11.glEnable(GL11.GL_DEPTH_TEST);
      RenderHelper.enableGUIStandardItemLighting();
      OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

      ItemStack output = getOutputStack();
      if (output != null) manager.gui.drawItemStack(output, startX + xPos, startY + yPos);
      // RenderHelper.disableStandardItemLighting();

      GL11.glDisable(GL11.GL_DEPTH_TEST);

      if (worktable.getMemory().isLocked(slotNumber)) {
        manager.gui.setZLevel(110f);
        Proxies.common.bindTexture(SpriteSheet.ITEMS);
        manager.gui.drawTexturedModelRectFromIcon(
            startX + xPos,
            startY + yPos,
            TextureManager.getInstance().getDefault("slots/locked"),
            16,
            16);
        manager.gui.setZLevel(0f);
      }

      GL11.glPopAttrib();
    }
  @Override
  public void drawScreen(int x, int y, float par3) {
    super.drawScreen(x, y, par3);

    MerchantRecipeList recipes = this.villager.getRecipes(this.mc.thePlayer);
    if ((recipes != null) && !(recipes.isEmpty())) {
      int xCenter = (this.width - this.xSize) / 2;
      int yCenter = (this.height - this.ySize) / 2;

      MerchantRecipe recipe = (MerchantRecipe) recipes.get(this.currentRecipeIndex);

      ItemStack[] slot = new ItemStack[3];
      slot[0] = recipe.getItemToBuy();
      slot[1] = recipe.getSecondItemToBuy();
      slot[2] = recipe.getItemToSell();

      GL11.glPushMatrix();
      GL11.glPushAttrib(GL11.GL_ENABLE_BIT);

      RenderHelper.enableGUIStandardItemLighting();

      GL11.glEnable(GL12.GL_RESCALE_NORMAL);

      itemRender.zLevel = 100;
      itemRender.renderItemAndEffectIntoGUI(
          this.fontRendererObj, this.mc.renderEngine, slot[0], xCenter + 36, yCenter + 24);
      itemRender.renderItemOverlayIntoGUI(
          this.fontRendererObj, this.mc.renderEngine, slot[0], xCenter + 36, yCenter + 24);

      if (slot[1] != null) {
        itemRender.renderItemAndEffectIntoGUI(
            this.fontRendererObj, this.mc.renderEngine, slot[1], xCenter + 62, yCenter + 24);
        itemRender.renderItemOverlayIntoGUI(
            this.fontRendererObj, this.mc.renderEngine, slot[1], xCenter + 62, yCenter + 24);
      }

      itemRender.renderItemAndEffectIntoGUI(
          this.fontRendererObj, this.mc.renderEngine, slot[2], xCenter + 120, yCenter + 24);
      itemRender.renderItemOverlayIntoGUI(
          this.fontRendererObj, this.mc.renderEngine, slot[2], xCenter + 120, yCenter + 24);

      itemRender.zLevel = 0;

      GL11.glDisable(GL11.GL_LIGHTING);

      if (this.func_146978_c(36, 24, 16, 16, x, y)) {
        this.renderToolTip(slot[0], x, y);
      } else if ((slot[1] != null) && this.func_146978_c(62, 24, 16, 16, x, y)) {
        this.renderToolTip(slot[1], x, y);
      } else if (this.func_146978_c(120, 24, 16, 16, x, y)) {
        this.renderToolTip(slot[2], x, y);
      }

      RenderHelper.enableStandardItemLighting();

      GL11.glPopAttrib();
      GL11.glPopMatrix();
    }
  }
Example #8
0
  public static void fixLighting() {
    lighting = !lighting;

    if (lighting) {
      RenderHelper.enableGUIStandardItemLighting();
    } else {
      RenderHelper.disableStandardItemLighting();
    }
  }
Example #9
0
 private void drawStatsScreen(int p_146521_1_, int p_146521_2_, Item p_146521_3_) {
   this.drawButtonBackground(p_146521_1_ + 1, p_146521_2_ + 1);
   GlStateManager.enableRescaleNormal();
   RenderHelper.enableGUIStandardItemLighting();
   this.itemRender.func_175042_a(
       new ItemStack(p_146521_3_, 1, 0), p_146521_1_ + 2, p_146521_2_ + 2);
   RenderHelper.disableStandardItemLighting();
   GlStateManager.disableRescaleNormal();
 }
  /** Draws the screen and all the components in it. */
  @Override
  public void drawScreen(int par1, int par2, float par3) {

    super.drawScreen(par1, par2, par3);
    MerchantRecipeList var4 = this.recordList;

    if (var4 != null && !var4.isEmpty()) {
      int var5 = (this.width - this.xSize) / 2;
      int var6 = (this.height - this.ySize) / 2;
      int var7 = this.currentRecipeIndex;
      MerchantRecipe var8 = (MerchantRecipe) var4.get(var7);
      GL11.glPushMatrix();
      ItemStack var9 = var8.getItemToBuy();
      ItemStack var10 = var8.getSecondItemToBuy();
      ItemStack var11 = var8.getItemToSell();
      RenderHelper.enableGUIStandardItemLighting();
      GL11.glDisable(GL11.GL_LIGHTING);
      GL11.glEnable(GL12.GL_RESCALE_NORMAL);
      GL11.glEnable(GL11.GL_COLOR_MATERIAL);
      GL11.glEnable(GL11.GL_LIGHTING);
      GuiContainer.itemRenderer.zLevel = 100.0F;
      GuiContainer.itemRenderer.renderItemAndEffectIntoGUI(
          this.fontRenderer, this.mc.renderEngine, var9, var5 + 36, var6 + 24);
      GuiContainer.itemRenderer.renderItemOverlayIntoGUI(
          this.fontRenderer, this.mc.renderEngine, var9, var5 + 36, var6 + 24);

      if (var10 != null) {
        GuiContainer.itemRenderer.renderItemAndEffectIntoGUI(
            this.fontRenderer, this.mc.renderEngine, var10, var5 + 62, var6 + 24);
        GuiContainer.itemRenderer.renderItemOverlayIntoGUI(
            this.fontRenderer, this.mc.renderEngine, var10, var5 + 62, var6 + 24);
      }

      GuiContainer.itemRenderer.renderItemAndEffectIntoGUI(
          this.fontRenderer, this.mc.renderEngine, var11, var5 + 120, var6 + 24);
      GuiContainer.itemRenderer.renderItemOverlayIntoGUI(
          this.fontRenderer, this.mc.renderEngine, var11, var5 + 120, var6 + 24);
      GuiContainer.itemRenderer.zLevel = 0.0F;
      GL11.glDisable(GL11.GL_LIGHTING);

      if (this.isPointInRegion(36, 24, 16, 16, par1, par2)) {
        this.drawItemStackTooltip(var9, par1, par2);
      } else if (var10 != null && this.isPointInRegion(62, 24, 16, 16, par1, par2)) {
        this.drawItemStackTooltip(var10, par1, par2);
      } else if (this.isPointInRegion(120, 24, 16, 16, par1, par2)) {
        this.drawItemStackTooltip(var11, par1, par2);
      }

      GL11.glPopMatrix();
      GL11.glEnable(GL11.GL_LIGHTING);
      GL11.glEnable(GL11.GL_DEPTH_TEST);
      RenderHelper.enableStandardItemLighting();
    }
  }
  private void drawItemStack(int x, int y, ItemStack itemStack) {
    drawItemStackSlot(x, y);

    if (itemStack != null && Item.itemsList[itemStack.itemID] != null) {
      GL11.glEnable(GL12.GL_RESCALE_NORMAL);
      RenderHelper.enableGUIStandardItemLighting();
      Settings.renderItem.renderItemIntoGUI(
          this.fontRenderer, this.renderEngine, itemStack, x + 2, y + 2);
      RenderHelper.disableStandardItemLighting();
      GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    }
  }
Example #12
0
  @SideOnly(Side.CLIENT)
  public void renderItem(
      IGuiLexiconEntry gui, int xPos, int yPos, ItemStack stack, boolean accountForContainer) {
    RenderItem render = new RenderItem();
    boolean mouseDown = Mouse.isButtonDown(0);

    GL11.glPushMatrix();
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    RenderHelper.enableGUIStandardItemLighting();
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    render.renderItemAndEffectIntoGUI(
        Minecraft.getMinecraft().fontRenderer,
        Minecraft.getMinecraft().getTextureManager(),
        stack,
        xPos,
        yPos);
    render.renderItemOverlayIntoGUI(
        Minecraft.getMinecraft().fontRenderer,
        Minecraft.getMinecraft().getTextureManager(),
        stack,
        xPos,
        yPos);
    RenderHelper.disableStandardItemLighting();
    GL11.glPopMatrix();

    if (relativeMouseX >= xPos
        && relativeMouseY >= yPos
        && relativeMouseX <= xPos + 16
        && relativeMouseY <= yPos + 16) {
      tooltipStack = stack;

      EntryData data = LexiconRecipeMappings.getDataForStack(tooltipStack);
      if (data != null && (data.entry != gui.getEntry() || data.page != gui.getPageOn())) {
        tooltipEntry = true;

        if (!mouseDownLastTick && mouseDown && GuiScreen.isShiftKeyDown()) {
          GuiLexiconEntry newGui = new GuiLexiconEntry(data.entry, (GuiScreen) gui);
          newGui.page = data.page;
          Minecraft.getMinecraft().displayGuiScreen(newGui);
        }
      }

      if (accountForContainer) {
        ItemStack containerStack = stack.getItem().getContainerItem(stack);
        if (containerStack != null && containerStack.getItem() != null)
          tooltipContainerStack = containerStack;
      }
    }

    GL11.glDisable(GL11.GL_LIGHTING);
  }
Example #13
0
    @Override
    public void draw(int startX, int startY) {
      GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
      GL11.glDisable(GL11.GL_LIGHTING);
      GL11.glEnable(GL11.GL_DEPTH_TEST);
      RenderHelper.enableGUIStandardItemLighting();
      OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

      manager.gui.drawItemStack(BOOK, startX + xPos, startY + yPos);

      GL11.glPopAttrib();
    }
  public void drawScreen(int par1, int par2, float par3) {
    super.drawScreen(par1, par2, par3);
    Minecraft mc = Minecraft.getMinecraft();
    MerchantRecipeList merchantrecipelist = this.theIMerchant.getRecipes(mc.thePlayer);
    if (merchantrecipelist != null && !merchantrecipelist.isEmpty()) {
      int k = (super.width - super.xSize) / 2;
      int l = (super.height - super.ySize) / 2;
      int i1 = this.currentRecipeIndex;
      MerchantRecipe merchantrecipe = (MerchantRecipe) merchantrecipelist.get(i1);
      GL11.glPushMatrix();
      ItemStack itemstack = merchantrecipe.getItemToBuy();
      ItemStack itemstack1 = merchantrecipe.getSecondItemToBuy();
      ItemStack itemstack2 = merchantrecipe.getItemToSell();
      RenderHelper.enableGUIStandardItemLighting();
      GL11.glDisable(2896);
      GL11.glEnable('\u803a');
      GL11.glEnable(2903);
      GL11.glEnable(2896);
      GuiScreen.itemRender.zLevel = 100.0F;
      GuiScreen.itemRender.renderItemAndEffectIntoGUI(
          super.fontRendererObj, mc.getTextureManager(), itemstack, k + 36, l + 24);
      GuiScreen.itemRender.renderItemOverlayIntoGUI(
          super.fontRendererObj, mc.getTextureManager(), itemstack, k + 36, l + 24);
      if (itemstack1 != null) {
        GuiScreen.itemRender.renderItemAndEffectIntoGUI(
            super.fontRendererObj, mc.getTextureManager(), itemstack1, k + 62, l + 24);
        GuiScreen.itemRender.renderItemOverlayIntoGUI(
            super.fontRendererObj, mc.getTextureManager(), itemstack1, k + 62, l + 24);
      }

      GuiScreen.itemRender.renderItemAndEffectIntoGUI(
          super.fontRendererObj, mc.getTextureManager(), itemstack2, k + 120, l + 24);
      GuiScreen.itemRender.renderItemOverlayIntoGUI(
          super.fontRendererObj, mc.getTextureManager(), itemstack2, k + 120, l + 24);
      GuiScreen.itemRender.zLevel = 0.0F;
      GL11.glDisable(2896);
      if (this.isPointInRegion(36, 24, 16, 16, par1, par2)) {
        this.renderToolTip(itemstack, par1, par2);
      } else if (itemstack1 != null && this.isPointInRegion(62, 24, 16, 16, par1, par2)) {
        this.renderToolTip(itemstack1, par1, par2);
      } else if (this.isPointInRegion(120, 24, 16, 16, par1, par2)) {
        this.renderToolTip(itemstack2, par1, par2);
      }

      GL11.glPopMatrix();
      GL11.glEnable(2896);
      GL11.glEnable(2929);
      RenderHelper.enableStandardItemLighting();
    }
  }
  protected void drawItem(final int x, final int y, final ItemStack is) {
    this.zLevel = 100.0F;
    itemRender.zLevel = 100.0F;

    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    RenderHelper.enableGUIStandardItemLighting();
    itemRender.renderItemAndEffectIntoGUI(this.fontRendererObj, this.mc.renderEngine, is, x, y);
    GL11.glPopAttrib();

    itemRender.zLevel = 0.0F;
    this.zLevel = 0.0F;
  }
Example #16
0
  @Override
  protected void drawGuiContainerForegroundLayer(int curX, int curY) {
    String s = StatCollector.translateToLocal("tubes.requesting.name");
    fontRendererObj.drawString(s, xSize / 2 - fontRendererObj.getStringWidth(s) / 2, 6, 0x404040);
    fontRendererObj.drawString(
        StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 0x404040);

    super.drawGuiContainerForegroundLayer(curX, curY);

    int xx = curX - (width - xSize) / 2;
    int yy = curY - (height - ySize) / 2;

    int old = width;
    width -= (xx + curX);
    if (xx >= 153 && xx <= 167) {
      if (yy >= 19 && yy <= 33) {
        String text =
            StatCollector.translateToLocal("gui.requestingtube.mode." + mTube.getMode().name());
        drawHoveringText(Arrays.asList(text), xx, yy, fontRendererObj);
        RenderHelper.enableGUIStandardItemLighting();
      } else if (yy >= 35 && yy <= 49) {
        String text =
            StatCollector.translateToLocal("gui.requestingtube.size." + mTube.getSizeMode().name());
        drawHoveringText(Arrays.asList(text), xx, yy, fontRendererObj);
        RenderHelper.enableGUIStandardItemLighting();
      } else if (yy >= 51 && yy <= 65) {
        int colour = mTube.getColour();
        String text = StatCollector.translateToLocal("gui.colors.none");
        if (colour != -1) text = CommonHelper.getDyeName(colour);

        drawHoveringText(Arrays.asList(text), xx, yy, fontRendererObj);
        RenderHelper.enableGUIStandardItemLighting();
      }
    }
    width = old;
  }
Example #17
0
  public static void drawMultilineTip(int x, int y, List<String> list) {
    if (list.isEmpty()) return;

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    RenderHelper.disableStandardItemLighting();

    int w = 0;
    int h = -2;
    for (int i = 0; i < list.size(); i++) {
      String s = list.get(i);
      ITooltipLineHandler line = getTipLine(s);
      Dimension d =
          line != null
              ? line.getSize()
              : new Dimension(
                  getStringWidth(s),
                  list.get(i).endsWith(TOOLTIP_LINESPACE) && i + 1 < list.size() ? 12 : 10);
      w = Math.max(w, d.width);
      h += d.height;
    }

    if (x < 8) x = 8;
    else if (x > displaySize().width - w - 8) x -= 24 + w; // flip side of cursor
    y = (int) MathHelper.clip(y, 8, displaySize().height - 8 - h);

    gui.incZLevel(300);
    drawTooltipBox(x - 4, y - 4, w + 7, h + 7);
    for (String s : list) {
      ITooltipLineHandler line = getTipLine(s);
      if (line != null) {
        line.draw(x, y);
        y += line.getSize().height;
      } else {
        fontRenderer.drawStringWithShadow(s, x, y, -1);
        y += s.endsWith(TOOLTIP_LINESPACE) ? 12 : 10;
      }
    }

    tipLineHandlers.clear();
    gui.incZLevel(-300);

    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    RenderHelper.enableGUIStandardItemLighting();
  }
Example #18
0
  private void drawSlot(Minecraft mc, ItemStack stack, int x, int y) {
    RenderHelper.enableGUIStandardItemLighting();

    itemRender.renderItemIntoGUI(stack, x, y);
    RenderHelper.disableStandardItemLighting();
    //        itemRender.renderItemOverlayIntoGUI(mc.fontRendererObj, mc.getTextureManager(), stack,
    // x, y);
    //        GL11.glDisable(GL11.GL_LIGHTING);
    //        GL11.glEnable(GL11.GL_ALPHA_TEST);
    //        GL11.glEnable(GL11.GL_BLEND);

    if (stack.isItemEnchanted()) renderEffectSlot(mc.getTextureManager(), x - 1, y - 1);
    else {
      SAOGL.glBlend(true);
      SAOGL.glAlpha(true);
    }
  }
  @Override
  public void renderContentLayer(int localWidth, int localHeight) {
    manual.fonts.drawString("\u00a7nTool Station", localWidth + 60, localHeight + 4, 0);
    GL11.glScalef(2f, 2f, 2f);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    RenderHelper.enableGUIStandardItemLighting();

    ItemStack toolstack = TSClientRegistry.getManualIcon("ironpick");
    if (type.equals("weapon")) toolstack = TSClientRegistry.getManualIcon("ironlongsword");

    manual.renderitem.zLevel = 100;
    manual.renderitem.renderItemAndEffectIntoGUI(
        manual.fonts,
        manual.getMC().renderEngine,
        toolstack,
        (localWidth + 54) / 2,
        (localHeight + 54) / 2);
    manual.renderitem.renderItemAndEffectIntoGUI(
        manual.fonts,
        manual.getMC().renderEngine,
        icons[0],
        (localWidth + 130) / 2,
        (localHeight + 54) / 2);
    manual.renderitem.renderItemAndEffectIntoGUI(
        manual.fonts,
        manual.getMC().renderEngine,
        icons[1],
        (localWidth + 18) / 2,
        (localHeight + 36) / 2);
    if (icons[2] != null)
      manual.renderitem.renderItemAndEffectIntoGUI(
          manual.fonts,
          manual.getMC().renderEngine,
          icons[2],
          (localWidth + 18) / 2,
          (localHeight + 74) / 2);
    manual.renderitem.zLevel = 0;

    GL11.glScalef(0.5F, 0.5F, 0.5F);
    RenderHelper.disableStandardItemLighting();
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
  }
  @Override
  public void draw(
      GuiEntry entry,
      int width,
      int height,
      int left,
      int top,
      EntityPlayer player,
      String key,
      int page,
      int mX,
      int mY) {
    int x, y;

    GL11.glPushMatrix();
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(1F, 1F, 1F, 1F);
    RenderHelper.enableGUIStandardItemLighting();
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    renderOverlay(entry, width, height, left, top);

    x = left + width / 2 - (65 - 45);
    y = (height / 2 - 36) + (18 * (4 - 3));
    drawIcon(this.input, x, y);

    /** Result */
    x = left + width / 2 - (65 - (48 + 48) - 5);
    y = (height / 2 - 36) + (18 * (4 - 3));
    drawIcon(this.output, x, y);

    RenderHelper.disableStandardItemLighting();

    GL11.glDisable(GL11.GL_LIGHTING);

    GL11.glPopMatrix();

    for (ItemIcon icon : icons) {
      if (icon.stack != null) icon.onMouseBetween(mX, mY);
    }
  }
  private static void renderHUDOverlayItem(
      Minecraft minecraft, EntityPlayer entityPlayer, ItemStack itemStack) {
    float overlayScale = 2f;
    float overlayOpacity = 1f;
    GL11.glPushMatrix();
    ScaledResolution sr =
        new ScaledResolution(minecraft, minecraft.displayWidth, minecraft.displayHeight);
    GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(
        0.0D, sr.getScaledWidth_double(), sr.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    GL11.glTranslatef(0.0F, 0.0F, -2000.0F);
    GL11.glPushMatrix();
    RenderHelper.enableGUIStandardItemLighting();
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    GL11.glEnable(GL11.GL_LIGHTING);
    int hudOverlayX = 0;
    int hudOverlayY = 0;

    hudOverlayX = (int) (sr.getScaledWidth() - 16 * overlayScale);
    hudOverlayY = (int) (sr.getScaledHeight() - 16 * overlayScale);

    RenderUtils.renderItemIntoGUI(
        minecraft.fontRenderer,
        itemStack,
        hudOverlayX,
        hudOverlayY,
        overlayOpacity,
        overlayScale,
        -90);

    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glPopMatrix();
    GL11.glPopMatrix();
  }
Example #22
0
  protected void func_146979_b(int p_146979_1_, int p_146979_2_) {
    RenderHelper.disableStandardItemLighting();
    this.drawCenteredString(
        this.fontRendererObj, I18n.format("tile.beacon.primary", new Object[0]), 62, 10, 14737632);
    this.drawCenteredString(
        this.fontRendererObj,
        I18n.format("tile.beacon.secondary", new Object[0]),
        169,
        10,
        14737632);
    Iterator var3 = this.buttonList.iterator();

    while (var3.hasNext()) {
      GuiButton var4 = (GuiButton) var3.next();

      if (var4.func_146115_a()) {
        var4.func_146111_b(p_146979_1_ - this.field_147003_i, p_146979_2_ - this.field_147009_r);
        break;
      }
    }

    RenderHelper.enableGUIStandardItemLighting();
  }
Example #23
0
  @Override
  protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
    fontRendererObj.drawString(I18n.format("container.crafting") + " EX", 28, 6, 0x404040);
    fontRendererObj.drawString(I18n.format("container.inventory"), 8, ySize - 94, 0x404040);

    if (container.isRecipes()) {
      String str = container.getCurrentIndex() + 1 + " / " + container.getRecipeSize();
      recipesX = xSize - fontRendererObj.getStringWidth(str) - 10;
      recipesY = 6;
      fontRendererObj.drawString(str, recipesX, recipesY, 0x707070);
    }

    if (mouseX >= guiLeft && mouseX <= guiLeft + 20 && mouseY >= guiTop && mouseY <= guiTop + 20) {
      GlStateManager.pushMatrix();
      GlStateManager.scale(0.82F, 0.82F, 1.0F);
      RenderHelper.enableGUIStandardItemLighting();
      itemRender.zLevel = 100.0F;
      itemRender.renderItemAndEffectIntoGUI(CRAFTING_TABLE, 6, 6);
      itemRender.zLevel = 0.0F;
      RenderHelper.disableStandardItemLighting();
      GlStateManager.popMatrix();
    }
  }
Example #24
0
  /** Draw the background layer for the GuiContainer (everything behind the items) */
  @Override
  protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    RenderHelper.enableGUIStandardItemLighting();
    int var8 = tabList.size();
    var8 = Math.min(tabList.size(), (tabPage + 1) * 6);

    final int start = tabPage * 6;

    for (int n = start; n < var8; ++n) {
      final StorageTabs var10 = tabList.get(n);
      // this.mc.renderEngine.bindTexture("/gui/allitems.png"); // Calls
      // bindTexture

      if (var10 != null && n != selectedTabIndex && var8 - n < 7) {
        renderCreativeTab(var10, n);
      }
    }

    // this.mc.renderEngine.bindTexture("/gui/creative_inv/inv_storage.png");
    // // Calls bindTexture
    drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    final int var11 = guiLeft + 175;
    var8 = guiTop + 18;
    final int invHeight = ((ContainerStorage) inventorySlots).inventory.getSizeInventory() / 9 - 5;
    drawTexturedModalRect(
        var11,
        var8 + (int) (currentScroll / invHeight * 96),
        232 + (needsScrollBars() ? 0 : 12),
        0,
        12,
        15);
    if (tabList.size() > 0) {
      renderCreativeTab(tabList.get(selectedTabIndex), selectedTabIndex);
    }
  }
  @Override
  public void renderScreen(IGuiLexiconEntry gui, int mx, int my) {
    int x = gui.getLeft();
    int y = gui.getTop();
    int yOffPartial = 0;
    if (multiblock != null) {
      if (canTick) tick++;

      ItemStack[][][] structure = multiblock;
      int prevLayers = 0;
      if (showLayer != -1) for (int ll = 0; ll < showLayer; ll++) prevLayers += countPerLevel[ll];
      int limiter =
          prevLayers
              + (tick / 40) % ((showLayer == -1 ? blockCount : countPerLevel[showLayer]) + 4);

      int xHalf = (structureWidth * 5 - structureLength * 5);
      yOffPartial = (structureHeight - 1) * 12 + structureWidth * 5 + structureLength * 5 + 16;
      int yOffTotal = Math.max(48, yOffPartial + 16);

      GL11.glDisable(GL11.GL_DEPTH_TEST);
      GL11.glEnable(GL12.GL_RESCALE_NORMAL);
      RenderHelper.enableGUIStandardItemLighting();
      RenderItem.getInstance().renderWithColor = true;
      int i = 0;
      ItemStack highlighted = null;
      for (int h = 0; h < structure.length; h++)
        if (showLayer == -1 || h <= showLayer) {
          ItemStack[][] level = structure[h];
          for (int l = level.length - 1; l >= 0; l--) {
            ItemStack[] row = level[l];
            for (int w = row.length - 1; w >= 0; w--) {
              int xx = 60 + xHalf - 10 * w + 10 * l - 7;
              int yy = yOffPartial - 5 * w - 5 * l - 12 * h;
              GL11.glTranslated(0, 0, 1);
              if (row[w] != null && i <= limiter) {
                i++;
                RenderItem.getInstance()
                    .renderItemIntoGUI(
                        Minecraft.getMinecraft().fontRenderer,
                        Minecraft.getMinecraft().renderEngine,
                        row[w],
                        x + xx,
                        y + yy);
                if (mx >= x + xx && mx < x + xx + 16 && my >= y + yy && my < y + yy + 16)
                  highlighted = row[w];
              }
            }
          }
        }

      GL11.glTranslated(0, 0, -i);
      RenderHelper.disableStandardItemLighting();
      GL11.glDisable(GL12.GL_RESCALE_NORMAL);
      GL11.glEnable(GL11.GL_BLEND);
      GL11.glEnable(GL11.GL_DEPTH_TEST);

      Minecraft.getMinecraft().fontRenderer.setUnicodeFlag(false);
      if (highlighted != null) {
        ((GuiLexiconEntry) gui).renderToolTip(highlighted, mx, my);
      }
      RenderHelper.disableStandardItemLighting();
      /*
      Minecraft.getMinecraft().fontRenderer.setUnicodeFlag(true);
      if(localizedText!=null&&!localizedText.isEmpty())
          Minecraft.getMinecraft().fontRenderer.drawSplitString(localizedText, x,y+yOffTotal, 120, 0);
          */
    }

    int width = gui.getWidth() - 34;
    x = gui.getLeft() + 16;
    y = gui.getTop() + 10 + yOffPartial;

    renderText(x, y, width, getUnlocalizedName());
  }
  private void getcontent(int page) {
    RenderItem renderItem = new RenderItem();
    RenderHelper.enableGUIStandardItemLighting();

    switch (page) {
      case 0:
        this.fontRenderer.drawString("Table of Contents", 90, 45, 16777215);
        for (int p = 0; p < this.pages.size(); p++) {
          this.fontRenderer.drawString(
              "[" + p + "]: " + (String) this.pages.get(p), 20, 65 + p * 10, 16777215);
        }
        break;
      case 1:
        this.fontRenderer.drawString("Changelog V2.2.8.3.6", 90, 45, 16777215);
        this.fontRenderer.drawString("fix Coverter Powerloop", 20, 65, 16777215);
        this.fontRenderer.drawString("fix Textur Bug ", 20, 75, 16777215);
        this.fontRenderer.drawString("change ForceField -> ", 20, 85, 16777215);
        this.fontRenderer.drawString("touch damage system", 20, 95, 16777215);

        break;
      case 2:
        this.fontRenderer.drawString("Versions Check", 90, 45, 16777215);
        // TODO: FIX THIS
        this.fontRenderer.drawString(
            "Current Version: " + ModularForceFieldSystem.VERSION, 20, 65, 16777215);
        this.fontRenderer.drawString(
            "Newest Version : " + ModularForceFieldSystem.VERSION, 20, 75, 16777215);
        break;
      case 3:
        renderItem.renderItemIntoGUI(
            this.mc.fontRenderer,
            this.mc.renderEngine,
            new ItemStack(ModularForceFieldSystem.blockMonaziteOre),
            30,
            45);
        renderItem.renderItemIntoGUI(
            this.mc.fontRenderer,
            this.mc.renderEngine,
            new ItemStack(ModularForceFieldSystem.itemForcicium),
            30,
            65);
        renderItem.renderItemIntoGUI(
            this.mc.fontRenderer,
            this.mc.renderEngine,
            new ItemStack(ModularForceFieldSystem.itemForcicumCell),
            30,
            85);

        this.fontRenderer.drawString("Monazit Ore (Block/WorldGen)", 60, 50, 16777215);
        this.fontRenderer.drawString("Forcicium (Item/for Crafting)", 60, 70, 16777215);
        this.fontRenderer.drawString("Forcicium Cell (Item/from Crafting)", 60, 90, 16777215);

        this.fontRenderer.drawString("Monazite can be found between 80 and 0", 20, 105, 16777215);
        this.fontRenderer.drawString("Use furnace to get 4 Forcicium", 20, 115, 16777215);
        this.fontRenderer.drawString("Use IC Macerator to get 8 Forcicium", 20, 125, 16777215);
        this.fontRenderer.drawString("Forcicium Cell can store 1kForcicium", 20, 135, 16777215);
        this.fontRenderer.drawString("if in hand right click to activate", 20, 145, 16777215);
        this.fontRenderer.drawString("when active remove Forcicium from  ", 20, 155, 16777215);
        this.fontRenderer.drawString("Player Inventory and stores it", 20, 165, 16777215);
        break;
      case 4:
        renderItem.renderItemIntoGUI(
            this.mc.fontRenderer,
            this.mc.renderEngine,
            new ItemStack(ModularForceFieldSystem.itemCardEmpty),
            15,
            45);
        this.fontRenderer.drawString("Card <blank> get from Crafting stackable ", 35, 45, 16777215);
        this.fontRenderer.drawString("up to 16 need for create all Cards ", 35, 55, 16777215);

        renderItem.renderItemIntoGUI(
            this.mc.fontRenderer,
            this.mc.renderEngine,
            new ItemStack(ModularForceFieldSystem.itemCardPowerLink),
            15,
            95);
        renderItem.renderItemIntoGUI(
            this.mc.fontRenderer,
            this.mc.renderEngine,
            new ItemStack(ModularForceFieldSystem.blockCapacitor),
            35,
            105);
        renderItem.renderItemIntoGUI(
            this.mc.fontRenderer,
            this.mc.renderEngine,
            new ItemStack(ModularForceFieldSystem.itemCardEmpty),
            140,
            105);
        this.fontRenderer.drawString("Card <Power Link> get from right click", 35, 95, 16777215);
        this.fontRenderer.drawString("Capacitor with a ", 55, 110, 16777215);

        renderItem.renderItemIntoGUI(
            this.mc.fontRenderer,
            this.mc.renderEngine,
            new ItemStack(ModularForceFieldSystem.itemCardSecurityLink),
            15,
            145);
        this.fontRenderer.drawString("Card <Security Station Link> get from", 35, 145, 16777215);
        this.fontRenderer.drawString("right click", 35, 160, 16777215);
        renderItem.renderItemIntoGUI(
            this.mc.fontRenderer,
            this.mc.renderEngine,
            new ItemStack(ModularForceFieldSystem.blockSecurityStation),
            90,
            155);
        this.fontRenderer.drawString("SecurityStation with a ", 110, 160, 16777215);
        renderItem.renderItemIntoGUI(
            this.mc.fontRenderer,
            this.mc.renderEngine,
            new ItemStack(ModularForceFieldSystem.itemCardEmpty),
            220,
            155);

        break;
      case 5:
        renderItem.renderItemIntoGUI(
            this.mc.fontRenderer,
            this.mc.renderEngine,
            new ItemStack(ModularForceFieldSystem.itemCardAccess),
            15,
            45);
        this.fontRenderer.drawString("Card <Access license> create inside a  ", 35, 45, 16777215);
        renderItem.renderItemIntoGUI(
            this.mc.fontRenderer,
            this.mc.renderEngine,
            new ItemStack(ModularForceFieldSystem.blockSecurityStation),
            35,
            55);
        this.fontRenderer.drawString("SecurityStation with a", 55, 60, 16777215);
        renderItem.renderItemIntoGUI(
            this.mc.fontRenderer,
            this.mc.renderEngine,
            new ItemStack(ModularForceFieldSystem.itemCardEmpty),
            170,
            55);

        renderItem.renderItemIntoGUI(
            this.mc.fontRenderer,
            this.mc.renderEngine,
            new ItemStack(ModularForceFieldSystem.itemCardID),
            15,
            85);
        this.fontRenderer.drawString("Card <Personal ID> create with help  ", 35, 85, 16777215);
        renderItem.renderItemIntoGUI(
            this.mc.fontRenderer,
            this.mc.renderEngine,
            new ItemStack(ModularForceFieldSystem.itemMultiToolID),
            35,
            100);
        this.fontRenderer.drawString("MultiTool right click create self", 55, 98, 16777215);
        this.fontRenderer.drawString("or left click for another Player", 55, 110, 16777215);

        renderItem.renderItemIntoGUI(
            this.mc.fontRenderer,
            this.mc.renderEngine,
            new ItemStack(ModularForceFieldSystem.itemCardDataLink),
            15,
            125);
        this.fontRenderer.drawString("Card <Data Link> create with help  ", 35, 125, 16777215);
        renderItem.renderItemIntoGUI(
            this.mc.fontRenderer,
            this.mc.renderEngine,
            new ItemStack(ModularForceFieldSystem.itemMultiToolID),
            35,
            140);
        this.fontRenderer.drawString("MultiTool right click any ", 55, 138, 16777215);
        this.fontRenderer.drawString("MFFS Maschine ", 55, 150, 16777215);

        renderItem.renderItemIntoGUI(
            this.mc.fontRenderer,
            this.mc.renderEngine,
            new ItemStack(ModularForceFieldSystem.itemCardInfinite),
            15,
            165);
        this.fontRenderer.drawString("Admin Infinite Force Energy Card", 35, 170, 16777215);
    }

    RenderHelper.disableStandardItemLighting();
  }
Example #27
0
  @Override
  protected void paintWidget(GUI gui) {

    Minecraft minecraft = ModSettings.getMcinst();

    int x = getX();
    int y = getY();
    float scalex = 1f;
    float scaley = 1f;

    int maxWidth = getInnerWidth() - 4;
    int maxHeight = getInnerHeight() - 4;

    int scale = getScaleType();

    if ((scale == -1) && ((maxWidth < 16) || (maxHeight < 16))) {
      scale = 0;
    }

    switch (scale) {
      case 0:
        {
          // largest square
          int size = 0;
          if (maxWidth > maxHeight) {
            size = maxHeight;
          } else {
            size = maxWidth;
          }

          x += ((maxWidth - size) / 2);
          y += ((maxHeight - size) / 2);

          scalex = size / 16f;
          scaley = scalex;
          x /= scalex;
          y /= scaley;
          break;
        }

      case -1:
        {
          // default size in middle
          int size = maxWidth - 16;
          x += size / 2;

          size = maxHeight - 16;
          y += size / 2;
          break;
        }

      case 1:
        {
          // fill / stretch
          scalex = maxWidth / 16f;
          scaley = maxHeight / 16f;
          x /= scalex;
          y /= scaley;
          break;
        }
      default:
        throw new IndexOutOfBoundsException(
            "Scale Type is out of bounds! This should never happen!");
    }

    x += 2;
    y += 1;

    if ((minecraft == null) || (getRenderStack() == null) || (getRenderStack().getItem() == null)) {
      // draw black or something? Maybe NULL?
      return;
    }

    GuiWidgetScreen screen = GuiWidgetScreen.getInstance();
    screen.renderer.pauseRendering();

    screen.renderer.setClipRect();
    GL11.glEnable(GL11.GL_SCISSOR_TEST);
    GL11.glPushMatrix();
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(32826 /* GL_RESCALE_NORMAL_EXT */ /* GL_RESCALE_NORMAL_EXT */);
    RenderHelper.enableStandardItemLighting();
    RenderHelper.enableGUIStandardItemLighting();

    GL11.glScalef(scalex, scaley, 1);

    ItemStack stack = getRenderStack();

    Tessellator.instance.isDrawing = false;

    int stackBeforeDraw = GL11.glGetInteger(GL11.GL_MODELVIEW_STACK_DEPTH);
    try {

      WidgetItem2DRender.itemRenderer.renderItemIntoGUI(
          minecraft.fontRenderer, minecraft.renderEngine, stack, x, y);
      Tessellator.instance.isDrawing = false;
      WidgetItem2DRender.itemRenderer.renderItemOverlayIntoGUI(
          minecraft.fontRenderer, minecraft.renderEngine, stack, x, y);
      Tessellator.instance.isDrawing = false;
    } catch (Throwable e) {
      Tessellator.instance.isDrawing = false;
    }

    int stackAfterDraw = GL11.glGetInteger(GL11.GL_MODELVIEW_STACK_DEPTH);

    if (stackBeforeDraw != stackAfterDraw) {
      // Yes, this IS stuff to work around 'bad' mods :D
      for (int i = 0; i < (stackAfterDraw - stackBeforeDraw); i++) {
        GL11.glPopMatrix();
      }
    }

    RenderHelper.disableStandardItemLighting();
    GL11.glDisable(32826 /* GL_RESCALE_NORMAL_EXT */ /* GL_RESCALE_NORMAL_EXT */);

    GL11.glPopMatrix();
    GL11.glDisable(GL11.GL_SCISSOR_TEST);
    screen.renderer.resumeRendering();
  }
  @Override
  public void renderContentLayer(int localWidth, int localHeight, boolean isTranslatable) {
    String tStation = StatCollector.translateToLocal("manual.page.modifier1");
    if (icons.length > 3) tStation = StatCollector.translateToLocal("manual.page.modifier2");
    if (icons.length > 4) tStation = StatCollector.translateToLocal("manual.page.modifier3");
    if (isTranslatable) tStation = StatCollector.translateToLocal(tStation);
    manual.fonts.drawString("\u00a7n" + tStation, localWidth + 60, localHeight + 4, 0);
    GL11.glScalef(2f, 2f, 2f);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    RenderHelper.enableGUIStandardItemLighting();

    ItemStack toolstack = MantleClientRegistry.getManualIcon("ironpick");
    if (type.equals("weapon")) toolstack = MantleClientRegistry.getManualIcon("ironlongsword");
    if (type.equals("travelgoggles"))
      toolstack = MantleClientRegistry.getManualIcon("travelgoggles");
    if (type.equals("travelvest")) toolstack = MantleClientRegistry.getManualIcon("travelvest");
    if (type.equals("travelwings")) toolstack = MantleClientRegistry.getManualIcon("travelwings");
    if (type.equals("travelboots")) toolstack = MantleClientRegistry.getManualIcon("travelboots");
    if (type.equals("travelbelt")) toolstack = MantleClientRegistry.getManualIcon("travelbelt");
    if (type.equals("travelglove")) toolstack = MantleClientRegistry.getManualIcon("travelglove");
    if (type.equals("travelmulti")) toolstack = toolMulti[counter];

    // update displayed item
    if (iconsMulti != null
        && iconsMulti.length > 0
        && type.equals("travelmulti")
        && System.currentTimeMillis() - lastUpdate > 1000) {
      lastUpdate = System.currentTimeMillis();
      counter++;
      if (counter >= iconsMulti.length) counter = 0;
      icons = iconsMulti[counter];
      toolstack = toolMulti[counter];
    }

    manual.renderitem.zLevel = 100;
    if (icons.length < 4) {
      manual.renderitem.renderItemAndEffectIntoGUI(
          manual.fonts,
          manual.getMC().renderEngine,
          toolstack,
          (localWidth + 54) / 2,
          (localHeight + 54) / 2);
      manual.renderitem.renderItemAndEffectIntoGUI(
          manual.fonts,
          manual.getMC().renderEngine,
          icons[0],
          (localWidth + 130) / 2,
          (localHeight + 54) / 2);
      manual.renderitem.renderItemAndEffectIntoGUI(
          manual.fonts,
          manual.getMC().renderEngine,
          icons[1],
          (localWidth + 18) / 2,
          (localHeight + 36) / 2);
      if (icons[2] != null)
        manual.renderitem.renderItemAndEffectIntoGUI(
            manual.fonts,
            manual.getMC().renderEngine,
            icons[2],
            (localWidth + 18) / 2,
            (localHeight + 74) / 2);
    } else {
      manual.renderitem.renderItemAndEffectIntoGUI(
          manual.fonts,
          manual.getMC().renderEngine,
          toolstack,
          (localWidth + 74) / 2,
          (localHeight + 54) / 2);
      manual.renderitem.renderItemAndEffectIntoGUI(
          manual.fonts,
          manual.getMC().renderEngine,
          icons[0],
          (localWidth + 140) / 2,
          (localHeight + 54) / 2);
      manual.renderitem.renderItemAndEffectIntoGUI(
          manual.fonts,
          manual.getMC().renderEngine,
          icons[1],
          (localWidth - 2) / 2,
          (localHeight + 36) / 2);
      manual.renderitem.renderItemAndEffectIntoGUI(
          manual.fonts,
          manual.getMC().renderEngine,
          icons[2],
          (localWidth - 2) / 2,
          (localHeight + 74) / 2);
      manual.renderitem.renderItemAndEffectIntoGUI(
          manual.fonts,
          manual.getMC().renderEngine,
          icons[3],
          (localWidth + 36) / 2,
          (localHeight + 36) / 2);
      if (icons[4] != null)
        manual.renderitem.renderItemAndEffectIntoGUI(
            manual.fonts,
            manual.getMC().renderEngine,
            icons[4],
            (localWidth + 36) / 2,
            (localHeight + 74) / 2);
    }
    manual.renderitem.zLevel = 0;

    GL11.glScalef(0.5F, 0.5F, 0.5F);
    RenderHelper.disableStandardItemLighting();
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
  }
Example #29
0
  protected void genAchievementBackground(int par1, int par2, float par3) {
    int var4 =
        MathHelper.floor_double(
            this.field_74117_m + (this.guiMapX - this.field_74117_m) * (double) par3);
    int var5 =
        MathHelper.floor_double(
            this.field_74115_n + (this.guiMapY - this.field_74115_n) * (double) par3);

    if (var4 < guiMapTop) {
      var4 = guiMapTop;
    }

    if (var5 < guiMapLeft) {
      var5 = guiMapLeft;
    }

    if (var4 >= guiMapBottom) {
      var4 = guiMapBottom - 1;
    }

    if (var5 >= guiMapRight) {
      var5 = guiMapRight - 1;
    }

    int var6 = this.mc.renderEngine.getTexture("/terrain.png");
    int var7 = this.mc.renderEngine.getTexture("/achievement/bg.png");
    int var8 = (this.width - this.achievementsPaneWidth) / 2;
    int var9 = (this.height - this.achievementsPaneHeight) / 2;
    int var10 = var8 + 16;
    int var11 = var9 + 17;
    this.zLevel = 0.0F;
    GL11.glDepthFunc(GL11.GL_GEQUAL);
    GL11.glPushMatrix();
    GL11.glTranslatef(0.0F, 0.0F, -200.0F);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    this.mc.renderEngine.bindTexture(var6);
    int var12 = var4 + 288 >> 4;
    int var13 = var5 + 288 >> 4;
    int var14 = (var4 + 288) % 16;
    int var15 = (var5 + 288) % 16;
    Random var21 = new Random();
    int var22;
    int var25;
    int var24;
    int var26;

    for (var22 = 0; var22 * 16 - var15 < 155; ++var22) {
      float var23 = 0.6F - (float) (var13 + var22) / 25.0F * 0.3F;
      GL11.glColor4f(var23, var23, var23, 1.0F);

      for (var24 = 0; var24 * 16 - var14 < 224; ++var24) {
        var21.setSeed((long) (1234 + var12 + var24));
        var21.nextInt();
        var25 = var21.nextInt(1 + var13 + var22) + (var13 + var22) / 2;
        var26 = Block.sand.blockIndexInTexture;

        if (var25 <= 37 && var13 + var22 != 35) {
          if (var25 == 22) {
            if (var21.nextInt(2) == 0) {
              var26 = Block.oreDiamond.blockIndexInTexture;
            } else {
              var26 = Block.oreRedstone.blockIndexInTexture;
            }
          } else if (var25 == 10) {
            var26 = Block.oreIron.blockIndexInTexture;
          } else if (var25 == 8) {
            var26 = Block.oreCoal.blockIndexInTexture;
          } else if (var25 > 4) {
            var26 = Block.stone.blockIndexInTexture;
          } else if (var25 > 0) {
            var26 = Block.dirt.blockIndexInTexture;
          }
        } else {
          var26 = Block.bedrock.blockIndexInTexture;
        }

        this.drawTexturedModalRect(
            var10 + var24 * 16 - var14,
            var11 + var22 * 16 - var15,
            var26 % 16 << 4,
            var26 >> 4 << 4,
            16,
            16);
      }
    }

    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    int var27;
    int var30;
    List<Achievement> achievementList =
        (currentPage == -1
            ? minecraftAchievements
            : AchievementPage.getAchievementPage(currentPage).getAchievements());

    for (var22 = 0; var22 < achievementList.size(); ++var22) {
      Achievement var33 = achievementList.get(var22);

      if (var33.parentAchievement != null && achievementList.contains(var33.parentAchievement)) {
        var24 = var33.displayColumn * 24 - var4 + 11 + var10;
        var25 = var33.displayRow * 24 - var5 + 11 + var11;
        var26 = var33.parentAchievement.displayColumn * 24 - var4 + 11 + var10;
        var27 = var33.parentAchievement.displayRow * 24 - var5 + 11 + var11;
        boolean var28 = this.statFileWriter.hasAchievementUnlocked(var33);
        boolean var29 = this.statFileWriter.canUnlockAchievement(var33);
        var30 =
            Math.sin((double) (Minecraft.getSystemTime() % 600L) / 600.0D * Math.PI * 2.0D) > 0.6D
                ? 255
                : 130;
        int var31 = -16777216;

        if (var28) {
          var31 = -9408400;
        } else if (var29) {
          var31 = 65280 + (var30 << 24);
        }

        this.drawHorizontalLine(var24, var26, var25, var31);
        this.drawVerticalLine(var26, var25, var27, var31);
      }
    }

    Achievement var32 = null;
    RenderItem var37 = new RenderItem();
    RenderHelper.enableGUIStandardItemLighting();
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    int var42;
    int var41;

    for (var24 = 0; var24 < achievementList.size(); ++var24) {
      Achievement var35 = achievementList.get(var24);
      var26 = var35.displayColumn * 24 - var4;
      var27 = var35.displayRow * 24 - var5;

      if (var26 >= -24 && var27 >= -24 && var26 <= 224 && var27 <= 155) {
        float var38;

        if (this.statFileWriter.hasAchievementUnlocked(var35)) {
          var38 = 1.0F;
          GL11.glColor4f(var38, var38, var38, 1.0F);
        } else if (this.statFileWriter.canUnlockAchievement(var35)) {
          var38 =
              Math.sin((double) (Minecraft.getSystemTime() % 600L) / 600.0D * Math.PI * 2.0D) < 0.6D
                  ? 0.6F
                  : 0.8F;
          GL11.glColor4f(var38, var38, var38, 1.0F);
        } else {
          var38 = 0.3F;
          GL11.glColor4f(var38, var38, var38, 1.0F);
        }

        this.mc.renderEngine.bindTexture(var7);
        var42 = var10 + var26;
        var41 = var11 + var27;

        if (var35.getSpecial()) {
          this.drawTexturedModalRect(var42 - 2, var41 - 2, 26, 202, 26, 26);
        } else {
          this.drawTexturedModalRect(var42 - 2, var41 - 2, 0, 202, 26, 26);
        }

        if (!this.statFileWriter.canUnlockAchievement(var35)) {
          float var40 = 0.1F;
          GL11.glColor4f(var40, var40, var40, 1.0F);
          var37.field_77024_a = false;
        }

        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_CULL_FACE);
        var37.renderItemAndEffectIntoGUI(
            this.mc.fontRenderer, this.mc.renderEngine, var35.theItemStack, var42 + 3, var41 + 3);
        GL11.glDisable(GL11.GL_LIGHTING);

        if (!this.statFileWriter.canUnlockAchievement(var35)) {
          var37.field_77024_a = true;
        }

        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

        if (par1 >= var10
            && par2 >= var11
            && par1 < var10 + 224
            && par2 < var11 + 155
            && par1 >= var42
            && par1 <= var42 + 22
            && par2 >= var41
            && par2 <= var41 + 22) {
          var32 = var35;
        }
      }
    }

    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.renderEngine.bindTexture(var7);
    this.drawTexturedModalRect(
        var8, var9, 0, 0, this.achievementsPaneWidth, this.achievementsPaneHeight);
    GL11.glPopMatrix();
    this.zLevel = 0.0F;
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    super.drawScreen(par1, par2, par3);

    if (var32 != null) {
      String var34 = StatCollector.translateToLocal(var32.getName());
      String var36 = var32.getDescription();
      var26 = par1 + 12;
      var27 = par2 - 4;

      if (this.statFileWriter.canUnlockAchievement(var32)) {
        var42 = Math.max(this.fontRenderer.getStringWidth(var34), 120);
        var41 = this.fontRenderer.splitStringWidth(var36, var42);

        if (this.statFileWriter.hasAchievementUnlocked(var32)) {
          var41 += 12;
        }

        this.drawGradientRect(
            var26 - 3,
            var27 - 3,
            var26 + var42 + 3,
            var27 + var41 + 3 + 12,
            -1073741824,
            -1073741824);
        this.fontRenderer.drawSplitString(var36, var26, var27 + 12, var42, -6250336);

        if (this.statFileWriter.hasAchievementUnlocked(var32)) {
          this.fontRenderer.drawStringWithShadow(
              StatCollector.translateToLocal("achievement.taken"),
              var26,
              var27 + var41 + 4,
              -7302913);
        }
      } else {
        var42 = Math.max(this.fontRenderer.getStringWidth(var34), 120);
        String var39 =
            StatCollector.translateToLocalFormatted(
                "achievement.requires",
                new Object[] {StatCollector.translateToLocal(var32.parentAchievement.getName())});
        var30 = this.fontRenderer.splitStringWidth(var39, var42);
        this.drawGradientRect(
            var26 - 3,
            var27 - 3,
            var26 + var42 + 3,
            var27 + var30 + 12 + 3,
            -1073741824,
            -1073741824);
        this.fontRenderer.drawSplitString(var39, var26, var27 + 12, var42, -9416624);
      }

      this.fontRenderer.drawStringWithShadow(
          var34,
          var26,
          var27,
          this.statFileWriter.canUnlockAchievement(var32)
              ? (var32.getSpecial() ? -128 : -1)
              : (var32.getSpecial() ? -8355776 : -8355712));
    }

    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_LIGHTING);
    RenderHelper.disableStandardItemLighting();
  }
Example #30
0
  @Override
  @SideOnly(Side.CLIENT)
  public void draw(
      Book book,
      CategoryAbstract category,
      EntryAbstract entry,
      int guiLeft,
      int guiTop,
      int mouseX,
      int mouseY,
      GuiBase guiBase,
      FontRenderer fontRenderer) {
    //    	if(multiblock.getStructureManual()!=null)
    Minecraft mc = Minecraft.getMinecraft();

    int x = guiLeft + 32;
    int y = guiTop + 30;
    {
      if (canTick) tick++;

      int prevLayers = 0;
      if (showLayer != -1) for (int ll = 0; ll < showLayer; ll++) prevLayers += countPerLevel[ll];
      int limiter =
          prevLayers
              + (tick / 40) % ((showLayer == -1 ? blockCount : countPerLevel[showLayer]) + 4);

      int xHalf = (structureWidth * 5 - structureLength * 5);
      int yOffPartial = (structureHeight - 1) * 12 + structureWidth * 5 + structureLength * 5;
      //			int yOffTotal = yOffPartial+16;

      GL11.glDisable(GL11.GL_DEPTH_TEST);

      GL11.glPushMatrix();
      GL11.glTranslatef((1 - scaleFactor) * (guiLeft + 64), (1 - scaleFactor) * (guiTop + 60), 0);
      GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
      GL11.glEnable(GL12.GL_RESCALE_NORMAL);
      RenderHelper.enableGUIStandardItemLighting();
      RenderItem.getInstance().renderWithColor = true;
      int i = 0;
      ItemStack highlighted = null;
      for (int h = 0; h < structure.length; h++)
        if (showLayer == -1 || h <= showLayer) {
          ItemStack[][] level = structure[h];
          for (int l = level.length - 1; l >= 0; l--) {
            ItemStack[] row = level[l];
            for (int w = row.length - 1; w >= 0; w--) {
              int xx = 60 + xHalf - 10 * w + 10 * l - 7;
              int yy = yOffPartial - 5 * w - 5 * l - 12 * h;
              GL11.glTranslated(0, 0, 1);
              if (row[w] != null && i <= limiter) {
                i++;
                RenderItem.getInstance()
                    .renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, row[w], x + xx, y + yy);
                if (mouseX >= x + xx
                    && mouseX < x + xx + 16
                    && mouseY >= y + yy
                    && mouseY < y + yy + 16) highlighted = row[w];
              }
            }
          }
        }
      GL11.glTranslated(0, 0, -i);
      RenderHelper.disableStandardItemLighting();
      GL11.glDisable(GL12.GL_RESCALE_NORMAL);
      GL11.glPopMatrix();

      GL11.glEnable(GL11.GL_BLEND);
      GL11.glEnable(GL11.GL_DEPTH_TEST);

      mc.fontRenderer.setUnicodeFlag(false);
      if (highlighted != null && renderMouseOver)
        guiBase.renderToolTip(highlighted, mouseX, mouseY);
      RenderHelper.disableStandardItemLighting();

      //			mc.fontRenderer.setUnicodeFlag(true);
      //			if(localizedText!=null&&!localizedText.isEmpty())
      //				manual.fontRenderer.drawSplitString(localizedText, x,y+yOffTotal, 120,
      // manual.getTextColour());
    }
  }