try to fix alternative intermediary usage
All checks were successful
Publish to snapshot maven / build (push) Successful in 21s
All checks were successful
Publish to snapshot maven / build (push) Successful in 21s
This commit is contained in:
parent
d869085dd8
commit
0a602a5012
|
@ -7,7 +7,7 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "dev.frogmc"
|
group = "dev.frogmc"
|
||||||
version = "0.0.1-alpha.21"
|
version = "0.0.1-alpha.22"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
|
|
|
@ -131,38 +131,47 @@ public class MinecraftGamePlugin implements GamePlugin {
|
||||||
if (!Files.exists(remappedGamePath)) {
|
if (!Files.exists(remappedGamePath)) {
|
||||||
MappingBundle mappings;
|
MappingBundle mappings;
|
||||||
String mappingPath = System.getProperty(SystemProperties.INTERMEDIARY_MAPPINGS);
|
String mappingPath = System.getProperty(SystemProperties.INTERMEDIARY_MAPPINGS);
|
||||||
if (mappingPath != null) {
|
|
||||||
URL resource = this.getClass().getResource("");
|
|
||||||
String data;
|
|
||||||
if (resource != null) {
|
|
||||||
data = new BufferedReader(new InputStreamReader(resource.openStream())).lines().collect(Collectors.joining("\n"));
|
|
||||||
} else {
|
|
||||||
data = Files.readString(Paths.get(mappingPath));
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
mappings = TinyV2Parser.parse(data);
|
if (mappingPath != null) {
|
||||||
} catch (IllegalStateException e) {
|
mappings = readIntemediaryMappings(mappingPath);
|
||||||
throw new IllegalStateException("Failed to read intermediary mappings: " + data, e);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
mappings = MojmapProvider.get(version, remappedGamePath.resolveSibling("client-" + version + ".txt")).orElseGet(() -> {
|
mappings = MojmapProvider.get(version, remappedGamePath.resolveSibling("client-" + version + ".txt")).orElse(null);
|
||||||
LOGGER.warn("Failed to retrieve/parse mojmap for {}! If it isn't available you will need to specify intermediary mappings yourself!", version);
|
}
|
||||||
return null;
|
if (mappings == null) {
|
||||||
});
|
mappings = readIntemediaryMappings("mappings/mappings.tiny");
|
||||||
}
|
}
|
||||||
if (mappings != null) {
|
if (mappings != null) {
|
||||||
Thyroxine.remap(mappings.flattenData(), gamePath, remappedGamePath, true, false);
|
Thyroxine.remap(mappings.flattenData(), gamePath, remappedGamePath, true, false);
|
||||||
} else {
|
return;
|
||||||
runtimePath = gamePath;
|
|
||||||
LOGGER.warn("No intermediary mappings found! The game will be launched obfuscated. Mods are likely to error!");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.error("Failed to remap game: ", e);
|
||||||
|
}
|
||||||
|
runtimePath = gamePath;
|
||||||
|
LOGGER.error("No intermediary mappings found! The game will be launched obfuscated. Mods are likely to error! " +
|
||||||
|
"You may need to specify the path of your mappings manually. " +
|
||||||
|
"Use -D"+SystemProperties.INTERMEDIARY_MAPPINGS+" to specify a file!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FrogLoaderImpl.getInstance().getClassloader().addURL(runtimePath.toUri().toURL());
|
FrogLoaderImpl.getInstance().getClassloader().addURL(runtimePath.toUri().toURL());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private MappingBundle readIntemediaryMappings(String path) throws IOException {
|
||||||
|
URL resource = this.getClass().getResource(path);
|
||||||
|
String data;
|
||||||
|
if (resource != null) {
|
||||||
|
data = new BufferedReader(new InputStreamReader(resource.openStream())).lines().collect(Collectors.joining("\n"));
|
||||||
|
} else {
|
||||||
|
data = Files.readString(Paths.get(path));
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return TinyV2Parser.parse(data);
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
throw new IllegalStateException("Failed to read intermediary mappings: " + data, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull String queryVersion() {
|
public @NotNull String queryVersion() {
|
||||||
return version;
|
return version;
|
||||||
|
|
Loading…
Reference in a new issue