use MappingData.reverse() instead of MappingBundle.reverse()
All checks were successful
Publish to snapshot maven / build (push) Successful in 25s

This commit is contained in:
moehreag 2024-08-28 22:06:59 +02:00
parent ac3e0d86df
commit 136cda8eb4
2 changed files with 8 additions and 8 deletions

View file

@ -7,7 +7,7 @@ plugins {
} }
group = "dev.frogmc" group = "dev.frogmc"
version = "0.0.1-alpha.27" version = "0.0.1-alpha.28"
repositories { repositories {
maven { maven {

View file

@ -25,7 +25,7 @@ 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.HttpHelper; import dev.frogmc.thyroxine.HttpHelper;
import dev.frogmc.thyroxine.Thyroxine; import dev.frogmc.thyroxine.Thyroxine;
import dev.frogmc.thyroxine.api.data.MappingBundle; import dev.frogmc.thyroxine.api.data.MappingData;
import dev.frogmc.thyroxine.parser.tiny.TinyV2Parser; import dev.frogmc.thyroxine.parser.tiny.TinyV2Parser;
import dev.frogmc.thyroxine.provider.MojmapProvider; import dev.frogmc.thyroxine.provider.MojmapProvider;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -134,7 +134,7 @@ public class MinecraftGamePlugin implements GamePlugin {
if (!loader.isDevelopment()) { if (!loader.isDevelopment()) {
if (!Files.exists(remappedGamePath)) { if (!Files.exists(remappedGamePath)) {
LOGGER.atInfo().setMessage("Remapping game, this may take a moment...").log(); LOGGER.atInfo().setMessage("Remapping game, this may take a moment...").log();
MappingBundle mappings; MappingData mappings;
String mappingPath = System.getProperty(SystemProperties.INTERMEDIARY_MAPPINGS); String mappingPath = System.getProperty(SystemProperties.INTERMEDIARY_MAPPINGS);
try { try {
if (mappingPath != null) { if (mappingPath != null) {
@ -142,7 +142,7 @@ public class MinecraftGamePlugin implements GamePlugin {
} else { } else {
try { try {
mappings = MojmapProvider.get(version, remappedGamePath.resolveSibling("client-" + version + ".txt")) mappings = MojmapProvider.get(version, remappedGamePath.resolveSibling("client-" + version + ".txt"))
.reverse(); .flattenData().reverse();
} catch (NullPointerException e) { // NPE is only thrown if the mappings for this version can't be found } catch (NullPointerException e) { // NPE is only thrown if the mappings for this version can't be found
LOGGER.info("Mojmap is not available for version {}, using ornithe's calamus as a fallback!", version); LOGGER.info("Mojmap is not available for version {}, using ornithe's calamus as a fallback!", version);
Path file = remappedGamePath.resolveSibling("calamus-"+version+".tiny"); Path file = remappedGamePath.resolveSibling("calamus-"+version+".tiny");
@ -154,14 +154,14 @@ public class MinecraftGamePlugin implements GamePlugin {
location.replaceAll("[.:]", "/")+"/"+groups[1]+"-"+groups[2]+".jar"), location.replaceAll("[.:]", "/")+"/"+groups[1]+"-"+groups[2]+".jar"),
file); file);
} }
mappings = TinyV2Parser.parse(Files.readString(file)); mappings = TinyV2Parser.parse(Files.readString(file)).flattenData();
} }
} }
if (mappings == null) { if (mappings == null) {
mappings = readIntemediaryMappings("/mappings/mappings.tiny"); mappings = readIntemediaryMappings("/mappings/mappings.tiny");
} }
if (mappings != null) { if (mappings != null) {
Thyroxine.remap(mappings.flattenData(), gamePath, remappedGamePath, true, false); Thyroxine.remap(mappings, gamePath, remappedGamePath, true, false);
return; return;
} }
} catch (Exception e) { } catch (Exception e) {
@ -177,7 +177,7 @@ public class MinecraftGamePlugin implements GamePlugin {
FrogLoaderImpl.getInstance().getClassloader().addURL(runtimePath.toUri().toURL()); FrogLoaderImpl.getInstance().getClassloader().addURL(runtimePath.toUri().toURL());
} }
private MappingBundle readIntemediaryMappings(String path) throws IOException { private MappingData readIntemediaryMappings(String path) throws IOException {
URL resource = this.getClass().getResource(path); URL resource = this.getClass().getResource(path);
String data; String data;
if (resource != null) { if (resource != null) {
@ -186,7 +186,7 @@ public class MinecraftGamePlugin implements GamePlugin {
data = Files.readString(Paths.get(path)); data = Files.readString(Paths.get(path));
} }
try { try {
MappingBundle mappings = TinyV2Parser.parse(data); MappingData mappings = TinyV2Parser.parse(data).flattenData();
LOGGER.warn("Using non-standard intermediary mappings! Mods may not work!"); LOGGER.warn("Using non-standard intermediary mappings! Mods may not work!");
return mappings; return mappings;
} catch (IllegalStateException e) { } catch (IllegalStateException e) {