Ejemplo n.º 1
0
  /**
   * Fired when a control is clicked. This is the equivalent of
   * ActionListener.actionPerformed(ActionEvent e).
   */
  protected void actionPerformed(GuiButton par1GuiButton) {
    if (par1GuiButton.enabled) {
      if (par1GuiButton.id == 5) {
        if (Minecraft.getOs() == EnumOS.MACOS) {
          try {
            this.mc.getLogAgent().logInfo(this.fileLocation);
            Runtime.getRuntime().exec(new String[] {"/usr/bin/open", this.fileLocation});
            return;
          } catch (IOException var7) {
            var7.printStackTrace();
          }
        } else if (Minecraft.getOs() == EnumOS.WINDOWS) {
          String var2 =
              String.format(
                  "cmd.exe /C start \"Open file\" \"%s\"", new Object[] {this.fileLocation});

          try {
            Runtime.getRuntime().exec(var2);
            return;
          } catch (IOException var6) {
            var6.printStackTrace();
          }
        }

        boolean var8 = false;

        try {
          Class var3 = Class.forName("java.awt.Desktop");
          Object var4 =
              var3.getMethod("getDesktop", new Class[0]).invoke((Object) null, new Object[0]);
          var3.getMethod("browse", new Class[] {URI.class})
              .invoke(
                  var4,
                  new Object[] {(new File(Minecraft.getMinecraftDir(), "texturepacks")).toURI()});
        } catch (Throwable var5) {
          var5.printStackTrace();
          var8 = true;
        }

        if (var8) {
          this.mc.getLogAgent().logInfo("Opening via system class!");
          Sys.openURL("file://" + this.fileLocation);
        }
      } else if (par1GuiButton.id == 6) {
        this.mc.displayGuiScreen(this.guiScreen);
      } else {
        this.guiTexturePackSlot.actionPerformed(par1GuiButton);
      }
    }
  }
Ejemplo n.º 2
0
 /** Adds the buttons (and other controls) to the screen in question. */
 public void initGui() {
   StringTranslate var1 = StringTranslate.getInstance();
   this.buttonList.add(
       new GuiFancyButton(
           5,
           this.width / 2 - 74,
           this.height - 48,
           var1.translateKey("texturePack.openFolder"),
           3));
   this.buttonList.add(
       new GuiFancyButton(
           6, this.width / 2 + 74, this.height - 48, var1.translateKey("gui.done"), 3));
   this.mc.texturePackList.updateAvaliableTexturePacks();
   this.fileLocation = (new File(Minecraft.getMinecraftDir(), "texturepacks")).getAbsolutePath();
   this.guiTexturePackSlot = new GuiFancyTexturePackSlot(this);
   this.guiTexturePackSlot.registerScrollButtons(this.buttonList, 7, 8);
   bg = new GuiFancyRotatingBackground(mc, width, height, zLevel);
 }
Ejemplo n.º 3
0
  public GuiMainMenu() {
    field_96141_q = true;
    splashText = "missingno";
    BufferedReader bufferedreader = null;

    try {
      ArrayList arraylist = new ArrayList();
      bufferedreader =
          new BufferedReader(
              new InputStreamReader(
                  Minecraft.getMinecraft()
                      .func_110442_L()
                      .func_110536_a(field_110353_x)
                      .func_110527_b(),
                  Charsets.UTF_8));

      do {
        String s1;

        if ((s1 = bufferedreader.readLine()) == null) {
          break;
        }

        s1 = s1.trim();

        if (!s1.isEmpty()) {
          arraylist.add(s1);
        }
      } while (true);

      do {
        splashText = (String) arraylist.get(rand.nextInt(arraylist.size()));
      } while (splashText.hashCode() == 0x77f432f);
    } catch (IOException ioexception) {
    } finally {
      if (bufferedreader != null) {
        try {
          bufferedreader.close();
        } catch (IOException ioexception1) {
        }
      }
    }

    updateCounter = rand.nextFloat();
    updateCounter2 = updateCounter;
    field_92025_p = "";
    String s = System.getProperty("os_architecture");
    String s2 = System.getProperty("java_version");

    if ("ppc".equalsIgnoreCase(s)) {
      field_92025_p =
          (new StringBuilder())
              .append("")
              .append(EnumChatFormatting.BOLD)
              .append("Notice!")
              .append(EnumChatFormatting.RESET)
              .append(" PowerPC compatibility will be dropped in Minecraft 1.6")
              .toString();
      field_104024_v = "http://tinyurl.com/javappc";
    } else if (s2 != null && s2.startsWith("1.5")) {
      field_92025_p =
          (new StringBuilder())
              .append("")
              .append(EnumChatFormatting.BOLD)
              .append("Notice!")
              .append(EnumChatFormatting.RESET)
              .append(" Java 1.5 compatibility will be dropped in Minecraft 1.6")
              .toString();
      field_104024_v = "http://tinyurl.com/javappc";
    }
  }
Ejemplo n.º 4
0
  /** Draws the screen and all the components in it. */
  public void drawScreen(int par1, int par2, float par3) {
    if (panorama) {
      renderSkybox(par1, par2, par3);
    } else {
      drawDefaultBackground();
    }
    Tessellator tessellator = Tessellator.instance;
    if (oldlogo) {
      drawLogo(par3);
    }
    char c = 274;
    int i = width / 2 - c / 2;
    byte byte0 = 30;
    if (panorama) {
      drawGradientRect(0, 0, width, height, 0x80ffffff, 0xffffff);
      drawGradientRect(0, 0, width, height, 0, 0x80000000);
    }
    if (!oldlogo) {
      mc.func_110434_K().func_110577_a(field_110352_y);
      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

      if ((double) updateCounter < 0.0001D) {
        drawTexturedModalRect(i + 0, byte0 + 0, 0, 0, 99, 44);
        drawTexturedModalRect(i + 99, byte0 + 0, 129, 0, 27, 44);
        drawTexturedModalRect(i + 99 + 26, byte0 + 0, 126, 0, 3, 44);
        drawTexturedModalRect(i + 99 + 26 + 3, byte0 + 0, 99, 0, 26, 44);
        drawTexturedModalRect(i + 155, byte0 + 0, 0, 45, 155, 44);
      } else {
        drawTexturedModalRect(i + 0, byte0 + 0, 0, 0, 155, 44);
        drawTexturedModalRect(i + 155, byte0 + 0, 0, 45, 155, 44);
      }
    }

    tessellator.setColorOpaque_I(0xffffff);
    GL11.glPushMatrix();
    GL11.glTranslatef(width / 2 + 90, 70F, 0.0F);
    GL11.glRotatef(-20F, 0.0F, 0.0F, 1.0F);
    float f =
        1.8F
            - MathHelper.abs(
                MathHelper.sin(
                        ((float) (Minecraft.getSystemTime() % 1000L) / 1000F)
                            * (float) Math.PI
                            * 2.0F)
                    * 0.1F);
    f = (f * 100F) / (float) (fontRenderer.getStringWidth(splashText) + 32);
    GL11.glScalef(f, f, f);
    drawCenteredString(fontRenderer, splashText, 0, -8, 0xffff00);
    GL11.glPopMatrix();
    String s = version.contains(":") ? version.split(":", 2)[1] : version;
    if (s.equals("OFF")) {
      s = "Minecraft " + (new CallableMinecraftVersion(null)).minecraftVersion();
    }

    if (mc.isDemo()) {
      s = (new StringBuilder()).append(s).append(" Demo").toString();
    }

    if (panorama) {
      drawString(fontRenderer, s, 2, height - 10, 0xffffff);
    } else {
      drawString(fontRenderer, s, 2, 2, 0x505050);
    }
    String s1 = "Copyright Mojang AB. Do not distribute!";
    drawString(
        fontRenderer, s1, width - fontRenderer.getStringWidth(s1) - 2, height - 10, 0xffffff);

    if (field_92025_p != null && field_92025_p.length() > 0) {
      drawRect(
          field_92022_t - 2, field_92021_u - 2, field_92020_v + 2, field_92019_w - 1, 0x55200000);
      drawString(fontRenderer, field_92025_p, field_92022_t, field_92021_u, 0xffffff);
      drawString(
          fontRenderer,
          field_96138_a,
          (width - field_92024_r) / 2,
          ((GuiButton) buttonList.get(0)).yPosition - 12,
          0xffffff);
    }

    super.drawScreen(par1, par2, par3);
  }