@SubscribeEvent
  public void renderOverlay(RenderGameOverlayEvent.Post event) {
    Profiler profiler = mc.mcProfiler;
    EntityPlayer player = mc.thePlayer;
    ItemStack hand = player.getCurrentEquippedItem();
    MovingObjectPosition pos = mc.objectMouseOver;
    if (event.type == RenderGameOverlayEvent.ElementType.CROSSHAIRS) {
      profiler.startSection(Augment.MOD_ID + "-hud");

      VigorData data = AugmentAPI.vigorRegistry.getPlayerData(player);
      if (data != null && displayVigor(player)) {
        profiler.startSection(Augment.MOD_ID + "-vigorBar");
        renderVigorHud(event.resolution, data);
        profiler.endSection();
      }

      if (AugConfig.showBookToolTip && hand != null && hand.getItem() == ModItems.manual) {
        profiler.startSection(Augment.MOD_ID + "-bookToolTip");
        if (pos != null
            && pos.getBlockPos() != null
            && mc.theWorld != null
            && !mc.theWorld.isAirBlock(pos.getBlockPos())) {
          IBlockState state = mc.theWorld.getBlockState(pos.getBlockPos());
          if (state != null && state.getBlock() instanceof IItemPage) {
            ItemStack stack =
                new ItemStack(state.getBlock(), 1, state.getBlock().getMetaFromState(state));
            renderBookOverlay(event.resolution, stack, (IItemPage) state.getBlock());
          }
        }
        profiler.endSection();
      }

      profiler.endSection();
    }
  }
Пример #2
0
  @SubscribeEvent
  public void onRenderGameOverlayPost(Post event) {
    if (event.type == ElementType.ALL) {

      Minecraft mc = Minecraft.getMinecraft();
      FontRenderer fr = mc.fontRenderer;
      Profiler p = mc.mcProfiler;
      p.startSection("gimmetime-hud");

      switch (ConfigHandler.analog_digital) {
        case 0: // None
          break;
        case 1: // Analog
          p.startSection("clock");
          RenderUtil.drawClock(32, 34, 24);
          p.endSection();
          break;
        case 2: // Digital
          p.startSection("clock");
          drawString(TimeUtil.getTime(), 1, 1);
          p.endSection();
          break;
        case 3: // Both
          p.startSection("clock");
          RenderUtil.drawClock(32, 34, 24);
          drawString(TimeUtil.getTime(), 64, 1);
          p.endSection();
          break;
      }

      if (currentAlarm != null) {
        p.startSection("alarm");
        String title = currentAlarm.getTitle() + " - " + TimeUtil.getAlarmTimeString();
        drawString(
            title,
            (event.resolution.getScaledWidth() / 2) - (fr.getStringWidth(title) / 2),
            (event.resolution.getScaledHeight() / 2) - (fr.FONT_HEIGHT + 4));
        String closeHint =
            StatCollector.translateToLocalFormatted(
                "hud.alarmAlert.close",
                GameSettings.getKeyDisplayString(KeyHandler.INSTANCE.clock.getKeyCode()));
        drawString(
            closeHint,
            (event.resolution.getScaledWidth() / 2) - (fr.getStringWidth(closeHint) / 2),
            (event.resolution.getScaledHeight() / 2) + (fr.FONT_HEIGHT - 2));
        p.endSection();
      }

      p.endSection();
    }
  }
  public static void dispatch() {
    Profiler profiler = ClientUtils.mc().mcProfiler;
    profiler.startSection(ImmersiveEngineering.MODID + "-particles");

    boolean isLightingEnabled = GL11.glGetBoolean(GL11.GL_LIGHTING);
    GL11.glDepthMask(false);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_LIGHTING);

    for (String key : EntityFXIEBase.queuedRenders.keySet()) {
      profiler.endStartSection(key);
      int i = 0;
      ClientUtils.tes().startDrawingQuads();
      for (EntityFXIEBase particle : EntityFXIEBase.queuedRenders.get(key)) {
        if ((i++) == 0)
          ClientUtils.mc().getTextureManager().bindTexture(particle.getParticleTexture());
        particle.tessellateFromQueue(ClientUtils.tes());
      }
      ClientUtils.tes().draw();
    }
    EntityFXIEBase.queuedRenders.clear();

    profiler.startSection("depthIgnoring");
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    for (String key : EntityFXIEBase.queuedDepthIgnoringRenders.keySet()) {
      profiler.endStartSection(key);
      int i = 0;
      ClientUtils.tes().startDrawingQuads();
      for (EntityFXIEBase particle : EntityFXIEBase.queuedDepthIgnoringRenders.get(key)) {
        if ((i++) == 0)
          ClientUtils.mc().getTextureManager().bindTexture(particle.getParticleTexture());
        particle.tessellateFromQueue(ClientUtils.tes());
      }
      ClientUtils.tes().draw();
    }
    EntityFXIEBase.queuedDepthIgnoringRenders.clear();
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    profiler.endSection();

    if (!isLightingEnabled) GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);

    profiler.endSection();
  }