Пример #1
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();
    }
  }
Пример #2
0
 /** Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks */
 public void drawScreen(int mouseX, int mouseY, float partialTicks) {
   this.drawDefaultBackground();
   int i = (this.width - 248) / 2 + 10;
   int j = (this.height - 166) / 2 + 8;
   this.fontRendererObj.drawString(I18n.format("demo.help.title", new Object[0]), i, j, 2039583);
   j = j + 12;
   GameSettings gamesettings = this.mc.gameSettings;
   this.fontRendererObj.drawString(
       I18n.format(
           "demo.help.movementShort",
           new Object[] {
             GameSettings.getKeyDisplayString(gamesettings.keyBindForward.getKeyCode()),
             GameSettings.getKeyDisplayString(gamesettings.keyBindLeft.getKeyCode()),
             GameSettings.getKeyDisplayString(gamesettings.keyBindBack.getKeyCode()),
             GameSettings.getKeyDisplayString(gamesettings.keyBindRight.getKeyCode())
           }),
       i,
       j,
       5197647);
   this.fontRendererObj.drawString(
       I18n.format("demo.help.movementMouse", new Object[0]), i, j + 12, 5197647);
   this.fontRendererObj.drawString(
       I18n.format(
           "demo.help.jump",
           new Object[] {GameSettings.getKeyDisplayString(gamesettings.keyBindJump.getKeyCode())}),
       i,
       j + 24,
       5197647);
   this.fontRendererObj.drawString(
       I18n.format(
           "demo.help.inventory",
           new Object[] {
             GameSettings.getKeyDisplayString(gamesettings.keyBindInventory.getKeyCode())
           }),
       i,
       j + 36,
       5197647);
   this.fontRendererObj.drawSplitString(
       I18n.format("demo.help.fullWrapped", new Object[0]), i, j + 68, 218, 2039583);
   super.drawScreen(mouseX, mouseY, partialTicks);
 }