Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

Commit

Permalink
Added 1.13 Forge support, updated translations
Browse files Browse the repository at this point in the history
  • Loading branch information
Litarvan committed May 28, 2019
1 parent f39508c commit 068f834
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 18 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apply plugin: 'idea'
apply plugin: 'maven-publish'

group = 'fr.litarvan'
version = '3.0.4'
version = '3.0.5'
archivesBaseName = 'openlauncherlib'

sourceCompatibility = 1.6
Expand Down
20 changes: 15 additions & 5 deletions src/main/java/fr/theshark34/openlauncherlib/LanguageManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public class LanguageManager
*/
static
{
ENGLISH.put("hi-int", "OpenLauncherLib 3.0.4 by Adrien 'Litarvan' Navratil - Internal Launching System");
ENGLISH.put("hi-ext", "OpenLauncherLib 3.0.4 by Adrien 'Litarvan' Navratil - External Launching System");
ENGLISH.put("hi-int", "OpenLauncherLib 3.0.5 by Adrien 'Litarvan' Navratil - Internal Launching System");
ENGLISH.put("hi-ext", "OpenLauncherLib 3.0.5 by Adrien 'Litarvan' Navratil - External Launching System");
ENGLISH.put("options", "Options");
ENGLISH.put("ram", "RAM");
ENGLISH.put("warn", "Warning");
Expand All @@ -81,15 +81,20 @@ public class LanguageManager
ENGLISH.put("nat", "Loading the natives");
ENGLISH.put("done", "Done");
ENGLISH.put("ent", "Entire command");
ENGLISH.put("support-forge", "Forge is a free open source library, consider supporting them at http://patreon.com/lexmanos");
ENGLISH.put("old-tweak", "WARNING: You selected tweaking with a version under or equals as 1.5.2, this isn't fully supported, and could cause bugs.");
ENGLISH.put("forge-optifine", "WARNING: You selected Forge tweak with Optifine/Shader, they are ONLY FOR VANILLA, the game wil probably not start, so for security, Optifine/Shader was/were disabled");
ENGLISH.put("tweak-deprec", "WARNING: You selected GameTweaks other than forge with Minecraft 1.13 or greater, the tweaking system has been deleted since, game will probably not start");
ENGLISH.put("forge-old", "WARNING: You selected Forge tweaking with a version under or equals as 1.5.2, forge is supposed to be installed in the jar (not with a tweaker), the game MAY NOT START !");

FRENCH.put("hi-int", "OpenLauncherLib 3.0.4 par Adrien 'Litarvan' Navratil - Systeme de lancement interne");
FRENCH.put("hi-ext", "OpenLauncherLib 3.0.4 par Adrien 'Litarvan' Navratil - Systeme de lancement externe");
FRENCH.put("options", "Options");
FRENCH.put("ram", "RAM");
FRENCH.put("warn", "Attention");
FRENCH.put("splash-interrupted", "Le temps d'attente du splash a été interrompu !");
FRENCH.put("splash-interrupted", "Le temps d'attente du splash a ete interrompu !");
FRENCH.put("ex-caught", "Exception attrapee !");
FRENCH.put("report-error", "Impossible d'écrire le crash report !");
FRENCH.put("report-error", "Impossible d'ecrire le crash report !");
FRENCH.put("ram-empty", "Impossible de lire la RAM : Le fichier est vide");
FRENCH.put("writing-crash", "Ecriture du crash report dans");
FRENCH.put("load-fail", "Impossible de charger le jar");
Expand All @@ -109,7 +114,12 @@ public class LanguageManager
FRENCH.put("nat", "Chargement des natives");
FRENCH.put("done", "Termine");
FRENCH.put("ent", "Commande entiere");
}
FRENCH.put("support-forge", "Forge est une librairie open source, supportez son developpement sur https://patreon.com/lexmanos");
FRENCH.put("old-tweak", "ATTENTION: Vous avez choisi d'utiliser le tweaking avec une version inferieure ou egale a la 1.5.2, ce n'est pas vraiment supporte, des bugs peuvent survenir");
FRENCH.put("forge-optifine", "ATTENTION: Vous avez selectionne les tweaks Forge avec Optifine/Shader, ces derniers sont SEULEMENT POUR LE VANILLA, le jeu ne demarrera sûrement pas, donc Optifine/Shader ont ete desactives");
FRENCH.put("tweak-deprec", "ATTENTION: Vous avez selectione des GameTweaks autre que Forge avec Minecraft 1.13 ou superieur, le systeme de tweaking a ete supprime depuis, le jeu ne demarrera probablement pas");
FRENCH.put("forge-old", "ATTENTION: Vous avez selectionne le tweak Forge avec une version inferieure ou egale a la 1.5.2, forge est sense être installe a l'interieur du jar (et non pas via tweaking), le jeu POURAIT NE PAS DEMARRER !");
}

/**
* Get a translated string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
package fr.theshark34.openlauncherlib.minecraft;

import fr.theshark34.openlauncherlib.minecraft.util.GameDirGenerator;
import fr.theshark34.openlauncherlib.util.LogUtil;

import java.io.File;
import java.util.ArrayList;

Expand Down Expand Up @@ -86,31 +88,39 @@ public GameInfos(String serverName, File gameDir, GameVersion gameVersion, GameT
{
boolean forge = false;
boolean shaderOrOptifine = false;
if (gameVersion.getGameType() == GameType.V1_13_HIGHER_FORGE)
if (tweaks.length == 1 && tweaks[0] == GameTweak.FORGE)
tweaks = new GameTweak[0];
else if (tweaks.length != 0)
LogUtil.info("tweak-deprec");

for (GameTweak tweak : tweaks)
if (tweak.equals(GameTweak.FORGE))
{
if (gameVersion.getGameType().equals(GameType.V1_5_2_LOWER))
System.out.println("[OpenLauncherLib] [WARNING] You selected Forge tweaking with a version under or equals as 1.5.2, forge is supposed to be installed in the jar (not with a tweaker), the game COULD NOT START !");
if (gameVersion.getGameType() == GameType.V1_5_2_LOWER)
LogUtil.info("forge-old");

forge = true;
}
else if (tweak.equals(GameTweak.OPTIFINE) || tweak.equals(GameTweak.SHADER))
else if (tweak == GameTweak.OPTIFINE || tweak == GameTweak.SHADER)
{
shaderOrOptifine = true;
}

if (tweaks.length > 0 && gameVersion.getGameType().equals(GameType.V1_5_2_LOWER))
System.out.println("[OpenLauncherLib] [WARNING] You selected tweaking with a version under or equals as 1.5.2, this isn't fully supported, and could cause bugs.");
if (forge || gameVersion.getGameType() == GameType.V1_13_HIGHER_FORGE)
LogUtil.info("support-forge");

if (tweaks.length > 0 && gameVersion.getGameType() == GameType.V1_5_2_LOWER)
LogUtil.info("old-tweaking");

if (shaderOrOptifine && forge)
{
System.out.println("[OpenLauncherLib] [WARNING] You selected Forge tweak with Optifine/Shader, they are ONLY FOR VANILLA, the game wil probably not start, so for security, Optifine/Shader was/were disabled");
LogUtil.info("forge-optifine");

ArrayList<GameTweak> tweakList = new ArrayList<GameTweak>();

for (GameTweak tweak : tweaks)
if (!tweak.equals(GameTweak.OPTIFINE) && !tweak.equals(GameTweak.SHADER))
if (tweak != GameTweak.OPTIFINE && tweak != GameTweak.SHADER)
tweakList.add(tweak);

this.tweaks = tweakList.toArray(new GameTweak[tweakList.size()]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ public ArrayList<String> getLaunchArgs(GameInfos infos, GameFolder folder, AuthI
version = version.substring(0, version.lastIndexOf('.'));
}

if (infos.getGameVersion().getName().equals("1.13.1") || infos.getGameVersion().getName().equals("1.13.2"))
version = "1.13.1";

arguments.add(version);

arguments.add("--userProperties");
Expand All @@ -253,6 +256,81 @@ public ArrayList<String> getLaunchArgs(GameInfos infos, GameFolder folder, AuthI
}
};

/**
* This is a workaround until a new version of the lib using versions JSON is published
*/
public static final GameType V1_13_HIGHER_FORGE = new GameType()
{
@Override
public String getName()
{
return "1.13 or higher with Forge";
}

@Override
public String getMainClass(GameInfos infos)
{
return "cpw.mods.modlauncher.Launcher";
}

@Override
public ArrayList<String> getLaunchArgs(GameInfos infos, GameFolder folder, AuthInfos authInfos)
{
ArrayList<String> arguments = new ArrayList<String>();

arguments.add("--username=" + authInfos.getUsername());

arguments.add("--accessToken");
arguments.add(authInfos.getAccessToken());

if (authInfos.getClientToken() != null)
{
arguments.add("--clientToken");
arguments.add(authInfos.getClientToken());
}

arguments.add("--version");
arguments.add(infos.getGameVersion().getName());

arguments.add("--gameDir");
arguments.add(infos.getGameDir().getAbsolutePath());

arguments.add("--assetsDir");
File assetsDir = new File(infos.getGameDir(), folder.getAssetsFolder());
arguments.add(assetsDir.getAbsolutePath());

arguments.add("--assetIndex");

arguments.add("1.13.1");

arguments.add("--userProperties");
arguments.add("{}");

arguments.add("--uuid");
arguments.add(authInfos.getUuid());

arguments.add("--userType");
arguments.add("legacy");

arguments.add("--launchTarget");
arguments.add("fmlclient");

arguments.add("--fml.forgeVersion");
arguments.add("25.0.219");

arguments.add("--fml.mcVersion");
arguments.add("1.13.2");

arguments.add("--fml.forgeGroup");
arguments.add("net.minecraftforge");

arguments.add("--fml.mcpVersion");
arguments.add("20190213.203750");

return arguments;
}
};

/**
* The name of the Game Type
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ public static ExternalLaunchProfile createExternalProfile(GameInfos infos, GameF
vmArgs.add("-Dfml.ignorePatchDiscrepancies=true");

if(infos.getGameTweaks() != null)
for (GameTweak tweak : infos.getGameTweaks())
{
args.add("--tweakClass");
args.add(tweak.getTweakClass(infos));
}
for (GameTweak tweak : infos.getGameTweaks())
{
args.add("--tweakClass");
args.add(tweak.getTweakClass(infos));
}

ExternalLaunchProfile profile = new ExternalLaunchProfile(mainClass, classpath, vmArgs, args, true, infos.getServerName(), infos.getGameDir());

Expand Down

0 comments on commit 068f834

Please sign in to comment.