Exemplo n.º 1
0
  @Override
  protected void drawGuiContainerForegroundLayer(int rawMouseX, int rawMouseY) {
    // Draw text
    if (shouldDrawTitle && title != null) {
      getFontRenderer()
          .drawString(
              I18n.format(title),
              RenderUtils.getCenteredTextOffset(
                  getFontRenderer(), I18n.format(title), getGuiWidth()),
              6,
              0x404040);
    }

    // Draw components
    drawComponents(true, rawMouseX, rawMouseY, 0);
  }
Exemplo n.º 2
0
  @Override
  protected void drawGuiContainerBackgroundLayer(float partialTicks, int rawMouseX, int rawMouseY) {
    // Draw background
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    if (texture != null) {
      RenderUtils.bindTexture(texture);
      int xStart = (getScreenWidth() - getGuiWidth()) / 2;
      int yStart = (getScreenHeight() - getGuiHeight()) / 2;
      this.drawTexturedModalRect(xStart, yStart, 0, 0, getGuiWidth(), getGuiHeight());
    }

    // Draw components
    GL11.glPushMatrix();
    GL11.glTranslatef(getGuiPositionX(), getGuiPositionY(), 0.0F);
    drawComponents(false, rawMouseX, rawMouseY, partialTicks);
    GL11.glPopMatrix();
  }
  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();
  }