Download assets when idea is syncing a project

dev/0.11
modmuss50 2019-04-20 19:11:39 +01:00
parent 085021dcbb
commit a97bb32210
1 changed files with 7 additions and 1 deletions

View File

@ -25,6 +25,7 @@
package net.fabricmc.loom.util; package net.fabricmc.loom.util;
import net.fabricmc.loom.LoomGradleExtension; import net.fabricmc.loom.LoomGradleExtension;
import net.fabricmc.loom.providers.MinecraftAssetsProvider;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.gradle.api.Project; import org.gradle.api.Project;
@ -54,6 +55,12 @@ public class SetupIntelijRunConfigs {
} }
private static void generate(Project project) throws IOException { private static void generate(Project project) throws IOException {
//Ensures the assets are downloaded when idea is syncing a project
if(Boolean.parseBoolean(System.getProperty("idea.sync.active", "false"))){
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
MinecraftAssetsProvider.provide(extension.getMinecraftProvider(), project);
}
File projectDir = new File(".idea"); File projectDir = new File(".idea");
File runConfigsDir = new File(projectDir, "runConfigurations"); File runConfigsDir = new File(projectDir, "runConfigurations");
File clientRunConfigs = new File(runConfigsDir, "Minecraft_Client.xml"); File clientRunConfigs = new File(runConfigsDir, "Minecraft_Client.xml");
@ -71,7 +78,6 @@ public class SetupIntelijRunConfigs {
if(!serverRunConfigs.exists()) if(!serverRunConfigs.exists())
FileUtils.writeStringToFile(serverRunConfigs, serverRunConfig, StandardCharsets.UTF_8); FileUtils.writeStringToFile(serverRunConfigs, serverRunConfig, StandardCharsets.UTF_8);
} }
} }