|
1 | 1 | package fr.catcore.modremapperapi.remapping;
|
2 | 2 |
|
3 |
| -import fr.catcore.modremapperapi.ModRemappingAPI; |
4 | 3 | import fr.catcore.modremapperapi.utils.Constants;
|
5 | 4 | import fr.catcore.modremapperapi.utils.FileUtils;
|
6 | 5 | import fr.catcore.modremapperapi.utils.MappingsUtils;
|
@@ -36,9 +35,7 @@ public class RemapUtil {
|
36 | 35 | private static List<ModRemapper> remappers;
|
37 | 36 | private static MappingTree LOADER_TREE;
|
38 | 37 | private static MappingTree MINECRAFT_TREE;
|
39 |
| - private static MappingTree MODS_TREE; |
40 |
| - |
41 |
| - private static final MappingList MOD_MAPPINGS = new MappingList(); |
| 38 | + private static MemoryMappingTree MODS_TREE; |
42 | 39 |
|
43 | 40 | protected static final Map<String, List<String>> MIXINED = new HashMap<>();
|
44 | 41 |
|
@@ -71,6 +68,13 @@ public static void init(List<io.github.fabriccompatibiltylayers.modremappingapi.
|
71 | 68 | MC_CLASS_NAMES.add(className);
|
72 | 69 | }
|
73 | 70 | }
|
| 71 | + |
| 72 | + try { |
| 73 | + MODS_TREE = new MemoryMappingTree(); |
| 74 | + MappingsUtilsImpl.initializeMappingTree(MODS_TREE); |
| 75 | + } catch (IOException e) { |
| 76 | + throw new RuntimeException(e); |
| 77 | + } |
74 | 78 | }
|
75 | 79 |
|
76 | 80 | private static void downloadRemappingLibs() {
|
@@ -166,28 +170,23 @@ public static List<String> makeModMappings(Path modPath) {
|
166 | 170 | }
|
167 | 171 | }
|
168 | 172 |
|
169 |
| - classes.forEach(cl -> MOD_MAPPINGS.add(cl, (cl.contains("/") ? "" : defaultPackage) + cl)); |
| 173 | + io.github.fabriccompatibiltylayers.modremappingapi.api.v1.MappingBuilder mappingBuilder = new MappingBuilderImpl(MODS_TREE); |
| 174 | + |
| 175 | + classes.forEach(cl -> mappingBuilder.addMapping(cl, (cl.contains("/") ? "" : defaultPackage) + cl)); |
170 | 176 |
|
171 | 177 | return files;
|
172 | 178 | }
|
173 | 179 |
|
174 | 180 | public static void generateModMappings() {
|
175 |
| - MemoryMappingTree mappingTree = new MemoryMappingTree(); |
176 |
| - |
177 | 181 | try {
|
178 |
| - MappingsUtilsImpl.initializeMappingTree(mappingTree); |
179 |
| - |
180 |
| - MOD_MAPPINGS.accept(mappingTree); |
181 |
| - |
182 |
| - mappingTree.visitEnd(); |
| 182 | + MODS_TREE.visitEnd(); |
183 | 183 |
|
184 | 184 | MappingWriter writer = MappingWriter.create(Constants.REMAPPED_MAPPINGS_FILE.toPath(), MappingFormat.TINY_2_FILE);
|
185 |
| - mappingTree.accept(writer); |
| 185 | + MODS_TREE.accept(writer); |
186 | 186 | } catch (IOException e) {
|
187 | 187 | throw new RuntimeException("Error while generating mods mappings", e);
|
188 | 188 | }
|
189 | 189 |
|
190 |
| - MODS_TREE = mappingTree; |
191 | 190 | MappingsUtilsImpl.addMappingsToContext(MODS_TREE);
|
192 | 191 | }
|
193 | 192 |
|
|
0 commit comments