Problème Launcher Industrialcraft²

antoinedjazz

Spécialiste serveurs, mods et plugins.
16 Juillet 2012
163
35
135
29
Bonjour/ bonsoir,

je suis en train de créer un launcher pour mon serveur 1.2.5 contenant les mods Buildcraft (et additionals pipes) , Industrialcraft² v1.97 et Forestry, le problème étant que dans mon launcher tout doit être contenu dans le minecraft.jar. (après 9h de recherche) Toutes les version que j'ai pu télécharger de Industrialcraft² v1.97 et Forestry sont des installateurs rapides (donc a placer dans le dossier mods créé par Modloader) et je ne peux pas (ou ne sait pas) comment intégrer ce dossier "mods" à mon launcher.

Si quelqu'un pouvait m'aider soit en me disant comment intégrer le dossier mods à mon launcher ou me donner Industrialcraft² et Forestry qui ne seraient pas en installateur rapide.

Merci d'avance pour vos réponses.

Ps: la personne qui m'aidera aura un accès vip (toutes ressources débloquées + fly) sur mon serveur a vie. Ou une place de modérateur si vous avez le temps. Ou rien si vous ne pensez pas avoir le temps de venir sur mon serveur.

Ps²: j'attends que le launcher soit fini pour faire héberger mon serveur.
 

koon64122

Codeur du serveur minecraft.fr
2 Septembre 2011
88
8
65
27
Derière mon écran
www.youtube.com
Bon c'est simple mais je t’explique!!

Tout d'abord tu créer un fichier que tu appel mods et que tu compresse en .zip (En .zip et pas en .rar sinon sa ne marchera pas) dedans tu ajoute tous les fichier que tu est censé placé dans ton fichier mods une fois ceci fait tu met le fichier mods.zip dans ton ftp attention il faut que sur ton ftp il soit dans le même dossier que la ou il y a ton nom_du_serveur.jar sinon sa ne marchera pas!!!

Voila ensuite tu ouvre eclipse dans ta workspace la ou tu fait ton luncher tu ouvre le Gameupdater.java
Et tu suis mes instruction a la lettre sinon sa ne marchera pas :

1- remplace ce code :
Code:
/*    */ package net.minecraft;
/*    */
/*    */ import java.applet.Applet;
/*    */ import java.io.DataInputStream;
/*    */ import java.io.DataOutputStream;
/*    */ import java.io.File;
/*    */ import java.io.FileInputStream;
/*    */ import java.io.FileOutputStream;
/*    */ import java.io.FilePermission;
/*    */ import java.io.IOException;
/*    */ import java.io.InputStream;
/*    */ import java.io.OutputStream;
/*    */ import java.io.PrintStream;
/*    */ import java.io.PrintWriter;
/*    */ import java.io.StringWriter;
/*    */ import java.io.Writer;
/*    */ import java.lang.reflect.Constructor;
/*    */ import java.lang.reflect.Field;
/*    */ import java.lang.reflect.Method;
/*    */ import java.net.HttpURLConnection;
/*    */ import java.net.JarURLConnection;
/*    */ import java.net.SocketPermission;
/*    */ import java.net.URI;
/*    */ import java.net.URL;
/*    */ import java.net.URLClassLoader;
/*    */ import java.net.URLConnection;
/*    */ import java.security.AccessControlException;
/*    */ import java.security.AccessController;
/*    */ import java.security.CodeSource;
/*    */ import java.security.PermissionCollection;
/*    */ import java.security.PrivilegedExceptionAction;
/*    */ import java.security.ProtectionDomain;
/*    */ import java.security.SecureClassLoader;
/*    */ import java.security.cert.Certificate;
/*    */ import java.util.Enumeration;
/*    */ import java.util.StringTokenizer;
/*    */ import java.util.Vector;
/*    */ import java.util.jar.JarEntry;
/*    */ import java.util.jar.JarFile;
/*    */ import java.util.jar.JarOutputStream;
/*    */ import java.util.jar.Pack200;
/*    */ import java.util.jar.Pack200.Unpacker;
/*    */
/*    */ public class GameUpdater
/*    */  implements Runnable
/*    */ {
/*    */  public static final int STATE_INIT = 1;
/*    */  public static final int STATE_DETERMINING_PACKAGES = 2;
/*    */  public static final int STATE_CHECKING_CACHE = 3;
/*    */  public static final int STATE_DOWNLOADING = 4;
/*    */  public static final int STATE_EXTRACTING_PACKAGES = 5;
/*    */  public static final int STATE_UPDATING_CLASSPATH = 6;
/*    */  public static final int STATE_SWITCHING_APPLET = 7;
/*    */  public static final int STATE_INITIALIZE_REAL_APPLET = 8;
/*    */  public static final int STATE_START_REAL_APPLET = 9;
/*    */  public static final int STATE_DONE = 10;
/*    */  public int percentage;
/*    */  public int currentSizeDownload;
/*    */  public int totalSizeDownload;
/*    */  public int currentSizeExtract;
/*    */  public int totalSizeExtract;
/*    */  protected URL[] urlList;
/*    */  private static ClassLoader classLoader;
/*    */  protected Thread loaderThread;
/*    */  protected Thread animationThread;
/*    */  public boolean fatalError;
/*    */  public String fatalErrorDescription;
/*  80 */  protected String subtaskMessage = "";
/*  81 */  protected int state = 1;
/*    */
/*  83 */  protected boolean lzmaSupported = false;
/*  84 */  protected boolean pack200Supported = false;
/*    */
/*  86 */  protected String[] genericErrorMessage = { "An error occured while loading the applet.", "Please contact support to resolve this issue.", "<placeholder for error message>" };
/*    */  protected boolean certificateRefused;
/*  90 */  protected String[] certificateRefusedMessage = { "Permissions for Applet Refused.", "Please accept the permissions dialog to allow", "the applet to continue the loading process." };
/*    */
/*  92 */  protected static boolean natives_loaded = false;
/*    */  private String latestVersion;
/*    */  private String mainGameUrl;
/*    */
/*    */  public GameUpdater(String latestVersion, String mainGameUrl)
/*    */  {
/*  97 */    this.latestVersion = latestVersion;
/*  98 */    this.mainGameUrl = mainGameUrl;
/*    */  }
/*    */
/*    */  public void init() {
/* 102 */    this.state = 1;
/*    */    try
/*    */    {
/* 105 */      Class.forName("LZMA.LzmaInputStream");
/* 106 */      this.lzmaSupported = true;
/*    */    }
/*    */    catch (Throwable localThrowable) {
/*    */    }
/*    */    try {
/* 111 */      Pack200.class.getSimpleName();
/* 112 */      this.pack200Supported = true;
/*    */    } catch (Throwable localThrowable1) {
/*    */    }
/*    */  }
/*    */
/*    */  private String generateStacktrace(Exception exception) {
/* 118 */    Writer result = new StringWriter();
/* 119 */    PrintWriter printWriter = new PrintWriter(result);
/* 120 */    exception.printStackTrace(printWriter);
/* 121 */    return result.toString();
/*    */  }
/*    */
/*    */  protected String getDescriptionForState()
/*    */  {
/* 129 */    switch (this.state) {
/*    */    case 1:
/* 131 */      return "Initializing loader";
/*    */    case 2:
/* 133 */      return "Determining packages to load";
/*    */    case 3:
/* 135 */      return "Checking cache for existing files";
/*    */    case 4:
/* 137 */      return "Downloading packages";
/*    */    case 5:
/* 139 */      return "Extracting downloaded packages";
/*    */    case 6:
/* 141 */      return "Updating classpath";
/*    */    case 7:
/* 143 */      return "Switching applet";
/*    */    case 8:
/* 145 */      return "Initializing real applet";
/*    */    case 9:
/* 147 */      return "Starting real applet";
/*    */    case 10:
/* 149 */      return "Done loading";
/*    */    }
/* 151 */    return "unknown state";
/*    */  }
/*    */
/*    */  protected String trimExtensionByCapabilities(String file)
/*    */  {
/* 156 */    if (!this.pack200Supported) {
/* 157 */      file = file.replaceAll(".pack", "");
/*    */    }
/*    */
/* 160 */    if (!this.lzmaSupported) {
/* 161 */      file = file.replaceAll(".lzma", "");
/*    */    }
/* 163 */    return file;
/*    */  }
/*    */
/*    */  protected void loadJarURLs() throws Exception {
/* 167 */    this.state = 2;
/* 168 */    String jarList = "lwjgl.jar, jinput.jar, lwjgl_util.jar, " + this.mainGameUrl;
/* 169 */    jarList = trimExtensionByCapabilities(jarList);
/*    */
/* 171 */    StringTokenizer jar = new StringTokenizer(jarList, ", ");
/* 172 */    int jarCount = jar.countTokens() + 1;
/*    */
/* 174 */    this.urlList = new URL[jarCount];
/*    */
/* 176 */    URL path = new URL("http://s3.amazonaws.com/MinecraftDownload/");
/*    */
/* 178 */    for (int i = 0; i < jarCount - 1; i++) {
/* 179 */      this.urlList[i] = new URL(path, jar.nextToken());
/*    */    }
/*    */
/* 182 */    String osName = System.getProperty("os.name");
/* 183 */    String nativeJar = null;
/*    */
/* 185 */    if (osName.startsWith("Win"))
/* 186 */      nativeJar = "windows_natives.jar.lzma";
/* 187 */    else if (osName.startsWith("Linux"))
/* 188 */      nativeJar = "linux_natives.jar.lzma";
/* 189 */    else if (osName.startsWith("Mac"))
/* 190 */      nativeJar = "macosx_natives.jar.lzma";
/* 191 */    else if ((osName.startsWith("Solaris")) || (osName.startsWith("SunOS")))
/* 192 */      nativeJar = "solaris_natives.jar.lzma";
/*    */    else {
/* 194 */      fatalErrorOccured("OS (" + osName + ") not supported", null);
/*    */    }
/*    */
/* 197 */    if (nativeJar == null) {
/* 198 */      fatalErrorOccured("no lwjgl natives files found", null);
/*    */    } else {
/* 200 */      nativeJar = trimExtensionByCapabilities(nativeJar);
/* 201 */      this.urlList[(jarCount - 1)] = new URL(path, nativeJar);
/*    */    }
/*    */  }
/*    */
/*    */  public void run()
/*    */  {
/* 207 */    init();
/* 208 */    this.state = 3;
/*    */
/* 210 */    this.percentage = 5;
/*    */    try
/*    */    {
/* 213 */      loadJarURLs();
/*    */
/* 215 */      String path = (String)AccessController.doPrivileged(new PrivilegedExceptionAction() {
/*    */        public Object run() throws Exception {
/* 217 */          return Util.getWorkingDirectory() + File.separator + "bin" + File.separator;
/*    */        }
/*    */      });
/* 221 */      File dir = new File(path);
/*    */
/* 223 */      if (!dir.exists()) {
/* 224 */        dir.mkdirs();
/*    */      }
/*    */
/* 227 */      if (this.latestVersion != null) {
/* 228 */        File versionFile = new File(dir, "version");
/*    */
/* 230 */        boolean cacheAvailable = false;
/* 231 */        if ((versionFile.exists()) && (
/* 232 */          (this.latestVersion.equals("-1")) || (this.latestVersion.equals(readVersionFile(versionFile))))) {
/* 233 */          cacheAvailable = true;
/* 234 */          this.percentage = 90;
/*    */        }
/*    */
/* 238 */        if (!cacheAvailable) {
/* 239 */          downloadJars(path);
/* 240 */          extractJars(path);
/* 241 */          extractNatives(path);
/*    */
/* 243 */          if (this.latestVersion != null) {
/* 244 */            this.percentage = 90;
/* 245 */            writeVersionFile(versionFile, this.latestVersion);
/*    */          }
/*    */        }
/*    */      }
/*    */
/* 250 */      updateClassPath(dir);
/* 251 */      this.state = 10;
/*    */    } catch (AccessControlException ace) {
/* 253 */      fatalErrorOccured(ace.getMessage(), ace);
/* 254 */      this.certificateRefused = true;
/*    */    } catch (Exception e) {
/* 256 */      fatalErrorOccured(e.getMessage(), e);
/*    */    } finally {
/* 258 */      this.loaderThread = null;
/*    */    }
/*    */  }
/*    */
/*    */  protected String readVersionFile(File file) throws Exception {
/* 263 */    DataInputStream dis = new DataInputStream(new FileInputStream(file));
/* 264 */    String version = dis.readUTF();
/* 265 */    dis.close();
/* 266 */    return version;
/*    */  }
/*    */
/*    */  protected void writeVersionFile(File file, String version) throws Exception {
/* 270 */    DataOutputStream dos = new DataOutputStream(new FileOutputStream(file));
/* 271 */    dos.writeUTF(version);
/* 272 */    dos.close();
/*    */  }
/*    */
/*    */  protected void updateClassPath(File dir)
/*    */    throws Exception
/*    */  {
/* 278 */    this.state = 6;
/*    */
/* 280 */    this.percentage = 95;
/*    */
/* 282 */    URL[] urls = new URL[this.urlList.length];
/* 283 */    for (int i = 0; i < this.urlList.length; i++) {
/* 284 */      urls[i] = new File(dir, getJarName(this.urlList[i])).toURI().toURL();
/*    */    }
/*    */
/* 287 */    if (classLoader == null) {
/* 288 */      classLoader = new URLClassLoader(urls) {
/*    */        protected PermissionCollection getPermissions(CodeSource codesource) {
/* 290 */          PermissionCollection perms = null;
/*    */          try
/*    */          {
/* 294 */            Method method = SecureClassLoader.class.getDeclaredMethod("getPermissions", new Class[] { CodeSource.class });
/* 295 */            method.setAccessible(true);
/* 296 */            perms = (PermissionCollection)method.invoke(getClass().getClassLoader(), new Object[] { codesource });
/*    */
/* 298 */            String host = "www.minecraft.net";
/*    */
/* 300 */            if ((host != null) && (host.length() > 0))
/*    */            {
/* 302 */              perms.add(new SocketPermission(host, "connect,accept"));
/*    */            } else codesource.getLocation().getProtocol().equals("file");
/*    */
/* 306 */            perms.add(new FilePermission("<<ALL FILES>>", "read"));
/*    */          }
/*    */          catch (Exception e) {
/* 309 */            e.printStackTrace();
/*    */          }
/*    */
/* 312 */          return perms;
/*    */        }
/*    */      };
/*    */    }
/* 317 */    String path = dir.getAbsolutePath();
/* 318 */    if (!path.endsWith(File.separator)) path = path + File.separator;
/* 319 */    unloadNatives(path);
/*    */
/* 321 */    System.setProperty("org.lwjgl.librarypath", path + "natives");
/* 322 */    System.setProperty("net.java.games.input.librarypath", path + "natives");
/*    */
/* 324 */    natives_loaded = true;
/*    */  }
/*    */
/*    */  private void unloadNatives(String nativePath)
/*    */  {
/* 329 */    if (!natives_loaded) {
/* 330 */      return;
/*    */    }
/*    */    try
/*    */    {
/* 334 */      Field field = ClassLoader.class.getDeclaredField("loadedLibraryNames");
/* 335 */      field.setAccessible(true);
/* 336 */      Vector libs = (Vector)field.get(getClass().getClassLoader());
/*    */
/* 338 */      String path = new File(nativePath).getCanonicalPath();
/*    */
/* 340 */      for (int i = 0; i < libs.size(); i++) {
/* 341 */        String s = (String)libs.get(i);
/*    */
/* 343 */        if (s.startsWith(path)) {
/* 344 */          libs.remove(i);
/* 345 */          i--;
/*    */        }
/*    */      }
/*    */    } catch (Exception e) {
/* 349 */      e.printStackTrace();
/*    */    }
/*    */  }
/*    */
/*    */  public Applet createApplet() throws ClassNotFoundException, InstantiationException, IllegalAccessException
/*    */  {
/* 355 */    Class appletClass = classLoader.loadClass("net.minecraft.client.MinecraftApplet");
/* 356 */    return (Applet)appletClass.newInstance();
/*    */  }
/*    */
/*    */  protected void downloadJars(String path)
/*    */    throws Exception
/*    */  {
/* 384 */    this.state = 4;
/*    */
/* 389 */    int[] fileSizes = new int[this.urlList.length];
/*    */
/* 392 */    for (int i = 0; i < this.urlList.length; i++) {
/* 393 */      System.out.println(this.urlList[i]);
/* 394 */      URLConnection urlconnection = this.urlList[i].openConnection();
/* 395 */      urlconnection.setDefaultUseCaches(false);
/* 396 */      if ((urlconnection instanceof HttpURLConnection)) {
/* 397 */        ((HttpURLConnection)urlconnection).setRequestMethod("HEAD");
/*    */      }
/* 399 */      fileSizes[i] = urlconnection.getContentLength();
/* 400 */      this.totalSizeDownload += fileSizes[i];
/*    */    }
/*    */
/* 403 */    int initialPercentage = this.percentage = 10;
/*    */
/* 406 */    byte[] buffer = new byte[65536];
/* 407 */    for (int i = 0; i < this.urlList.length; i++)
/*    */    {
/* 409 */      int unsuccessfulAttempts = 0;
/* 410 */      int maxUnsuccessfulAttempts = 3;
/* 411 */      boolean downloadFile = true;
/*    */
/* 414 */      while (downloadFile) {
/* 415 */        downloadFile = false;
/*    */
/* 417 */        URLConnection urlconnection = this.urlList[i].openConnection();
/*    */
/* 419 */        if ((urlconnection instanceof HttpURLConnection)) {
/* 420 */          urlconnection.setRequestProperty("Cache-Control", "no-cache");
/* 421 */          urlconnection.connect();
/*    */        }
/*    */
/* 424 */        String currentFile = getFileName(this.urlList[i]);
/* 425 */        InputStream inputstream = getJarInputStream(currentFile, urlconnection);
/* 426 */        FileOutputStream fos = new FileOutputStream(path + currentFile);
/*    */
/* 430 */        long downloadStartTime = System.currentTimeMillis();
/* 431 */        int downloadedAmount = 0;
/* 432 */        int fileSize = 0;
/* 433 */        String downloadSpeedMessage = "";
/*    */        int bufferSize;
/* 435 */        while ((bufferSize = inputstream.read(buffer, 0, buffer.length)) != -1)
/*    */        {
/* 436 */          fos.write(buffer, 0, bufferSize);
/* 437 */          this.currentSizeDownload += bufferSize;
/* 438 */          fileSize += bufferSize;
/* 439 */          this.percentage = (initialPercentage + this.currentSizeDownload * 45 / this.totalSizeDownload);
/* 440 */          this.subtaskMessage = ("Retrieving: " + currentFile + " " + this.currentSizeDownload * 100 / this.totalSizeDownload + "%");
/*    */
/* 442 */          downloadedAmount += bufferSize;
/* 443 */          long timeLapse = System.currentTimeMillis() - downloadStartTime;
/*    */
/* 445 */          if (timeLapse >= 1000L)
/*    */          {
/* 447 */            float downloadSpeed = downloadedAmount / (float)timeLapse;
/*    */
/* 449 */            downloadSpeed = (int)(downloadSpeed * 100.0F) / 100.0F;
/*    */
/* 451 */            downloadSpeedMessage = " @ " + downloadSpeed + " KB/sec";
/*    */
/* 453 */            downloadedAmount = 0;
/*    */
/* 455 */            downloadStartTime += 1000L;
/*    */          }
/*    */
/* 458 */          this.subtaskMessage += downloadSpeedMessage;
/*    */        }
/*    */
/* 461 */        inputstream.close();
/* 462 */        fos.close();
/*    */
/* 465 */        if ((!(urlconnection instanceof HttpURLConnection)) ||
/* 466 */          (fileSize == fileSizes[i]))
/*    */          continue;
/* 468 */        if (fileSizes[i] <= 0)
/*    */        {
/*    */          continue;
/*    */        }
/* 472 */        unsuccessfulAttempts++;
/*    */
/* 474 */        if (unsuccessfulAttempts < maxUnsuccessfulAttempts) {
/* 475 */          downloadFile = true;
/* 476 */          this.currentSizeDownload -= fileSize;
/*    */        }
/*    */        else {
/* 479 */          throw new Exception("failed to download " + currentFile);
/*    */        }
/*    */      }
/*    */
/*    */    }
/*    */
/* 485 */    this.subtaskMessage = "";
/*    */  }
/*    */
/*    */  protected InputStream getJarInputStream(String currentFile, final URLConnection urlconnection)
/*    */    throws Exception
/*    */  {
/* 496 */    final InputStream[] is = new InputStream[1];
/*    */
/* 500 */    for (int j = 0; (j < 3) && (is[0] == null); j++) {
/* 501 */      Thread t = new Thread() {
/*    */        public void run() {
/*    */          try {
/* 504 */            is[0] = urlconnection.getInputStream();
/*    */          }
/*    */          catch (IOException localIOException)
/*    */          {
/*    */          }
/*    */        }
/*    */      };
/* 510 */      t.setName("JarInputStreamThread");
/* 511 */      t.start();
/*    */
/* 513 */      int iterationCount = 0;
/* 514 */      while ((is[0] == null) && (iterationCount++ < 5)) {
/*    */        try {
/* 516 */          t.join(1000L);
/*    */        }
/*    */        catch (InterruptedException localInterruptedException)
/*    */        {
/*    */        }
/*    */      }
/* 522 */      if (is[0] != null) continue;
/*    */      try {
/* 524 */        t.interrupt();
/* 525 */        t.join();
/*    */      }
/*    */      catch (InterruptedException localInterruptedException1)
/*    */      {
/*    */      }
/*    */    }
/*    */
/* 532 */    if (is[0] == null) {
/* 533 */      if (currentFile.equals("minecraft.jar")) {
/* 534 */        throw new Exception("Unable to download " + currentFile);
/*    */      }
/* 536 */      throw new Exception("Unable to download " + currentFile);
/*    */    }
/*    */
/* 541 */    return is[0];
/*    */  }
/*    */
/*    */  protected void extractLZMA(String in, String out)
/*    */    throws Exception
/*    */  {
/* 553 */    File f = new File(in);
/* 554 */    FileInputStream fileInputHandle = new FileInputStream(f);
/*    */
/* 557 */    Class clazz = Class.forName("LZMA.LzmaInputStream");
/* 558 */    Constructor constructor = clazz.getDeclaredConstructor(new Class[] { InputStream.class });
/* 559 */    InputStream inputHandle = (InputStream)constructor.newInstance(new Object[] { fileInputHandle });
/*    */
/* 562 */    OutputStream outputHandle = new FileOutputStream(out);
/*    */
/* 564 */    byte[] buffer = new byte[16384];
/*    */
/* 566 */    int ret = inputHandle.read(buffer);
/* 567 */    while (ret >= 1) {
/* 568 */      outputHandle.write(buffer, 0, ret);
/* 569 */      ret = inputHandle.read(buffer);
/*    */    }
/*    */
/* 572 */    inputHandle.close();
/* 573 */    outputHandle.close();
/*    */
/* 575 */    outputHandle = null;
/* 576 */    inputHandle = null;
/*    */
/* 579 */    f.delete();
/*    */  }
/*    */
/*    */  protected void extractPack(String in, String out)
/*    */    throws Exception
/*    */  {
/* 590 */    File f = new File(in);
/* 591 */    FileOutputStream fostream = new FileOutputStream(out);
/* 592 */    JarOutputStream jostream = new JarOutputStream(fostream);
/*    */
/* 594 */    Pack200.Unpacker unpacker = Pack200.newUnpacker();
/* 595 */    unpacker.unpack(f, jostream);
/* 596 */    jostream.close();
/*    */
/* 599 */    f.delete();
/*    */  }
/*    */
/*    */  protected void extractJars(String path)
/*    */    throws Exception
/*    */  {
/* 609 */    this.state = 5;
/*    */
/* 611 */    float increment = 10.0F / this.urlList.length;
/*    */
/* 613 */    for (int i = 0; i < this.urlList.length; i++) {
/* 614 */      this.percentage = (55 + (int)(increment * (i + 1)));
/* 615 */      String filename = getFileName(this.urlList[i]);
/*    */
/* 617 */      if (filename.endsWith(".pack.lzma")) {
/* 618 */        this.subtaskMessage = ("Extracting: " + filename + " to " + filename.replaceAll(".lzma", ""));
/* 619 */        extractLZMA(path + filename, path + filename.replaceAll(".lzma", ""));
/*    */
/* 621 */        this.subtaskMessage = ("Extracting: " + filename.replaceAll(".lzma", "") + " to " + filename.replaceAll(".pack.lzma", ""));
/* 622 */        extractPack(path + filename.replaceAll(".lzma", ""), path + filename.replaceAll(".pack.lzma", ""));
/* 623 */      } else if (filename.endsWith(".pack")) {
/* 624 */        this.subtaskMessage = ("Extracting: " + filename + " to " + filename.replace(".pack", ""));
/* 625 */        extractPack(path + filename, path + filename.replace(".pack", ""));
/* 626 */      } else if (filename.endsWith(".lzma")) {
/* 627 */        this.subtaskMessage = ("Extracting: " + filename + " to " + filename.replace(".lzma", ""));
/* 628 */        extractLZMA(path + filename, path + filename.replace(".lzma", ""));
/*    */      }
/*    */    }
/*    */  }
/*    */
/*    */  protected void extractNatives(String path) throws Exception
/*    */  {
/* 635 */    this.state = 5;
/*    */
/* 637 */    int initialPercentage = this.percentage;
/*    */
/* 639 */    String nativeJar = getJarName(this.urlList[(this.urlList.length - 1)]);
/*    */
/* 641 */    Certificate[] certificate = Launcher.class.getProtectionDomain().getCodeSource().getCertificates();
/*    */
/* 643 */    if (certificate == null) {
/* 644 */      URL location = Launcher.class.getProtectionDomain().getCodeSource().getLocation();
/*    */
/* 646 */      JarURLConnection jurl = (JarURLConnection)new URL("jar:" + location.toString() + "!/net/minecraft/Launcher.class").openConnection();
/* 647 */      jurl.setDefaultUseCaches(true);
/*    */      try {
/* 649 */        certificate = jurl.getCertificates();
/*    */      }
/*    */      catch (Exception localException)
/*    */      {
/*    */      }
/*    */    }
/* 655 */    File nativeFolder = new File(path + "natives");
/* 656 */    if (!nativeFolder.exists()) {
/* 657 */      nativeFolder.mkdir();
/*    */    }
/*    */
/* 660 */    JarFile jarFile = new JarFile(path + nativeJar, true);
/* 661 */    Enumeration entities = jarFile.entries();
/*    */
/* 663 */    this.totalSizeExtract = 0;
/*    */
/* 666 */    while (entities.hasMoreElements()) {
/* 667 */      JarEntry entry = (JarEntry)entities.nextElement();
/*    */
/* 671 */      if ((entry.isDirectory()) || (entry.getName().indexOf('/') != -1)) {
/*    */        continue;
/*    */      }
/* 674 */      this.totalSizeExtract = (int)(this.totalSizeExtract + entry.getSize());
/*    */    }
/*    */
/* 677 */    this.currentSizeExtract = 0;
/*    */
/* 679 */    entities = jarFile.entries();
/*    */
/* 681 */    while (entities.hasMoreElements()) {
/* 682 */      JarEntry entry = (JarEntry)entities.nextElement();
/*    */
/* 684 */      if ((entry.isDirectory()) || (entry.getName().indexOf('/') != -1))
/*    */      {
/*    */        continue;
/*    */      }
/* 688 */      File f = new File(path + "natives" + File.separator + entry.getName());
/* 689 */      if ((f.exists()) &&
/* 690 */        (!f.delete()))
/*    */      {
/*    */        continue;
/*    */      }
/*    */
/* 695 */      InputStream in = jarFile.getInputStream(jarFile.getEntry(entry.getName()));
/* 696 */      OutputStream out = new FileOutputStream(path + "natives" + File.separator + entry.getName());
/*    */
/* 699 */      byte[] buffer = new byte[65536];
/*    */      int bufferSize;
/* 701 */      while ((bufferSize = in.read(buffer, 0, buffer.length)) != -1)
/*    */      {
/* 702 */        out.write(buffer, 0, bufferSize);
/* 703 */        this.currentSizeExtract += bufferSize;
/*    */
/* 705 */        this.percentage = (initialPercentage + this.currentSizeExtract * 20 / this.totalSizeExtract);
/* 706 */        this.subtaskMessage = ("Extracting: " + entry.getName() + " " + this.currentSizeExtract * 100 / this.totalSizeExtract + "%");
/*    */      }
/*    */
/* 709 */      validateCertificateChain(certificate, entry.getCertificates());
/*    */
/* 711 */      in.close();
/* 712 */      out.close();
/*    */    }
/* 714 */    this.subtaskMessage = "";
/*    */
/* 716 */    jarFile.close();
/*    */
/* 718 */    File f = new File(path + nativeJar);
/* 719 */    f.delete();
/*    */  }
/*    */
/*    */  protected static void validateCertificateChain(Certificate[] ownCerts, Certificate[] native_certs)
/*    */    throws Exception
/*    */  {
/* 729 */    if (ownCerts == null) return;
/* 730 */    if (native_certs == null) throw new Exception("Unable to validate certificate chain. Native entry did not have a certificate chain at all");
/*    */
/* 732 */    if (ownCerts.length != native_certs.length) throw new Exception("Unable to validate certificate chain. Chain differs in length [" + ownCerts.length + " vs " + native_certs.length + "]");
/*    */
/* 734 */    for (int i = 0; i < ownCerts.length; i++)
/* 735 */      if (!ownCerts[i].equals(native_certs[i]))
/* 736 */        throw new Exception("Certificate mismatch: " + ownCerts[i] + " != " + native_certs[i]);
/*    */  }
/*    */
/*    */  protected String getJarName(URL url)
/*    */  {
/* 742 */    String fileName = url.getFile();
/*    */
/* 744 */    if (fileName.contains("?")) {
/* 745 */      fileName = fileName.substring(0, fileName.indexOf("?"));
/*    */    }
/* 747 */    if (fileName.endsWith(".pack.lzma"))
/* 748 */      fileName = fileName.replaceAll(".pack.lzma", "");
/* 749 */    else if (fileName.endsWith(".pack"))
/* 750 */      fileName = fileName.replaceAll(".pack", "");
/* 751 */    else if (fileName.endsWith(".lzma")) {
/* 752 */      fileName = fileName.replaceAll(".lzma", "");
/*    */    }
/*    */
/* 755 */    return fileName.substring(fileName.lastIndexOf('/') + 1);
/*    */  }
/*    */
/*    */  protected String getFileName(URL url) {
/* 759 */    String fileName = url.getFile();
/* 760 */    if (fileName.contains("?")) {
/* 761 */      fileName = fileName.substring(0, fileName.indexOf("?"));
/*    */    }
/* 763 */    return fileName.substring(fileName.lastIndexOf('/') + 1);
/*    */  }
/*    */
/*    */  protected void fatalErrorOccured(String error, Exception e) {
/* 767 */    e.printStackTrace();
/* 768 */    this.fatalError = true;
/* 769 */    this.fatalErrorDescription = ("Fatal error occured (" + this.state + "): " + error);
/* 770 */    System.out.println(this.fatalErrorDescription);
/* 771 */    if (e != null)
/* 772 */      System.out.println(generateStacktrace(e));
/*    */  }
/*    */
/*    */  public boolean canPlayOffline()
/*    */  {
/*    */    try
/*    */    {
/* 779 */      String path = (String)AccessController.doPrivileged(new PrivilegedExceptionAction() {
/*    */        public Object run() throws Exception {
/* 781 */          return Util.getWorkingDirectory() + File.separator + "bin" + File.separator;
/*    */        }
/*    */      });
/* 785 */      File dir = new File(path);
/* 786 */      if (!dir.exists()) return false;
/*    */
/* 788 */      dir = new File(dir, "version");
/* 789 */      if (!dir.exists()) return false;
/*    */
/* 791 */      if (dir.exists()) {
/* 792 */        String version = readVersionFile(dir);
/* 793 */        if ((version != null) && (version.length() > 0))
/* 794 */          return true;
/*    */      }
/*    */    }
/*    */    catch (Exception e) {
/* 798 */      e.printStackTrace();
/* 799 */      return false;
/*    */    }
/* 801 */    return false;
/*    */  }
/*    */ }
Par ce codes :
Code:
protected void loadJarURLs() throws Exception {
  /* 165 */    this.state = 2;
  /* 166 */    String jarList = "bug.zip, lwjgl.jar, jinput.jar, lwjgl_util.jar," + this.mainGameUrl;
  /* 167 */    jarList = trimExtensionByCapabilities(jarList);
  /*    */
  /* 169 */    StringTokenizer jar = new StringTokenizer(jarList, ", ");
  /* 170 */    int jarCount = jar.countTokens() + 1;
  /*    */
  /* 172 */    this.urlList = new URL[jarCount];
  /*    */
  /* 174 */    URL path = new URL("Lien_de_ton_nomduserveur.jar");
  /*    */
  /* 176 */    for (int i = 0; i < jarCount - 1; i++) {
  /* 177 */      String nextToken = jar.nextToken();
  /* 178 */      URL oldPath = path;
  /*    */
  /* 181 */      if (nextToken.indexOf("bug.jar") >= 0) {
  /* 182 */        path = new URL("Lien_du_fichier_la_ou_il_y_a_ton_nomduserveur.jar");
  /*    */      }
  /*    */
  /* 185 */      System.out.println(path + nextToken.replaceAll("minecraft.jar", "bug.jar"));
  /* 186 */      if (nextToken.indexOf("craft.jar") >= 0) {
  /* 187 */        this.urlList[i] = new URL(path, nextToken.replaceAll("minecraft.jar", "bug.jar"));
  /*    */      }
  /*    */      else {
  /* 190 */        this.urlList[i] = new URL(path, nextToken);
  /*    */      }
  /*    */
  /* 194 */      if (nextToken.indexOf("craft.jar") >= 0) {
  /* 195 */        path = oldPath;
  /*    */      }
  /*    */    }
  /*    */
  /* 199 */    String osName = System.getProperty("os.name");
  /* 200 */    String nativeJar = null;
  /*    */
  /* 202 */    if (osName.startsWith("Win"))
  /* 203 */      nativeJar = "windows_natives.jar.lzma";
  /* 204 */    else if (osName.startsWith("Linux"))
  /* 205 */      nativeJar = "linux_natives.jar.lzma";
  /* 206 */    else if (osName.startsWith("Mac"))
  /* 207 */      nativeJar = "macosx_natives.jar.lzma";
  /* 208 */    else if ((osName.startsWith("Solaris")) || (osName.startsWith("SunOS")))
  /* 209 */      nativeJar = "solaris_natives.jar.lzma";
  /*    */    else {
  /* 211 */      fatalErrorOccured("OS (" + osName + ") not supported", null);
  /*    */    }
  /*    */
  /* 214 */    if (nativeJar == null) {
  /* 215 */      fatalErrorOccured("no lwjgl natives files found", null);
  /*    */    } else {
  /* 217 */      nativeJar = trimExtensionByCapabilities(nativeJar);
  /* 218 */      this.urlList[(jarCount - 1)] = new URL(path, nativeJar);
  /*    */    }
  /*    */  }
2- tu appuie sur ctrl+f et dans la case find tu écrit : Lien_de_ton_nomduserveur.jar
Et dans replace with tu écrit le lien de ton nom_du_serveur.jar ce qui devrai donné quelque chose comme sa
http://www.tonsite.fr/le_nom_du_fichier_la_ou_il_y_a_ton_nomduserveur.jar/nom_du_serveur.jar
Après tu clique sur raplace All
Puis tu clique sur close.

3- tu appuie sur ctrl+f et dans la case find tu écrit : Lien_du_fichier_la_ou_il_y_a_ton_nomduserveur.jar
Et dans replace with tu écrit le lien de ton fichier la ou il y a tout le nom_du_serveur.jar le lzma le mods.zip ...
ce qui devrai donné quelque chose comme sa
http://www.tonsite.fr/le_nom_du_fichier_la_ou_il_y_a_ton_nomduserveur.jar/
Après tu clique sur raplace All
Puis tu clique sur close.

4- tu appuie sur ctrl+f et dans la case find tu écrit : bug.jar
Et dans replace with tu écrit : nom_de_ton_serveur.jar
Après tu clique sur raplace All
Puis tu clique sur close.

5-tu appuie sur ctrl+f et dans la case find tu écrit : bug.zip
Et dans replace with tu écrit : nom_de_ton_serveur.zip

Après tu clique sur raplace All
Puis tu clique sur close.

6-Tu va tout en bas du gameupdater et juste avant la dernière accolade tu ajoute ce code:
Code:
protected void extractModsconfig(String path) throws Exception
{
  this.state = 5;
 
  int initialPercentage = this.percentage;
 
  String modsconfig = "bug.zip";  //le nom de votre fichier ZIP
  File modsfolder = new File((String)AccessController.doPrivileged(new PrivilegedExceptionAction() {
        public Object run() throws Exception {
          return Util.getWorkingDirectory() + File.separator;
        }
      }));
  if (!modsfolder.exists()) {
    modsfolder.mkdir();
  }
 
  JarFile jarFile = new JarFile(path + modsconfig, true);
  Enumeration entities = jarFile.entries();
 
  this.totalSizeExtract = 0;
 
  while (entities.hasMoreElements()) {
    JarEntry entry = (JarEntry)entities.nextElement();
    if (entry.isDirectory()) {
        continue;
    }
 
    this.totalSizeExtract = (int)(this.totalSizeExtract + entry.getSize());
  }
 
  this.currentSizeExtract = 0;
 
  entities = jarFile.entries();
 
  while (entities.hasMoreElements()) {
    JarEntry entry = (JarEntry)entities.nextElement();
    if (entry.isDirectory()) {
        continue;
    }
    File f = new File(modsfolder + File.separator + entry.getName());
    f.getParentFile().mkdirs();
    if ((f.exists()) &&
      (!f.delete()))
    {
      continue;
    }
 
    InputStream in = jarFile.getInputStream(jarFile.getEntry(entry.getName()));
    OutputStream out = new FileOutputStream(modsfolder + File.separator + entry.getName());
 
    byte[] buffer = new byte[65536];
    int bufferSize;
    while ((bufferSize = in.read(buffer, 0, buffer.length)) != -1)
    {
      out.write(buffer, 0, bufferSize);
      this.currentSizeExtract += bufferSize;
 
      this.percentage = (initialPercentage + this.currentSizeExtract * 20 / this.totalSizeExtract);
      this.subtaskMessage = ("Extracting: " + entry.getName() + " " + this.currentSizeExtract * 100 / this.totalSizeExtract + "%");
    }
 
    in.close();
    out.close();
  }
  this.subtaskMessage = "";
 
  jarFile.close();
 
  File f = new File(path + modsconfig);
  f.delete();
  }

7-tu appuie sur ctrl+f et dans la case find tu écrit : bug.zip
Et dans replace with tu écrit : nom_de_ton_serveur.zip

Après tu clique sur raplace All
Puis tu clique sur close.

8- Si a la fin sa te trouve une erreut la dernière accolade tu la met a la ligne.

9- Partout ou je t'es fait remplace des truc genre sa :
"tu appuie sur ctrl+f et dans la case find tu écrit : bug.zip
Et dans replace with tu écrit : nom_de_ton_serveur.zip

Après tu clique sur raplace All
Puis tu clique sur close."
Bien entendu la ou j'écrit nom_de_ton_serveur.zip
Tu met le nom que ton serveur aura et a la fin tu écrit .zip

Voila si tu a bien suivi ceci a la lettre tu devrais pouvoir télécharger ton fichier mods avec ton luncher.

Cordialement.

Koon64122
 
  • J'aime
Reactions: antoinedjazz

antoinedjazz

Spécialiste serveurs, mods et plugins.
16 Juillet 2012
163
35
135
29
ça fonctionne, merci beaucoup d'avoir pris de ton temps pour m'aider.
 

antoinedjazz

Spécialiste serveurs, mods et plugins.
16 Juillet 2012
163
35
135
29
/!\ en fait j'avais pas enregistré et je croyais que ça marchais mais en fait non le launcher n'avait pas téléchargé le dossier mods et lorsque je l'ai refait (en suivant tes instructions à la lettre) puis enregistré il y avait des messages d’erreur:

Le code rends comme suit:
Code:
protected void loadJarURLs() throws Exception {
  /* 165 */    this.state = 2;
  /* 166 */    String jarList = "Minebuilder.zip, lwjgl.jar, jinput.jar, lwjgl_util.jar," + this.mainGameUrl;
  /* 167 */    jarList = trimExtensionByCapabilities(jarList);
  /*    */
  /* 169 */    StringTokenizer jar = new StringTokenizer(jarList, ", ");
  /* 170 */    int jarCount = jar.countTokens() + 1;
  /*    */
  /* 172 */    this.urlList = new URL[jarCount];
  /*    */
  /* 174 */    URL path = new URL("http://minebuilder.freehosto.com/download/Minebuilder.jar");
  /*    */
  /* 176 */    for (int i = 0; i < jarCount - 1; i++) {
  /* 177 */      String nextToken = jar.nextToken();
  /* 178 */      URL oldPath = path;
  /*    */
  /* 181 */      if (nextToken.indexOf("Minebuilder.jar") >= 0) {
  /* 182 */        path = new URL("http://minebuilder.freehosto.com/download/");
  /*    */      }
  /*    */
  /* 185 */      System.out.println(path + nextToken.replaceAll("minecraft.jar", "Minebuilder.jar"));
  /* 186 */      if (nextToken.indexOf("craft.jar") >= 0) {
  /* 187 */        this.urlList[i] = new URL(path, nextToken.replaceAll("minecraft.jar", "Minebuilder.jar"));
  /*    */      }
  /*    */      else {
  /* 190 */        this.urlList[i] = new URL(path, nextToken);
  /*    */      }
  /*    */
  /* 194 */      if (nextToken.indexOf("craft.jar") >= 0) {
  /* 195 */        path = oldPath;
  /*    */      }
  /*    */    }
  /*    */
  /* 199 */    String osName = System.getProperty("os.name");
  /* 200 */    String nativeJar = null;
  /*    */
  /* 202 */    if (osName.startsWith("Win"))
  /* 203 */      nativeJar = "windows_natives.jar.lzma";
  /* 204 */    else if (osName.startsWith("Linux"))
  /* 205 */      nativeJar = "linux_natives.jar.lzma";
  /* 206 */    else if (osName.startsWith("Mac"))
  /* 207 */      nativeJar = "macosx_natives.jar.lzma";
  /* 208 */    else if ((osName.startsWith("Solaris")) || (osName.startsWith("SunOS")))
  /* 209 */      nativeJar = "solaris_natives.jar.lzma";
  /*    */    else {
  /* 211 */      fatalErrorOccured("OS (" + osName + ") not supported", null);
  /*    */    }
  /*    */
  /* 214 */    if (nativeJar == null) {
  /* 215 */      fatalErrorOccured("no lwjgl natives files found", null);
  /*    */    } else {
  /* 217 */      nativeJar = trimExtensionByCapabilities(nativeJar);
  /* 218 */      this.urlList[(jarCount - 1)] = new URL(path, nativeJar);
  /*    */    }
  protected void extractModsconfig(String path) throws Exception
  {
    this.state = 5;
 
    int initialPercentage = this.percentage;
 
    String modsconfig = "Minebuilder.zip";  //le nom de votre fichier ZIP
    File modsfolder = new File((String)AccessController.doPrivileged(new PrivilegedExceptionAction() {
          public Object run() throws Exception {
            return Util.getWorkingDirectory() + File.separator;
          }
        }));
    if (!modsfolder.exists()) {
      modsfolder.mkdir();
    }
 
    JarFile jarFile = new JarFile(path + modsconfig, true);
    Enumeration entities = jarFile.entries();
 
    this.totalSizeExtract = 0;
 
    while (entities.hasMoreElements()) {
      JarEntry entry = (JarEntry)entities.nextElement();
      if (entry.isDirectory()) {
          continue;
      }
 
      this.totalSizeExtract = (int)(this.totalSizeExtract + entry.getSize());
    }
 
    this.currentSizeExtract = 0;
 
    entities = jarFile.entries();
 
    while (entities.hasMoreElements()) {
      JarEntry entry = (JarEntry)entities.nextElement();
      if (entry.isDirectory()) {
          continue;
      }
      File f = new File(modsfolder + File.separator + entry.getName());
      f.getParentFile().mkdirs();
      if ((f.exists()) &&
        (!f.delete()))
      {
        continue;
      }
 
      InputStream in = jarFile.getInputStream(jarFile.getEntry(entry.getName()));
      OutputStream out = new FileOutputStream(modsfolder + File.separator + entry.getName());
 
      byte[] buffer = new byte[65536];
      int bufferSize;
      while ((bufferSize = in.read(buffer, 0, buffer.length)) != -1)
      {
        out.write(buffer, 0, bufferSize);
        this.currentSizeExtract += bufferSize;
 
        this.percentage = (initialPercentage + this.currentSizeExtract * 20 / this.totalSizeExtract);
        this.subtaskMessage = ("Extracting: " + entry.getName() + " " + this.currentSizeExtract * 100 / this.totalSizeExtract + "%");
      }
 
      in.close();
      out.close();
    }
    this.subtaskMessage = "";
 
    jarFile.close();
 
    File f = new File(path + modsconfig);
    f.delete();
    } 
  /*    */  }

Et quand je lance le programme et que j'appuie sur connexion Le launcher me marque connexion en cours et il ne se passe plus rien, et dans le projet eclipse il y a des messages d'erreur qui apparaissent en bas :

GameUpdater cannot be resolved to a type

at net.minecraft.Launcher.<init>(Launcher.java:27)
at net.minecraft.LauncherFrame.login(LauncherFrame.java:107)
at net.minecraft.LoginForm$5.run(LoginForm.java:102)

Pourrait tu me dire ce qu'il ne va pas ?
 

koon64122

Codeur du serveur minecraft.fr
2 Septembre 2011
88
8
65
27
Derière mon écran
www.youtube.com
Pour la connection qui ne ce fait pas sa provien de ton luncher refait en un si tu a suivi un tuto pour sa moi je te conseille d'en suivre un autre car sa devrai te lancé le chargement, et pour ces erreurs :
at net.minecraft.Launcher.<init>(Launcher.java:27)
at net.minecraft.LauncherFrame.login(LauncherFrame.java:107)
at net.minecraft.LoginForm$5.run(LoginForm.java:102)

C'est normale sa n'importe pas sa n'afflue pas sur ton luncher sa le fait a tous les luncher.

Voila mais si je peut te conseiller un tuto a suivre c'est celui sur youtube qui viens de la chaîne noyalkub : liens de la vidéo :
 

antoinedjazz

Spécialiste serveurs, mods et plugins.
16 Juillet 2012
163
35
135
29
Par contre là c'est en version payante de minecraft et je veux le faire pour les version crack aussi :/ il faut que je change quelle lignes de codes?

Moi j'ais suivi celui ci :

Là je suis un peu fatigué et je risque de faire que de la mer*e donc je fais ça demain et je posterais si ça a marché.

Merci pour tout en tous cas.
 

fujiangci

Aventurier
18 Juillet 2012
2
0
1
39
merci beaucoup d'avoir pris de ton temps pour m'aider.

g.gif
 

koon64122

Codeur du serveur minecraft.fr
2 Septembre 2011
88
8
65
27
Derière mon écran
www.youtube.com
Deriens mais pour le version crack je doute qu'on est le droit d'en parler ici,
Mais ce que je peut te dire c'est cherche les ligne qui dise sa en gros (je te le dit en français tu traduit en java sa te permettra d'avancé),
Si le mot de passe et le nom de compte corresponde a ce qui est enregistrer sur le site alors tu le connecte et tu fait les mise a jour si besoin.

Et tu remplace par:

Tu me connecte sans avoir besoin de mot de passe et tu me fait la mise a jour si besoin.