Skip to content

Commit

Permalink
Closes #11
Browse files Browse the repository at this point in the history
  • Loading branch information
thecatcore committed May 31, 2024
1 parent 2feb6e8 commit a18845e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
4 changes: 1 addition & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,7 @@ modrinth {
token = System.getenv("MODRINTH_TOKEN")
projectId = "mod-remapping-api"
changelog = """
Improve method name propagation.\\
Add method to map descriptors.\\
Fix method mapping on partial descriptors not working anymore.
Fix mod mappings being inverted on Babric
"""
uploadFile = remapJar

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ org.gradle.jvmargs=-Xmx1G
spasm_version=0.2

# Mod Properties
mod_version = 1.22.0
mod_version = 1.22.1
maven_group = io.github.fabriccompatibiltylayers
archives_base_name = mod-remapping-api
27 changes: 13 additions & 14 deletions src/main/java/fr/catcore/modremapperapi/remapping/RemapUtil.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package fr.catcore.modremapperapi.remapping;

import fr.catcore.modremapperapi.ModRemappingAPI;
import fr.catcore.modremapperapi.utils.Constants;
import fr.catcore.modremapperapi.utils.FileUtils;
import fr.catcore.modremapperapi.utils.MappingsUtils;
Expand Down Expand Up @@ -36,9 +35,7 @@ public class RemapUtil {
private static List<ModRemapper> remappers;
private static MappingTree LOADER_TREE;
private static MappingTree MINECRAFT_TREE;
private static MappingTree MODS_TREE;

private static final MappingList MOD_MAPPINGS = new MappingList();
private static MemoryMappingTree MODS_TREE;

protected static final Map<String, List<String>> MIXINED = new HashMap<>();

Expand Down Expand Up @@ -71,6 +68,13 @@ public static void init(List<io.github.fabriccompatibiltylayers.modremappingapi.
MC_CLASS_NAMES.add(className);
}
}

try {
MODS_TREE = new MemoryMappingTree();
MappingsUtilsImpl.initializeMappingTree(MODS_TREE);
} catch (IOException e) {
throw new RuntimeException(e);
}
}

private static void downloadRemappingLibs() {
Expand Down Expand Up @@ -166,28 +170,23 @@ public static List<String> makeModMappings(Path modPath) {
}
}

classes.forEach(cl -> MOD_MAPPINGS.add(cl, (cl.contains("/") ? "" : defaultPackage) + cl));
io.github.fabriccompatibiltylayers.modremappingapi.api.v1.MappingBuilder mappingBuilder = new MappingBuilderImpl(MODS_TREE);

classes.forEach(cl -> mappingBuilder.addMapping(cl, (cl.contains("/") ? "" : defaultPackage) + cl));

return files;
}

public static void generateModMappings() {
MemoryMappingTree mappingTree = new MemoryMappingTree();

try {
MappingsUtilsImpl.initializeMappingTree(mappingTree);

MOD_MAPPINGS.accept(mappingTree);

mappingTree.visitEnd();
MODS_TREE.visitEnd();

MappingWriter writer = MappingWriter.create(Constants.REMAPPED_MAPPINGS_FILE.toPath(), MappingFormat.TINY_2_FILE);
mappingTree.accept(writer);
MODS_TREE.accept(writer);
} catch (IOException e) {
throw new RuntimeException("Error while generating mods mappings", e);
}

MODS_TREE = mappingTree;
MappingsUtilsImpl.addMappingsToContext(MODS_TREE);
}

Expand Down

0 comments on commit a18845e

Please sign in to comment.