dev/0.11
asie 2018-10-27 08:27:06 +02:00
parent 8481ccc478
commit 708430e66e
9 changed files with 28 additions and 37 deletions

View File

@ -43,19 +43,20 @@ configurations {
dependencies {
compile gradleApi()
shade 'org.zeroturnaround:zt-zip:1.9'
shade 'org.slf4j:slf4j-api:1.7.21'
shade 'org.slf4j:slf4j-simple:1.7.21'
shade 'com.google.code.gson:gson:2.6.2'
shade 'commons-io:commons-io:1.4'
shade 'com.google.guava:guava:19.0'
shade 'org.zeroturnaround:zt-zip:1.13'
shade 'org.slf4j:slf4j-api:1.7.25'
shade 'org.slf4j:slf4j-simple:1.7.25'
shade 'com.google.code.gson:gson:2.8.5'
shade 'commons-io:commons-io:2.6'
shade 'org.apache.commons:commons-lang3:3.8.1'
shade 'com.google.guava:guava:23.0'
shade ('net.fabricmc:weave:+'){
transitive = false
}
shade 'net.fabricmc:tiny-remapper:0.1.0.5'
shade 'net.sf.jopt-simple:jopt-simple:5.0.4'
shade 'org.apache.logging.log4j:log4j-api:2.11.0'
shade 'org.apache.logging.log4j:log4j-core:2.11.0'
shade 'org.apache.logging.log4j:log4j-api:2.11.1'
shade 'org.apache.logging.log4j:log4j-core:2.11.1'
shade ('net.minecraft:launchwrapper:1.12') {
transitive = false
@ -65,8 +66,6 @@ dependencies {
exclude module: 'launchwrapper'
exclude module: 'guava'
}
shade 'org.apache.commons:commons-lang3:3.5'
}
sourceSets {

View File

@ -45,7 +45,6 @@ import java.nio.channels.ReadableByteChannel;
* Generic Download class compatible with ProgressLogger
*/
public class DownloadNewTask extends DefaultTask {
@Input
private Object output;

View File

@ -157,7 +157,7 @@ public class DownloadTask extends DefaultTask {
String assetName = entry.getKey();
int end = assetName.lastIndexOf("/") + 1;
if (end > 0) {
assetName = assetName.substring(end, assetName.length());
assetName = assetName.substring(end);
}
progressLogger.progress(assetName + " - " + position + "/" + totalSize + " (" + (int) ((position / (double) totalSize) * 100) + "%) assets downloaded");
position++;

View File

@ -140,7 +140,7 @@ public class GenIdeaProjectTask extends DefaultTask {
ideaClient.configName = "Minecraft Client";
ideaClient.runDir = "file://$PROJECT_DIR$/" + extension.runDir;
ideaClient.vmArgs = "-Djava.library.path=" + Constants.MINECRAFT_NATIVES.get(extension).getAbsolutePath() + " -Dfabric.development=true";
ideaClient.programArgs = "--tweakClass net.fabricmc.base.launch.FabricClientTweaker --assetIndex " + version.assetIndex.id + " --assetsDir " + new File(extension.getUserCache(), "assets-" + extension.version).getAbsolutePath();
ideaClient.programArgs = "--tweakClass " + Constants.FABRIC_CLIENT_TWEAKER + " --assetIndex " + version.assetIndex.id + " --assetsDir " + new File(extension.getUserCache(), "assets-" + extension.version).getAbsolutePath();
runManager.appendChild(ideaClient.genRuns(runManager));
@ -150,7 +150,7 @@ public class GenIdeaProjectTask extends DefaultTask {
ideaServer.configName = "Minecraft Server";
ideaServer.runDir = "file://$PROJECT_DIR$/" + extension.runDir;
ideaServer.vmArgs = "-Dfabric.development=true";
ideaServer.programArgs = "--tweakClass net.fabricmc.base.launch.FabricServerTweaker";
ideaServer.programArgs = "--tweakClass " + Constants.FABRIC_SERVER_TWEAKER;
runManager.appendChild(ideaServer.genRuns(runManager));

View File

@ -71,7 +71,6 @@ public class MapJarsTask extends DefaultTask {
try {
OutputConsumerPath outputConsumer = new OutputConsumerPath(Constants.MINECRAFT_MAPPED_JAR.get(extension).toPath());
//Rebof the mixed mc jar
outputConsumer.addNonClassFiles(Constants.MINECRAFT_MERGED_JAR.get(extension).toPath());
remapper.read(Constants.MINECRAFT_MERGED_JAR.get(extension).toPath());
remapper.read(classpath);
@ -83,23 +82,13 @@ public class MapJarsTask extends DefaultTask {
throw new RuntimeException("Failed to remap minecraft to " + toM, e);
}
File tempAssests = new File(Constants.CACHE_FILES, "tempAssets");
if (tempAssests.exists()) {
FileUtils.deleteDirectory(tempAssests);
File tempAssets = new File(Constants.CACHE_FILES, "tempAssets");
if (tempAssets.exists()) {
FileUtils.deleteDirectory(tempAssets);
}
tempAssests.mkdir();
tempAssets.mkdir();
ZipUtil.unpack(Constants.MINECRAFT_CLIENT_JAR.get(extension), tempAssests, name -> {
if (name.startsWith("assets") || name.startsWith("pack.mcmeta") || name.startsWith("data") || name.toLowerCase().startsWith("log4j2") || name.startsWith("pack.png")) {
return name;
} else {
return null;
}
});
ZipUtil.unpack(Constants.MINECRAFT_MAPPED_JAR.get(extension), tempAssests);
ZipUtil.pack(tempAssests, Constants.MINECRAFT_MAPPED_JAR.get(extension));
FileUtils.deleteDirectory(tempAssests);
FileUtils.deleteDirectory(tempAssets);
} else {
this.getLogger().lifecycle(Constants.MINECRAFT_MAPPED_JAR.get(extension).getAbsolutePath());
this.getLogger().lifecycle(":mapped jar found, skipping mapping");

View File

@ -70,7 +70,7 @@ public class RunClientTask extends JavaExec {
classpath(libs);
args("--tweakClass", "net.fabricmc.base.launch.FabricClientTweaker", "--assetIndex", version.assetIndex.id, "--assetsDir", new File(extension.getUserCache(), "assets-" + extension.version).getAbsolutePath());
args("--tweakClass", Constants.FABRIC_CLIENT_TWEAKER, "--assetIndex", version.assetIndex.id, "--assetsDir", new File(extension.getUserCache(), "assets-" + extension.version).getAbsolutePath());
setWorkingDir(new File(getProject().getRootDir(), "run"));

View File

@ -65,7 +65,7 @@ public class RunServerTask extends JavaExec {
libs.add(Constants.MINECRAFT_FINAL_JAR.get(extension).getAbsolutePath());
classpath(libs);
args("--tweakClass", "net.fabricmc.base.launch.FabricServerTweaker");
args("--tweakClass", Constants.FABRIC_SERVER_TWEAKER);
setWorkingDir(new File(getProject().getRootDir(), "run"));

View File

@ -37,6 +37,7 @@ public class Checksum {
return false;
}
try {
//noinspection deprecation
HashCode hash = Files.hash(file, Hashing.sha1());
StringBuilder builder = new StringBuilder();
for (Byte hashBytes : hash.asBytes()) {

View File

@ -60,6 +60,9 @@ public class Constants {
public static final IDelayed<File> VERSION_MANIFEST = new DelayedFile(extension -> new File(extension.getUserCache(), "version_manifest.json"));
public static final String FABRIC_CLIENT_TWEAKER = "net.fabricmc.base.launch.FabricClientTweaker";
public static final String FABRIC_SERVER_TWEAKER = "net.fabricmc.base.launch.FabricServerTweaker";
public static final String LIBRARIES_BASE = "https://libraries.minecraft.net/";
public static final String RESOURCES_BASE = "http://resources.download.minecraft.net/";