Use pomf jar, and don't override run configs

dev/0.11
modmuss50 2018-12-04 20:20:22 +00:00
parent f9d0c39601
commit 43d3a46296
6 changed files with 10 additions and 16 deletions

View File

@ -91,6 +91,8 @@ public class PomfProvider extends DependencyProvider {
}); });
} }
project.getDependencies().add("compile", project.getDependencies().module("net.fabricmc:pomf:" + version));
mappedProvider = new MinecraftMappedProvider(); mappedProvider = new MinecraftMappedProvider();
mappedProvider.initFiles(project, minecraftProvider, this); mappedProvider.initFiles(project, minecraftProvider, this);
mappedProvider.provide(dependency, project, extension); mappedProvider.provide(dependency, project, extension);

View File

@ -75,12 +75,6 @@ public class GenIdeaProjectTask extends DefaultTask {
throw new RuntimeException("Failed to generate intellij run configurations (runManager was not found)"); throw new RuntimeException("Failed to generate intellij run configurations (runManager was not found)");
} }
//Done to remove the old run configs before adding the new ones with potentially new run configs.
//This has the downside of removing custom run configs but does fix the issue of the provided ones not being updated correctly
while (runManager.getFirstChild() != null){
runManager.removeChild(runManager.getFirstChild());
}
runManager.appendChild(IdeaRunConfig.clientRunConfig(project).genRuns(runManager)); runManager.appendChild(IdeaRunConfig.clientRunConfig(project).genRuns(runManager));
runManager.appendChild(IdeaRunConfig.serverRunConfig(project).genRuns(runManager)); runManager.appendChild(IdeaRunConfig.serverRunConfig(project).genRuns(runManager));

View File

@ -25,7 +25,6 @@
package net.fabricmc.loom.task; package net.fabricmc.loom.task;
import net.fabricmc.loom.LoomGradleExtension; import net.fabricmc.loom.LoomGradleExtension;
import net.fabricmc.loom.providers.MinecraftMappedProvider;
import net.fabricmc.loom.providers.PomfProvider; import net.fabricmc.loom.providers.PomfProvider;
import net.fabricmc.loom.util.Constants; import net.fabricmc.loom.util.Constants;
import net.fabricmc.loom.util.MinecraftVersionInfo; import net.fabricmc.loom.util.MinecraftVersionInfo;
@ -55,7 +54,7 @@ public class RunClientTask extends JavaExec {
} }
classpath(libs); classpath(libs);
args("--tweakClass", Constants.FABRIC_CLIENT_TWEAKER, "--assetIndex", minecraftVersionInfo.assetIndex.getFabricId(extension.getMinecraftProvider().minecraftVersion), "--assetsDir", new File(extension.getUserCache(), "assets").getAbsolutePath(), "--fabricMappingFile", pomfProvider.MAPPINGS_TINY.getAbsolutePath()); args("--tweakClass", Constants.FABRIC_CLIENT_TWEAKER, "--assetIndex", minecraftVersionInfo.assetIndex.getFabricId(extension.getMinecraftProvider().minecraftVersion), "--assetsDir", new File(extension.getUserCache(), "assets").getAbsolutePath());
setWorkingDir(new File(getProject().getRootDir(), "run")); setWorkingDir(new File(getProject().getRootDir(), "run"));

View File

@ -50,7 +50,7 @@ public class RunServerTask extends JavaExec {
} }
classpath(libs); classpath(libs);
args("--tweakClass", Constants.FABRIC_SERVER_TWEAKER, "--fabricMappingFile", extension.getPomfProvider().MAPPINGS_TINY.getAbsolutePath()); args("--tweakClass", Constants.FABRIC_SERVER_TWEAKER);
setWorkingDir(new File(getProject().getRootDir(), "run")); setWorkingDir(new File(getProject().getRootDir(), "run"));

View File

@ -28,7 +28,6 @@ import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import net.fabricmc.loom.LoomGradleExtension; import net.fabricmc.loom.LoomGradleExtension;
import net.fabricmc.loom.providers.MinecraftProvider; import net.fabricmc.loom.providers.MinecraftProvider;
import net.fabricmc.loom.providers.PomfProvider;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.gradle.api.Project; import org.gradle.api.Project;
import org.w3c.dom.Document; import org.w3c.dom.Document;
@ -86,7 +85,6 @@ public class IdeaRunConfig {
public static IdeaRunConfig clientRunConfig(Project project){ public static IdeaRunConfig clientRunConfig(Project project){
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class); LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
MinecraftProvider minecraftProvider = extension.getMinecraftProvider(); MinecraftProvider minecraftProvider = extension.getMinecraftProvider();
PomfProvider pomfProvider = extension.getPomfProvider();
MinecraftVersionInfo minecraftVersionInfo = minecraftProvider.versionInfo; MinecraftVersionInfo minecraftVersionInfo = minecraftProvider.versionInfo;
IdeaRunConfig ideaClient = new IdeaRunConfig(); IdeaRunConfig ideaClient = new IdeaRunConfig();
@ -95,14 +93,13 @@ public class IdeaRunConfig {
ideaClient.configName = "Minecraft Client"; ideaClient.configName = "Minecraft Client";
ideaClient.runDir = "file://$PROJECT_DIR$/" + extension.runDir; ideaClient.runDir = "file://$PROJECT_DIR$/" + extension.runDir;
ideaClient.vmArgs = "-Dfabric.development=true"; ideaClient.vmArgs = "-Dfabric.development=true";
ideaClient.programArgs = "--tweakClass " + Constants.FABRIC_CLIENT_TWEAKER + " --assetIndex " + minecraftVersionInfo.assetIndex.getFabricId(extension.getMinecraftProvider().minecraftVersion) + " --assetsDir \"" + new File(extension.getUserCache(), "assets").getAbsolutePath() + "\" --fabricMappingFile \"" + pomfProvider.MAPPINGS_TINY.getAbsolutePath() + "\""; ideaClient.programArgs = "--tweakClass " + Constants.FABRIC_CLIENT_TWEAKER + " --assetIndex " + minecraftVersionInfo.assetIndex.getFabricId(extension.getMinecraftProvider().minecraftVersion) + " --assetsDir \"" + new File(extension.getUserCache(), "assets").getAbsolutePath() + "\"";
return ideaClient; return ideaClient;
} }
public static IdeaRunConfig serverRunConfig(Project project){ public static IdeaRunConfig serverRunConfig(Project project){
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class); LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
PomfProvider pomfProvider = extension.getPomfProvider();
IdeaRunConfig ideaServer = new IdeaRunConfig(); IdeaRunConfig ideaServer = new IdeaRunConfig();
ideaServer.mainClass = "net.minecraft.launchwrapper.Launch"; ideaServer.mainClass = "net.minecraft.launchwrapper.Launch";
@ -110,7 +107,7 @@ public class IdeaRunConfig {
ideaServer.configName = "Minecraft Server"; ideaServer.configName = "Minecraft Server";
ideaServer.runDir = "file://$PROJECT_DIR$/" + extension.runDir; ideaServer.runDir = "file://$PROJECT_DIR$/" + extension.runDir;
ideaServer.vmArgs = "-Dfabric.development=true"; ideaServer.vmArgs = "-Dfabric.development=true";
ideaServer.programArgs = "--tweakClass " + Constants.FABRIC_SERVER_TWEAKER + " --fabricMappingFile \"" + pomfProvider.MAPPINGS_TINY.getAbsolutePath() + "\""; ideaServer.programArgs = "--tweakClass " + Constants.FABRIC_SERVER_TWEAKER;
return ideaServer; return ideaServer;
} }

View File

@ -66,8 +66,10 @@ public class SetupIntelijRunConfigs {
String clientRunConfig = IdeaRunConfig.clientRunConfig(project).fromDummy(); String clientRunConfig = IdeaRunConfig.clientRunConfig(project).fromDummy();
String serverRunConfig = IdeaRunConfig.serverRunConfig(project).fromDummy(); String serverRunConfig = IdeaRunConfig.serverRunConfig(project).fromDummy();
FileUtils.writeStringToFile(clientRunConfigs, clientRunConfig, StandardCharsets.UTF_8); if(!clientRunConfigs.exists())
FileUtils.writeStringToFile(serverRunConfigs, serverRunConfig, StandardCharsets.UTF_8); FileUtils.writeStringToFile(clientRunConfigs, clientRunConfig, StandardCharsets.UTF_8);
if(!serverRunConfigs.exists())
FileUtils.writeStringToFile(serverRunConfigs, serverRunConfig, StandardCharsets.UTF_8);
} }