Exemplo n.º 1
0
 @Override
 public void uploadKeyBindingsToGame() {
   GameSettings settings = Minecraft.getMinecraft().gameSettings;
   KeyBinding[] tfcKeyBindings = KeyBindings.gatherKeyBindings();
   KeyBinding[] allKeys = new KeyBinding[settings.keyBindings.length + tfcKeyBindings.length];
   System.arraycopy(settings.keyBindings, 0, allKeys, 0, settings.keyBindings.length);
   System.arraycopy(
       tfcKeyBindings, 0, allKeys, settings.keyBindings.length, tfcKeyBindings.length);
   settings.keyBindings = allKeys;
   settings.loadOptions();
 }
Exemplo n.º 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();
    }
  }
Exemplo n.º 3
0
  /** Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). */
  protected void keyTyped(char p_73869_1_, int p_73869_2_) {
    if (!CreativeTabs.creativeTabArray[selectedTabIndex].hasSearchBar()) {
      if (GameSettings.isKeyDown(this.mc.gameSettings.keyBindChat)) {
        this.setCurrentCreativeTab(CreativeTabs.tabAllSearch);
      } else {
        super.keyTyped(p_73869_1_, p_73869_2_);
      }
    } else {
      if (this.field_147057_D) {
        this.field_147057_D = false;
        this.searchField.setText("");
      }

      if (!this.checkHotbarKeys(p_73869_2_)) {
        if (this.searchField.textboxKeyTyped(p_73869_1_, p_73869_2_)) {
          this.updateCreativeSearch();
        } else {
          super.keyTyped(p_73869_1_, p_73869_2_);
        }
      }
    }
  }
Exemplo n.º 4
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);
 }