Skip to content

Commit e6410e8

Browse files
committed
Workaround for MultiMC/Launcher#4400
1 parent 71ac683 commit e6410e8

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

build.gradle

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,5 @@ publishing {
9191
tasks.publish.dependsOn build
9292

9393
static String getVersionSuffix() {
94-
if (System.getenv("IS_PUBLICATION") != null) {
95-
return ""
96-
} else if (System.getenv("GITHUB_RUN_NUMBER") != null && System.getenv("GITHUB_SHA") != null) {
97-
return "-s." + System.getenv("GITHUB_RUN_NUMBER") + "-" + System.getenv("GITHUB_SHA").substring(0, 7)
98-
}
99-
return "-LOCAL"
94+
return ""
10095
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11

22
org.gradle.daemon = false
33

4-
fw_version = 1.5.5
4+
fw_version = mmc2

src/main/java/io/github/zekerzhayard/forgewrapper/installer/detector/IFileDetector.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,24 @@ default boolean checkExtraFiles(String forgeFullVersion) {
179179
// Check all cached libraries.
180180
boolean checked = true;
181181
for (Map.Entry<String, Path> entry : libsMap.entrySet()) {
182-
checked = checkExtraFile(entry.getValue(), hashMap.get(entry.getKey() + "_SHA"));
182+
String sha1 = "";
183+
String entryKey = entry.getKey();
184+
/**
185+
* NOTE: workaround for https://github.com/MultiMC/Launcher/issues/4400
186+
* We ignore the hash of the client file and instead just rely on it being 'correct, maybe' if it's present at all
187+
*/
188+
System.out.println("Checking: " + entryKey);
189+
if(!entryKey.equals("PATCHED")) {
190+
sha1 = hashMap.get(entryKey + "_SHA");
191+
}
192+
checked = checkExtraFile(entry.getValue(), sha1);
183193
if (!checked) {
184194
System.out.println("Missing: " + entry.getValue());
185195
break;
186196
}
187197
}
188198
return checked;
189-
}
199+
}
190200
// Skip installing process if installer profile doesn't exist.
191201
return true;
192202
}
@@ -198,7 +208,13 @@ default boolean checkExtraFiles(String forgeFullVersion) {
198208
* @return True represents the file is ready.
199209
*/
200210
static boolean checkExtraFile(Path path, String sha1) {
201-
return sha1 == null || sha1.equals("") || (isFile(path) && sha1.toLowerCase(Locale.ENGLISH).equals(getFileSHA1(path)));
211+
if (!isFile(path)) {
212+
return false;
213+
}
214+
if(sha1 == null || sha1.equals("")) {
215+
return true;
216+
}
217+
return sha1.toLowerCase(Locale.ENGLISH).equals(getFileSHA1(path));
202218
}
203219

204220
static boolean isFile(Path path) {

0 commit comments

Comments
 (0)