add mod locations to mod lists, allow for specifying other intermediary mappings
Some checks failed
Publish to snapshot maven / build (push) Failing after 1m21s
Some checks failed
Publish to snapshot maven / build (push) Failing after 1m21s
This commit is contained in:
parent
a0c7d27fec
commit
34cd3f1dac
|
@ -7,7 +7,7 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "dev.frogmc"
|
group = "dev.frogmc"
|
||||||
version = "0.0.1-alpha.15"
|
version = "0.0.1-alpha.16"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[versions]
|
[versions]
|
||||||
|
|
||||||
thyroxine = "0.0.1-alpha.6"
|
thyroxine = "0.0.1-alpha.9"
|
||||||
nightconfig = "3.7.3"
|
nightconfig = "3.7.3"
|
||||||
mixin = "0.14.0+mixin.0.8.6"
|
mixin = "0.14.0+mixin.0.8.6"
|
||||||
annotations = "24.1.0"
|
annotations = "24.1.0"
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package dev.frogmc.frogloader.impl.mod;
|
package dev.frogmc.frogloader.impl.mod;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -49,6 +50,16 @@ public class ModUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.append(p.id()).append(" (").append(p.name()).append(") ").append(" ").append(p.version());
|
builder.append(p.id()).append(" (").append(p.name()).append(") ").append(" ").append(p.version());
|
||||||
|
if (indent.get() == 2 && !p.paths().isEmpty()) {
|
||||||
|
Path source = p.paths().stream().findFirst().orElseThrow();
|
||||||
|
System.out.println(source);
|
||||||
|
String path = source.toString();
|
||||||
|
if (path.startsWith(".")) {
|
||||||
|
builder.append(" from ").append(path.substring(2));
|
||||||
|
} else if (path.length() > 2) {
|
||||||
|
builder.append(" from ").append(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
for (String s : children) {
|
for (String s : children) {
|
||||||
printMod(mods, mods.get(s), builder, indent, parentToChildIdMap);
|
printMod(mods, mods.get(s), builder, indent, parentToChildIdMap);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,9 @@ import dev.frogmc.frogloader.impl.FrogLoaderImpl;
|
||||||
import dev.frogmc.frogloader.impl.mod.ModPropertiesImpl;
|
import dev.frogmc.frogloader.impl.mod.ModPropertiesImpl;
|
||||||
import dev.frogmc.frogloader.impl.util.SystemProperties;
|
import dev.frogmc.frogloader.impl.util.SystemProperties;
|
||||||
import dev.frogmc.thyroxine.Thyroxine;
|
import dev.frogmc.thyroxine.Thyroxine;
|
||||||
|
import dev.frogmc.thyroxine.api.data.MappingBundle;
|
||||||
|
import dev.frogmc.thyroxine.parser.tiny.TinyV2Parser;
|
||||||
|
import dev.frogmc.thyroxine.provider.MojmapProvider;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -116,13 +119,30 @@ public class MinecraftGamePlugin implements GamePlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var runtimePath = loader.isDevelopment() ? gamePath : remappedGamePath;
|
||||||
|
|
||||||
if (!loader.isDevelopment()) {
|
if (!loader.isDevelopment()) {
|
||||||
if (!Files.exists(remappedGamePath)) {
|
if (!Files.exists(remappedGamePath)) {
|
||||||
Thyroxine.run(version, gamePath, remappedGamePath, true, false);
|
MappingBundle mappings;
|
||||||
|
String mappingPath = System.getProperty(SystemProperties.INTERMEDIARY_MAPPINGS);
|
||||||
|
if (mappingPath != null) {
|
||||||
|
mappings = TinyV2Parser.parse(Files.readString(Paths.get(mappingPath)));
|
||||||
|
} else {
|
||||||
|
mappings = MojmapProvider.get(version, remappedGamePath.resolveSibling("client-" + version + ".txt")).orElseGet(() -> {
|
||||||
|
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) {
|
||||||
|
Thyroxine.remap(mappings.flattenData(), gamePath, remappedGamePath, true, false);
|
||||||
|
} else {
|
||||||
|
runtimePath = gamePath;
|
||||||
|
LOGGER.warn("No intermediary mappings found! The game will be launched obfuscated. Mods are likely to error!");
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var runtimePath = loader.isDevelopment() ? gamePath : remappedGamePath;
|
|
||||||
FrogLoaderImpl.getInstance().getClassloader().addURL(runtimePath.toUri().toURL());
|
FrogLoaderImpl.getInstance().getClassloader().addURL(runtimePath.toUri().toURL());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,4 +7,5 @@ public class SystemProperties {
|
||||||
|
|
||||||
public final String MINECRAFT_GAME_JAR = "frogmc.plugin.minecraft.gameJar";
|
public final String MINECRAFT_GAME_JAR = "frogmc.plugin.minecraft.gameJar";
|
||||||
public final String DEVELOPMENT = "frogmc.development";
|
public final String DEVELOPMENT = "frogmc.development";
|
||||||
|
public final String INTERMEDIARY_MAPPINGS = "frogmc.plugin.minecraft.intermediaryMappings";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue