Giter Site home page Giter Site logo

flowarg / flowupdater Goto Github PK

View Code? Open in Web Editor NEW
94.0 5.0 16.0 7.13 MB

The free and open source solution to update Minecraft.

Home Page: https://flowarg.github.io/FlowUpdater

License: GNU General Public License v3.0

Java 100.00%
forge mcp vanilla updater fabric mods curse-mods curseforge json builder

flowupdater's Introduction

version discord-shield

FlowUpdater

Check the Wiki to know how to use FlowUpdater and more information. Currently, all the documentation (only on GitHub, the documentation in the code is up-to-date) isn't up-to-date because I don't have the time currently to make the tutorial.

Legal and fork notices ⚠️

The CurseForge integration works with an API Key which is mine at the moment. You CAN'T use this key for other purposes outside FlowUpdater. If you wish to fork this project, you HAVE TO use your own API Key.

Usage

Vanilla

First, create a new VanillaVersion, specify arguments. Then build the version :

VanillaVersion version = new VanillaVersionBuilder().withName("1.15.2").build();

NOTE : Builders are all static classes except ForgeVersionBuilder.

You have to put the version you want as parameter, you can set a snapshot (you must set the withSnapshot parameter to true) if you want or latest. The most of FlowUpdater objects are buildable: Build a new UpdaterOptions object: I'm not enabling the re-extracting of natives at each update (withReExtractNatives(true)) because FlowUpdater know which natives must be extracted.

UpdaterOptions options = new UpdaterOptionsBuilder().build();

Note that currently UpdaterOptions is useless unless you want to use a custom ExternalFileDeleter or you want to disable the silent reading.

Then, instantiate a new FlowUpdater with FlowUpdaterBuilder#withXArguments#withAnotherArgument#build. Check the code/JavaDoc for more information.

FlowUpdater updater = new FlowUpdaterBuilder().withVanillaVersion(version).withUpdaterOptions(options).withLogger(someCustomLogger).build();

Don't forget to add a progress callback if you want to make a progress bar!

Finally, call the update function :

updater.update(Paths.get("your/path/"));

Forge

(You need to setup a vanilla updater !)

First, in your vanilla version builder, change the version type to VersionType.FORGE. Next, make a List of Mod objects (except if you have no mods to install).

List<Mod> mods = new ArrayList<>();
mods.add(new Mod("OneMod.jar", "sha1ofmod", 85120, "https://link/of/mod.jar"));
mods.add(new Mod("AnotherMod.jar", "sha1ofanothermod", 86120, "https://link/of/another/mod.jar"));

You can also get a list of mods by providing a json link : List<Mod> mods = Mod.getModsFromJson("https://url.com/launcher/mods.json");. A template is available in Mod class.

You can get mods from CurseForge too:

List<CurseFileInfo> modInfos = new ArrayList<>();
// project ID and file ID
modInfos.add(new CurseFileInfo(238222, 2988823));

You can also get a list of curse mods by providing a json link : List<CurseFileInfo> mods = CurseFileInfo.getFilesFromJson("https://url.com/launcher/cursemods.json");.

Then, build a forge version. For example, I will build a NewForgeVersion.

AbstractForgeVersion forgeVersion = new ForgeVersionBuilder(ForgeVersionBuilder.ForgeVersionType.NEW)
            .withForgeVersion("31.2.29")
            .withCurseMods(modInfos)
            .withOptiFine(new OptiFineInfo("1.16.3_HD_U_G3")) // installing OptiFine for 1.16.3, false = not a preview
            .withFileDeleter(new ModFileDeleter("jei.jar")) // delete bad mods, don't remove the file jei.jar if it's present in the mods' dir.
            .build();

Finally, set the Forge version corresponding to the wanted Forge version :

.withModLoaderVersion(forgeVersion);

That's all!

MCP

(You need to setup a vanilla updater !) In your vanilla version builder, change the version type to VersionType.MCP. Finally, set to vanilla version builder a MCP version :

.withMCP(new MCP("clientURL", "clientSha1", 25008229));

If you set an empty/null string in url and sha1 and 0 in size, the updater will use the default minecraft jar. Example on client-only mcp downloading :

.withMCP(new MCP("https://mighya.eu/resources/Client.jar", "f2c219e485831af2bae9464eebbe4765128c6ad6", 23005862));

You can get an MCP object instance by providing a json link too : .withMCP("https://url.com/launcher/mcp.json");. Nothing else to add :).

Fabric

(You need to setup a vanilla updater !)

First, in your vanilla version builder, change the version type to VersionType.FABRIC. Next, make a List of Mod objects like for a ForgeVersion.

Then, build a Fabric version.

FabricVersion fabricVersion = new FabricVersionBuilder()
            .withFabricVersion("0.10.8")
            .withCurseMods(modInfos)
            .withMods(mods)
            .withFileDeleter(new ModFileDeleter("sodium.jar")) // delete bad mods ; but it won't remove the file sodium.jar if it's present in the mods' dir.
            .build();

Finally, set the Fabric version corresponding to the wanted Fabric version :

.withModLoaderVersion(fabricVersion);

That's all!

External Files

With FlowUpdater, you can download other files in your update dir! In your FlowUpdaterBuilder, precise an array list of ExternalFile (can be got by ExternalFile#getExternalFilesFromJson).

About json files...

All json files can be generated by the FlowUpdaterJsonCreator !

Post executions

With FlowUpdater, you can execute some actions after update, like patch a file, kill a process, launch a process, review a config etc... In your FlowUpdaterBuilder, precise a list of Runnable.

And all it's done !

flowupdater's People

Contributors

antoineok avatar boul2gom avatar dailycraft avatar flowarg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

flowupdater's Issues

No progress callback for Forge download

Hi Flow,
I'm using your library to create a Minecraft launcher with Forge. I implemented the update method for FlowUpdater progress callback to display download step in my UI. It works like a charm while downloading vanilla minecraft.
But as soon as it starts to download Forge / mods, there is not possibility to keep track of the download progress.

Is it a missing feature ? Or is it me who missed something ?

BUG : Impossible de démarrer le jeu avec mc forge 1.12.2

Bonjour/Bonsoir,

Quand je démarre le téléchargement des fichiers du jeu, tout semble fonctionner (les assets, libs, natives et le client.jar sont bien mis) mais lorsque l'installation de forge se déroule, non seulement je trouve qu'elle est très rapide mais le jeu ne semble pas être patché et du coup il ne démarre pas car il ne trouve pas la classe net.minecraft.launchwrapper.Launch qui vient de forge.

Voici le code de l'updater :

image

et voici les logs de l'installateur de forge présent dans le dossier de destination (je précise qu'avec cette même version prise sur internet c'est-à-dire sur le site de mc forge et bien ça fonctionne nickel) :

image

PS : j'ai essayé de mettre dans le build.gradle la lib jdom pour voir si ça allait changer quelque chose mais nope

PS 2 : Je suis sur ArchLinux avec le Java 8 de Oracle

Curse Forge Token

Hey are you sure its a good idea for you to upload your curse forge api token to a public repository.... thats really not something you should be doing with any sort of api tokens and just asking people nicely to change it when forking is something that i don't think will work out for you it might be better for you to just have it in some sort of configuration along with a guide for users to help them create a token?

fr.flowarg.flowupdater.utils.builderapi.BuilderException: ArgumentVanillaVersion is null !

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 !

Console : [03:47:59] [minecrouft] [ERROR]: fr.flowarg.flowupdater.utils.builderapi.BuilderException: ArgumentVanillaVersion is null ! fr.flowarg.flowupdater.utils.builderapi.BuilderException: ArgumentVanillaVersion is null ! at fr.flowarg.flowupdater.utils.builderapi.BuilderArgument.get(BuilderArgument.java:60) at fr.flowarg.flowupdater.versions.ForgeVersionBuilder.build(ForgeVersionBuilder.java:112) at fr.launcher.ui.panels.pages.Home.update(Home.java:164) at java.base/java.lang.Thread.run(Thread.java:832)

ma classe Home.java

`package fr.launcher.ui.panels.pages;

import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon;
import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView;
import fr.flowarg.flowupdater.FlowUpdater;
import fr.flowarg.flowupdater.download.IProgressCallback;
import fr.flowarg.flowupdater.download.Step;
import fr.flowarg.flowupdater.download.VanillaDownloader;
import fr.flowarg.flowupdater.download.VanillaReader;
import fr.flowarg.flowupdater.download.json.CurseFileInfos;
import fr.flowarg.flowupdater.download.json.Mod;
import fr.flowarg.flowupdater.download.json.OptifineInfo;
import fr.flowarg.flowupdater.utils.UpdaterOptions;
import fr.flowarg.flowupdater.versions.AbstractForgeVersion;
import fr.flowarg.flowupdater.versions.ForgeVersionBuilder;
import fr.flowarg.flowupdater.versions.VanillaVersion;
import fr.flowarg.flowupdater.versions.VersionType;
import fr.launcher.Launcher;
import fr.launcher.game.MinecraftInfos;
import fr.launcher.ui.PanelManager;
import fr.launcher.ui.panels.pages.content.ContentPanel;
import fr.theshark34.openlauncherlib.external.ExternalLaunchProfile;
import fr.theshark34.openlauncherlib.external.ExternalLauncher;
import fr.theshark34.openlauncherlib.minecraft.*;
import fr.theshark34.openlauncherlib.util.Saver;
import javafx.application.Platform;
import javafx.geometry.Insets;
import javafx.geometry.VPos;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ProgressBar;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.RowConstraints;

import java.io.File;
import java.nio.file.Path;
import java.text.DecimalFormat;
import java.util.List;

public class Home extends ContentPanel {
private final Saver saver = Launcher.getInstance().getSaver();
GridPane boxPane = new GridPane();
ProgressBar progressBar = new ProgressBar();
Label stepLabel = new Label();
Label fileLabel = new Label();
boolean isDownloading = false;

@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;
    }
}

}
`

Si vous pouvez m'aider ça serait super

Incorrect link generated when an OptiFine version (preview) is provided without the preview_ prefix

Hi flow !
I may have found a bug for preview version of optifine.
Describe the bug
When I try to download the last preview of optifine (OptiFine HD U I2 pre5), I get a FlowUpdaterException. I am award that it might be my fault since the optifine version is filled in a string.

To Reproduce
Steps to reproduce the behavior:

  • Create all the needed stuff to download minecraft 1.19.3 with forge 44.1.17.
  • When creating the AbstractForgeVersion, add the following line :
.withOptiFine(new OptiFineInfo("1.19.3_HD_U_I2_pre5", true))
  • See the exception.

Expected behavior
No exception and a flawless download.

Desktop (please complete the following information):

  • OS: Windows 11
  • Java 8

Additional context
I had a look at your OptiFineIntegration code, and to me, the jar name is good, so it shouldn't be a name problem

            final String name = preview ?
                    (optiFineVersion.contains("preview_") && optiFineVersion.contains("OptiFine_") ?
                            optiFineVersion + ".jar" :
                            "preview_OptiFine_" + optiFineVersion + ".jar") :
                    "OptiFine_" + optiFineVersion + ".jar";

Also, does it not make more sense to detect if a version is a preview in the OptiFineInfo(name) constructor than having a boolean parameter that you can miss ? Or does the preview version name of optifine vary that much ?

BUG : Cannot use the Updater

Describe the bug
Cannot use the Updater

To Reproduce
Steps to reproduce the behavior:
Try to use the updater

Screenshots
image
image

Desktop (please complete the following information):
Operating System: Manjaro Linux
KDE Plasma Version: 5.19.4
KDE Frameworks Version: 5.73.0
Qt Version: 5.15.0
Kernel Version: 5.7.17-2-MANJARO
OS Type: 64-bit

BUG : No Sound, Background and Icon

Describe the bug
No Sound, Background and Game icon

To Reproduce
Steps to reproduce the behavior:

  1. Launching minecraft using this code:
private static void launch(String username, int memory, boolean update) throws Exception {
    if (update) {
        VanillaVersion version = new VanillaVersion.VanillaVersionBuilder()
            .withName("1.19.4")
            .build();
        FabricVersion builder = new FabricVersion.FabricVersionBuilder()
            .withFabricVersion("0.14.22")
            .withModrinthModPack(new ModrinthModPackInfo("WTNMThBB", true))
            .build();
        FlowUpdater updater = new FlowUpdater.FlowUpdaterBuilder()
            .withVanillaVersion(version)
            .withModLoaderVersion(builder)
            .build();
        updater.update(GameDirGenerator.createGameDir("neverland", true));
    }

    GameInfos infos = new GameInfos("neverland", new GameVersion("1.19.4", GameType.FABRIC), new GameTweak[]{});
    AuthInfos authInfos = new AuthInfos(username, "token", "uuid");
    ExternalLaunchProfile profile = MinecraftLauncher.createExternalProfile(infos, GameFolder.FLOW_UPDATER_1_19_SUP, authInfos);
    profile.getVmArgs().add(0, "-Xmx" + memory + "M");
    profile.getVmArgs().add(0, "-Xms" + memory + "M");
    ExternalLauncher launcher = new ExternalLauncher(profile);
    Process game = launcher.launch();
}

Expected behavior
The launched client should have sound and background image in the main menu

BUG : mod launcher throw java.util.NoSuchElementException: No value present

Hi ! First of all, I am not 100% it is a bug or just me.

Describe the bug
I am installing a minecraft 1.19.3 with forge (44.1.17) and optifine (1.19.3_HD_U_I2_pre5). The download is going well but as soon as I launch minecract, the forge modLauncher crash with a NoSuchElementException (see the logs below).

To Reproduce
Steps to reproduce the behavior:

        VanillaVersion version = new VanillaVersionBuilder().withName("1.19.3").build();
        UpdaterOptions options = new UpdaterOptionsBuilder().build();
        AbstractForgeVersion forgeVersion = new ForgeVersionBuilder(ForgeVersionBuilder.ForgeVersionType.NEW)
            .withForgeVersion("44.1.17")
            .withOptiFine(new OptiFineInfo("preview_OptiFine_1.19.3_HD_U_I2_pre5", true))
            .build();
        FlowUpdater updater = new FlowUpdaterBuilder()
            .withVanillaVersion(version)
            .withUpdaterOptions(options)
            .withModLoaderVersion(forgeVersion)
            .build()
  1. wait for the download.
  2. See error

Expected behavior
No exception.

Logs

Here is the few logs just before the exception.

[12:16:12] [main/INFO]: ModLauncher running: args [--username, MyUsername, --version, 1.19.3, --gameDir, path\to\my\folder, --assetsDir, path\to\my\folder\assets, --assetIndex, 1.19, --uuid, 3b855cd86d9f4552a06267bc38feb8fc, --accessToken, ????????, --userType, mojang, --versionType, release, --launchTarget, fmlclient, --fml.forgeVersion, 44.1.17, --fml.mcVersion, 1.19.3, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20221207.122022]
[12:16:12] [main/INFO]: ModLauncher 10.0.8+10.0.8+main.0ef7e830 starting: java version 17.0.4 by Oracle Corporation; OS Windows 11 arch amd64 version 10.0
Exception in thread "main" java.util.NoSuchElementException: No value present
        at java.base/java.util.Optional.orElseThrow(Optional.java:377)
        at cpw.mods.modlauncher.LaunchServiceHandler.lambda$new$0(LaunchServiceHandler.java:39)
        at cpw.mods.modlauncher.util.ServiceLoaderUtils.streamServiceLoader(ServiceLoaderUtils.java:33)
        at cpw.mods.modlauncher.LaunchServiceHandler.<init>(LaunchServiceHandler.java:39)
        at cpw.mods.modlauncher.Launcher.<init>(Launcher.java:53)
        at cpw.mods.modlauncher.Launcher.main(Launcher.java:77)

I dig a bit into the full log to see if some step where failing ... I found the following but after some searching, I don't think it is related.

...
Forge Auto Renaming Tool v0.1.22
log: null
input: path\to\my\folder\libraries\net\minecraft\client\1.19.3-20221207.122022\client-1.19.3-20221207.122022-slim.jar       
output: path\to\my\folder\libraries\net\minecraft\client\1.19.3-20221207.122022\client-1.19.3-20221207.122022-srg.jar       
threads: 16
Names: path\to\my\folder\libraries\de\oceanlabs\mcp\mcp_config\1.19.3-20221207.122022\mcp_config-1.19.3-20221207.122022-mappings-merged.txt(reversed: false)
Fix Annotations: true
Fix Records: true
Fix Identifiers: ALL
Fix SourceFile: JAVA
Fix Line Numbers: false
Strip codesigning signatures: false
Adding Libraries to Inheritance
Reading Input:path\to\my\folder\libraries\net\minecraft\client\1.19.3-20221207.122022\client-1.19.3-20221207.122022-slim.jar
Adding input to inheritence map
Processing entries
Cant Find Class: com/google/common/collect/ImmutableMap$Builder
...

followed by a huge list of class not found.

Desktop (please complete the following information):

  • OS: Windows 11

Additional context
I managed to make my launcher work with minecraft 1.16.5, but now with 1.19.3 it crashs. I am using java 17, might be a reason for the crash ?
Also, I installed forge and optifine manualy, launch them through the official minecraft launcher : everything is working.

BUG : Fabric URL doesn't exist (UnknownHostException)

Describe the bug
When i try to download latest fabric version using FabricVersionBuilder it doesn't download the fabric file.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new kotlin project
  2. Create new FabricVersion using FabricVersionBuilder
val builder = FabricVersionBuilder()
    .withFabricVersion("0.14.22")
    .build()
  1. Create new FlowUpdater using FlowUpdaterBuilder
val updater = FlowUpdater.FlowUpdaterBuilder()
    .withModLoaderVersion(builder)
    .build()
  1. Use FlowUpdater#update
  2. See error
5:27:56 PM: Executing 'run'...

> Task :processResources NO-SOURCE
> Task :prepareAppResources NO-SOURCE
> Task :compileKotlin
> Task :compileJava NO-SOURCE
> Task :classes UP-TO-DATE
> Task :jar

> Task :run
[05:28:00] [FlowUpdater] [INFO]: ------------------------- FlowUpdater for Minecraft no v1.8.1 -------------------------
[05:28:00] [FlowUpdater] [INFO]: Default callback will be used.
[05:28:00] [FlowUpdater] [INFO]: Checking library files...
[05:28:00] [FlowUpdater] [INFO]: Checking assets...
[05:28:00] [FlowUpdater] [INFO]: All vanilla files were successfully downloaded!
[05:28:00] [FlowUpdater] [INFO]: Installing Fabric, version: 0.14.22...
[05:28:00] [FlowUpdater] [INFO]: Downloading fabric installer...
[05:28:01] [FlowUpdater] [INFO]: Launching fabric installer...
Loading Fabric Installer: 0.11.2
Installing no with fabric 0.14.22
service FabricService{meta='https://meta.fabricmc.net/', maven='https://maven.fabricmc.net/'} failed: java.io.IOException: HTTP request to https://meta.fabricmc.net/v2/versions/loader/no/0.14.22/profile/json failed: 400
service FabricService{meta='https://meta2.fabricmc.net/', maven='https://maven2.fabricmc.net/'} failed: java.io.IOException: HTTP request to https://meta2.fabricmc.net/v2/versions/loader/no/0.14.22/profile/json failed: 400
service FabricService{meta='https://meta3.fabricmc.net/', maven='https://maven3.fabricmc.net/'} failed: java.net.UnknownHostException: meta3.fabricmc.net
[05:28:03] [FlowUpdater] [INFO]: Exception in thread "main" java.lang.RuntimeException: Failed to install Client
[05:28:03] [FlowUpdater] [INFO]: 	at net.fabricmc.installer.Main.main(Main.java:89)
[05:28:03] [FlowUpdater] [INFO]: Caused by: java.io.IOException: HTTP request to https://meta.fabricmc.net/v2/versions/loader/no/0.14.22/profile/json failed: 400
[05:28:03] [FlowUpdater] [INFO]: 	at net.fabricmc.installer.util.Utils.openUrl(Utils.java:148)
[05:28:03] [FlowUpdater] [INFO]: 	at net.fabricmc.installer.util.Utils.readString(Utils.java:90)
[05:28:03] [FlowUpdater] [INFO]: 	at net.fabricmc.installer.util.FabricService.lambda$queryMetaJson$0(FabricService.java:36)
[05:28:03] [FlowUpdater] [INFO]: 	at net.fabricmc.installer.util.FabricService.invokeWithFallbacks(FabricService.java:79)
[05:28:03] [FlowUpdater] [INFO]: 	at net.fabricmc.installer.util.FabricService.queryMetaJson(FabricService.java:36)
[05:28:03] [FlowUpdater] [INFO]: 	at net.fabricmc.installer.client.ClientInstaller.install(ClientInstaller.java:60)
[05:28:03] [FlowUpdater] [INFO]: 	at net.fabricmc.installer.client.ClientHandler.installCli(ClientHandler.java:181)
[05:28:03] [FlowUpdater] [INFO]: 	at net.fabricmc.installer.Main.main(Main.java:87)
[05:28:03] [FlowUpdater] [INFO]: 	Suppressed: java.io.IOException: HTTP request to https://meta2.fabricmc.net/v2/versions/loader/no/0.14.22/profile/json failed: 400
[05:28:03] [FlowUpdater] [INFO]: 		... 8 more
[05:28:03] [FlowUpdater] [INFO]: 	Suppressed: java.net.UnknownHostException: meta3.fabricmc.net
[05:28:03] [FlowUpdater] [INFO]: 		at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:572)
[05:28:03] [FlowUpdater] [INFO]: 		at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327)
[05:28:03] [FlowUpdater] [INFO]: 		at java.base/java.net.Socket.connect(Socket.java:633)
[05:28:03] [FlowUpdater] [INFO]: 		at java.base/sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:304)
[05:28:03] [FlowUpdater] [INFO]: 		at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:178)
[05:28:03] [FlowUpdater] [INFO]: 		at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:533)
[05:28:03] [FlowUpdater] [INFO]: 		at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:638)
[05:28:03] [FlowUpdater] [INFO]: 		at java.base/sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:266)
[05:28:03] [FlowUpdater] [INFO]: 		at java.base/sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:380)
[05:28:03] [FlowUpdater] [INFO]: 		at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:193)
[05:28:03] [FlowUpdater] [INFO]: 		at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1242)
[05:28:03] [FlowUpdater] [INFO]: 		at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1128)
[05:28:03] [FlowUpdater] [INFO]: 		at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:179)
[05:28:03] [FlowUpdater] [INFO]: 		at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:142)
[05:28:03] [FlowUpdater] [INFO]: 		at net.fabricmc.installer.util.Utils.openUrl(Utils.java:145)
[05:28:03] [FlowUpdater] [INFO]: 		... 7 more
[05:28:03] [FlowUpdater] [ERROR]: An error occurred : java.nio.file.NoSuchFileException: C:\Users\xii69\AppData\Roaming\.nlmc\.flowupdater\tempfabric\versions\fabric-loader-0.14.22-no\fabric-loader-0.14.22-no.json
	at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:85)
	at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
	at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
	at java.base/sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:236)
	at java.base/java.nio.file.Files.newByteChannel(Files.java:380)
	at java.base/java.nio.file.Files.newByteChannel(Files.java:432)
	at java.base/java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:422)
	at java.base/java.nio.file.Files.newInputStream(Files.java:160)
	at java.base/java.nio.file.Files.newBufferedReader(Files.java:2922)
	at java.base/java.nio.file.Files.readAllLines(Files.java:3412)
	at fr.flowarg.flowupdater.versions.FabricBasedVersion.parseAndMoveJson(FabricBasedVersion.java:42)
	at fr.flowarg.flowupdater.versions.FabricVersion.install(FabricVersion.java:125)
	at fr.flowarg.flowupdater.FlowUpdater.installModLoader(FlowUpdater.java:221)
	at fr.flowarg.flowupdater.FlowUpdater.installModLoader(FlowUpdater.java:212)
	at fr.flowarg.flowupdater.FlowUpdater.updateMinecraft(FlowUpdater.java:147)
	at fr.flowarg.flowupdater.FlowUpdater.update(FlowUpdater.java:126)
	at Minecraft$download$1.invokeSuspend(Minecraft.kt:20)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)

Highlight:
service FabricService{meta='https://meta3.fabricmc.net/', maven='https://maven3.fabricmc.net/'} failed: java.net.UnknownHostException: meta3.fabricmc.net
[05:28:03] [FlowUpdater] [INFO]: Exception in thread "main" java.lang.RuntimeException: Failed to install Client

Desktop:

  • OS and Version:
    image

Additional context
Full code:

CoroutineScope(Dispatchers.Default).launch {
    val builder = FabricVersionBuilder()
        .withFabricVersion("0.14.22")
        .build()
    val updater = FlowUpdater.FlowUpdaterBuilder()
        .withModLoaderVersion(builder)
        .build()
    updater.update(GameDirGenerator.createGameDir("nlmc", true))
}

Game folder content (C:\Users\<user>\AppData\Roaming\.nlmc):

C:.
+---.flowupdater
|   |   fabric-installer-0.11.2.jar
|   |
|   \---tempfabric
|       \---versions
|           \---fabric-loader-0.14.22-no
|                   fabric-loader-0.14.22-no.jar
|
+---assets
+---libraries
\---natives

BUG : Impossible de mettre à jour le jeu avec mon Launcher

Bonjour / Bonsoir,
Lors de la mise-à-jour du jeu j'ai une erreur...

Logs concernés :

[05:45:10] [NywenLauncher] [INFO]: Lancement du launcher.
[05:45:12] [NywenLauncher] [INFO]: Rafraichissement du compte Microsoft.
[05:45:19] [NywenLauncher] [INFO]: Downloading NywenClient.json from https://nywenmc.github.io/assets/nywenclient/NywenClient.json...
[05:45:20] [NywenLauncher] [INFO]: ------------------------- FlowUpdater for Minecraft NywenClient v1.8.1 -------------------------
[05:45:20] [NywenLauncher] [INFO]: Mise-�-jour du jeu
[05:45:20] [NywenLauncher] [INFO]: Reading data about NywenClient Minecraft version...
[OpenLauncherLib] Exception attrapee !
# NywenMC Crash Report
#
# At : 2023/09/13 17:45:20
#
# Exception : NullPointerException

# java.lang.NullPointerException
#     fr.flowarg.flowupdater.download.VanillaReader.parseClient(VanillaReader.java:139)
#     fr.flowarg.flowupdater.download.VanillaReader.read(VanillaReader.java:67)
#     fr.flowarg.flowupdater.FlowUpdater.loadVanillaStuff(FlowUpdater.java:159)
#     fr.flowarg.flowupdater.FlowUpdater.updateMinecraft(FlowUpdater.java:139)
#     fr.flowarg.flowupdater.FlowUpdater.update(FlowUpdater.java:126)
#     fr.nywenmc.nywenlauncher.NywenLauncher.lambda$update$1(NywenLauncher.java:146)
#     java.lang.Thread.run(Thread.java:750)
[OpenLauncherLib] Ecriture du crash report dans C:\Users\***\AppData\Roaming\.nywenmc\launcher-crashes\crash-0.txt

(NywenLauncher est le launcher de mon serveur minecraft)

Voici le code de ma méthode de mise-à-jour :

public static void update() {
  if (authInfos == null) return;

  Frame.getInstance().getPanel().setProgressBarText("Mise-à-jour du jeu");
  Frame.getInstance().getPanel().getProgressBar().setValue(100);
  Frame.getInstance().getPanel().getPlayBtn().setEnabled(false);
  Frame.getInstance().getPanel().getDisconnectBtn().setEnabled(false);

  Thread t = new Thread(() -> {
    try {
      MCP mcp = MCP.getMCPFromJson("https://nywenmc.github.io/assets/nywenlauncher/MCP-Version.json");
      JsonObject versionJSON = IOUtils.readJson(new URL("https://nywenmc.github.io/assets/nywenclient/NywenClient.json")).getAsJsonObject();
      IOUtils.download(logger, new URL("https://nywenmc.github.io/assets/nywenclient/NywenClient.json"), gameDir.resolve("NywenClient.json"));
      VanillaVersion version = new VanillaVersion.VanillaVersionBuilder().withCustomVersionJson(versionJSON).withName("NywenClient").withMCP(mcp).build();

      IProgressCallback callback = new IProgressCallback() {
        public void init(ILogger logger) {
          logger.info("Mise-à-jour du jeu");
        }

        public void step(Step step) {
          Frame.getInstance().getPanel().setProgressBarText((UpdaterMessages.valueOf(step.name())).msg);
        }

        public void onFileDownloaded(Path path) {
          Frame.getInstance().getPanel().setProgressBarText(path.getFileName().toString());
        }

        public void update(DownloadList.DownloadInfo info) {
          int progress = (int)(info.getDownloadedBytes() * 100 L / info.getTotalToDownloadBytes());
          NywenLauncher.logger.info("Mise-à-jour : " + progress + "%");
          Frame.getInstance().getPanel().getProgressBar().setValue(progress);
        }
      };

      FlowUpdater updater = new FlowUpdater.FlowUpdaterBuilder().withLogger(logger).withProgressCallback(callback).withVanillaVersion(version).build();
      updater.update(gameDir);
    } catch (Exception e) {
      Frame.getInstance().getPanel().getProgressBar().setForeground(Color.RED);
      Frame.getInstance().getPanel().getProgressBar().setBorderPainted(false);
      Frame.getInstance().getPanel().setProgressBarText("Impossible de mettre-à-jour le jeu");
      Frame.getInstance().getPanel().getProgressBar().setValue(100);
      getCrashReporter().catchError(e, "Echec de la mise-du jeu.");
    }

    try {
      launch();
    } catch (Exception e) {
      Frame.getInstance().getPanel().getProgressBar().setForeground(Color.RED);
      Frame.getInstance().getPanel().getProgressBar().setBorderPainted(false);
      Frame.getInstance().getPanel().setProgressBarText("Impossible de lancer le jeu");
      Frame.getInstance().getPanel().getProgressBar().setValue(100);
      getCrashReporter().catchError(e, "Echec du lancement du jeu.");
    }
  });

  t.start();
}

Merci !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.