@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();
  }
 private void renderBookOverlay(ScaledResolution resolution, ItemStack stack, IItemPage page) {
   int sx = resolution.getScaledWidth() / 2 - 17;
   int sy = resolution.getScaledHeight() / 2 + 2;
   mc.getRenderItem().renderItemIntoGUI(new ItemStack(ModItems.manual), sx + 20, sy - 16);
   if (mc.thePlayer.isSneaking()) {
     GlStateManager.pushMatrix();
     GlStateManager.color(1f, 1f, 1f);
     mc.fontRendererObj.drawStringWithShadow(stack.getDisplayName(), sx + 39, sy - 13, 0x00BFFF);
     mc.fontRendererObj.drawStringWithShadow(
         EnumChatFormatting.ITALIC + LangUtil.translate(page.worldDescription(stack)),
         sx + 39,
         sy - 4,
         0xBABABA);
     GlStateManager.color(1f, 1f, 1f);
     GlStateManager.popMatrix();
   } else {
     GlStateManager.pushMatrix();
     GlStateManager.scale(0.5, 0.5, 0.5);
     GlStateManager.translate((sx * 2) + 45, (sy * 2) + 2, 0);
     GlStateManager.color(1f, 1f, 1f);
     mc.fontRendererObj.drawStringWithShadow(
         LangUtil.translate("gui.augmentedaccessories.hud.shift"), 0, 0, 0xFFFFFF);
     GlStateManager.color(1f, 1f, 1f);
     GlStateManager.popMatrix();
   }
 }
Beispiel #3
0
 public GuiIngame(Minecraft mcIn) {
   // TODO t
   keyStates = new boolean[256];
   this.mc = mcIn;
   this.itemRenderer = mcIn.getRenderItem();
   this.overlayDebug = new GuiOverlayDebug(mcIn);
   this.field_175197_u = new GuiSpectator(mcIn);
   this.persistantChatGUI = new GuiNewChat(mcIn);
   this.streamIndicator = new GuiStreamIndicator(mcIn);
   this.overlayPlayerList = new GuiPlayerTabOverlay(mcIn, this);
   this.func_175177_a();
 }
Beispiel #4
0
  /**
   * Called to initialize and setup everything. TODO: This should be handled better if possible.
   *
   * @param minecraft Minecraft instance.
   * @param width New window width.
   * @param height New window height.
   */
  @Override
  public void setWorldAndResolution(Minecraft minecraft, int width, int height) {
    this.mc = minecraft;
    this.itemRender = minecraft.getRenderItem();
    this.fontRenderer = minecraft.fontRendererObj;
    this.width = width;
    this.height = height;
    if (!MinecraftForge.EVENT_BUS.post(new GUIScreenEvent.InitGuiEvent.Pre(this))) {
      this.initGui();
    }

    MinecraftForge.EVENT_BUS.post(new GUIScreenEvent.InitGuiEvent.Post(this));
  }
Beispiel #5
0
 /**
  * Causes the screen to lay out its subcomponents again. This is the equivalent of the Java call
  * Container.validate()
  */
 public void setWorldAndResolution(Minecraft mc, int width, int height) {
   this.mc = mc;
   this.itemRender = mc.getRenderItem();
   this.fontRendererObj = mc.fontRendererObj;
   this.width = width;
   this.height = height;
   if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(
       new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Pre(
           this, this.buttonList))) {
     this.buttonList.clear();
     this.initGui();
   }
   net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(
       new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Post(
           this, this.buttonList));
 }