at go brrr

This commit is contained in:
Juuxel
2020-12-02 20:19:57 +02:00
parent 028ae4a4ac
commit b61373f920
2 changed files with 10 additions and 1 deletions

View File

@@ -42,6 +42,7 @@ import com.google.common.collect.ImmutableMap;
import org.gradle.api.Project;
import net.fabricmc.loom.util.TinyRemapperMappingsHelper;
import net.fabricmc.loom.util.srg.AtRemapper;
import net.fabricmc.loom.util.srg.CoreModClassRemapper;
import net.fabricmc.mapping.tree.TinyTree;
import net.fabricmc.tinyremapper.NonClassCopyMode;
@@ -158,6 +159,7 @@ public class MinecraftMappedProvider extends DependencyProvider {
}
TinyTree yarnWithSrg = getExtension().getMappingsProvider().getMappingsWithSrg();
AtRemapper.remap(output, yarnWithSrg);
CoreModClassRemapper.remapJar(output, yarnWithSrg, getProject().getLogger());
}
}
@@ -169,6 +171,10 @@ public class MinecraftMappedProvider extends DependencyProvider {
.withMappings(out -> JSR_TO_JETBRAINS.forEach(out::acceptClass))
.renameInvalidLocals(true)
.rebuildSourceFilenames(true)
/* FORGE: Required for classes like aej$OptionalNamedTag (1.16.4) which are added by Forge patches.
* They won't get remapped to their proper packages, so IllegalAccessErrors will happen without ._.
*/
.fixPackageAccess(true)
.build();
}

View File

@@ -30,6 +30,7 @@ import java.net.URI;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import com.google.common.collect.ImmutableMap;
@@ -41,7 +42,9 @@ import com.google.common.collect.ImmutableMap;
public final class JarUtil {
public static void extractFile(File jar, String filePath, File target) throws IOException {
try (FileSystem fs = FileSystems.newFileSystem(URI.create("jar:" + jar.toURI()), ImmutableMap.of("create", false))) {
Files.copy(fs.getPath(filePath), target.toPath());
Path targetPath = target.toPath();
Files.deleteIfExists(targetPath);
Files.copy(fs.getPath(filePath), targetPath);
}
}
}