Bonjour, en essayant de lancer minecraft avec forge j'ai eu cette erreur qui est apparut : fr.flowarg.flowupdater.utils.builderapi.BuilderException: ArgumentVanillaVersion is null !
@Override
public String getName() {
return "home";
}
@Override
public String getStyleSheetPath() {
return "css/content/home.css";
}
@Override
public void init(PanelManager panelManager) {
super.init(panelManager);
RowConstraints rowConstraints = new RowConstraints();
rowConstraints.setValignment(VPos.CENTER);
rowConstraints.setMinHeight(75);
rowConstraints.setMaxHeight(75);
this.layout.getRowConstraints().addAll(rowConstraints, new RowConstraints());
boxPane.getStyleClass().add("box-pane");
setCanTakeAllSize(boxPane);
boxPane.setPadding(new Insets(20));
this.layout.add(boxPane, 0, 0);
this.layout.getStyleClass().add("home-layout");
progressBar.getStyleClass().add("download-progress");
stepLabel.getStyleClass().add("download-status");
fileLabel.getStyleClass().add("download-status");
progressBar.setTranslateY(-15);
setCenterH(progressBar);
setCanTakeAllWidth(progressBar);
stepLabel.setTranslateY(5);
setCenterH(stepLabel);
setCanTakeAllSize(stepLabel);
fileLabel.setTranslateY(20);
setCenterH(fileLabel);
setCanTakeAllSize(fileLabel);
this.showPlayButton();
}
private void showPlayButton() {
boxPane.getChildren().clear();
Button playBtn = new Button("Jouer");
FontAwesomeIconView playIcon = new FontAwesomeIconView(FontAwesomeIcon.GAMEPAD);
playIcon.getStyleClass().add("play-icon");
setCanTakeAllSize(playBtn);
setCenterH(playBtn);
setCenterV(playBtn);
playBtn.getStyleClass().add("play-btn");
playBtn.setGraphic(playIcon);
playBtn.setOnMouseClicked(e -> this.play());
boxPane.getChildren().add(playBtn);
}
private void play() {
isDownloading = true;
boxPane.getChildren().clear();
setProgress(0, 0);
boxPane.getChildren().addAll(progressBar, stepLabel, fileLabel);
Platform.runLater(() -> new Thread(this::update).start());
}
public void update() {
IProgressCallback callback = new IProgressCallback() {
private final DecimalFormat decimalFormat = new DecimalFormat("#.#");
private String stepTxt = "";
private String percentTxt = "0.0%";
@Override
public void step(Step step) {
Platform.runLater(() -> {
stepTxt = StepInfo.valueOf(step.name()).getDetails();
setStatus(String.format("%s (%s)", stepTxt, percentTxt));
});
}
@Override
public void update(long downloaded, long max) {
Platform.runLater(() -> {
percentTxt = decimalFormat.format(downloaded * 100.d / max) + "%";
setStatus(String.format("%s (%s)", stepTxt, percentTxt));
setProgress(downloaded, max);
});
}
public void onFileDownloaded(Path path) {
Platform.runLater(() -> {
String p = path.toString();
fileLabel.setText("..." + p.replace(Launcher.getInstance().getLauncherDir().toFile().getAbsolutePath(), ""));
});
}
};
try {
final VanillaVersion vanillaVersion = new VanillaVersion.VanillaVersionBuilder()
.withName(MinecraftInfos.GAME_VERSION)
.withVersionType(MinecraftInfos.VERSION_TYPE)
.build();
final UpdaterOptions options = new UpdaterOptions.UpdaterOptionsBuilder()
.withEnableCurseForgePlugin(true)
.withEnableOptifineDownloaderPlugin(true)
.build();
List<CurseFileInfos> curseMods = CurseFileInfos.getFilesFromJson(MinecraftInfos.CURSE_MODS_LIST_URL);
List<Mod> mods = Mod.getModsFromJson(MinecraftInfos.MODS_LIST_URL);
final AbstractForgeVersion forge = new ForgeVersionBuilder(MinecraftInfos.FORGE_VERSION_TYPE)
.withForgeVersion(MinecraftInfos.FORGE_VERSION)
.withCurseMods(curseMods)
.withMods(mods)
.withOptifine(new OptifineInfo(MinecraftInfos.OPTIFINE_VERSION, false))
.build();
final FlowUpdater updater = new FlowUpdater.FlowUpdaterBuilder()
.withVersion(vanillaVersion)
.withForgeVersion(forge)
.withLogger(Launcher.getInstance().getLogger())
.withProgressCallback(callback)
.withUpdaterOptions(options)
.build();
updater.update(Launcher.getInstance().getLauncherDir().toFile());
this.startGame(updater.getVersion().getName());
} catch (Exception exception) {
Launcher.getInstance().getLogger().err(exception.toString());
exception.printStackTrace();
Platform.runLater(() -> panelManager.getStage().show());
}
}
public void startGame(String gameVersion) {
GameInfos infos = new GameInfos(
"minecrouft",
false,
new GameVersion(gameVersion, MinecraftInfos.OLL_GAME_TYPE.setNFVD(MinecraftInfos.OLL_FORGE_DISCRIMINATOR)),
new GameTweak[]{}
);
try {
ExternalLaunchProfile profile = MinecraftLauncher.createExternalProfile(infos, GameFolder.FLOW_UPDATER, Launcher.getInstance().getAuthInfos());
profile.getVmArgs().add(this.getRamArgsFromSaver());
ExternalLauncher launcher = new ExternalLauncher(profile);
Platform.runLater(() -> panelManager.getStage().hide());
Process p = launcher.launch();
Platform.runLater(() -> {
try {
p.waitFor();
Platform.exit();
} catch (InterruptedException e) {
e.printStackTrace();
}
});
} catch (Exception exception) {
exception.printStackTrace();
Launcher.getInstance().getLogger().err(exception.toString());
}
}
public String getRamArgsFromSaver() {
int val = 1024;
try {
if (saver.get("maxRam") != null) {
val = Integer.parseInt(saver.get("maxRam"));
} else {
throw new NumberFormatException();
}
} catch (NumberFormatException error) {
saver.set("maxRam", String.valueOf(val));
saver.save();
}
return "-Xmx" + val + "M";
}
public void setStatus(String status) {
this.stepLabel.setText(status);
}
public void setProgress(double current, double max) {
this.progressBar.setProgress(current / max);
}
public boolean isDownloading() {
return isDownloading;
}
public enum StepInfo {
READ("Lecture du fichier json..."),
DL_LIBS("Téléchargement des libraries..."),
DL_ASSETS("Téléchargement des ressources..."),
EXTRACT_NATIVES("Extraction des natives..."),
FORGE("Installation de forge..."),
FABRIC("Installation de fabric..."),
MODS("Téléchargement des mods..."),
EXTERNAL_FILES("Téléchargement des fichier externes..."),
POST_EXECUTIONS("Exécution post-installation..."),
END("Finit !");
String details;
StepInfo(String details) {
this.details = details;
}
public String getDetails() {
return details;
}
}