Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Commit

Permalink
2.0.0-b1
Browse files Browse the repository at this point in the history
  • Loading branch information
skyecodes committed Jul 29, 2017
0 parents commit 18919a7
Show file tree
Hide file tree
Showing 13 changed files with 993 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# CMPDL

**Curse Modpack Downloader**

Downloads modpacks from curse, given a URL. Experimental. Forked from Vazkii's project with a new UI.

Licensed under the [WTFPL](http://www.wtfpl.net/). Have fun.

## Usage Instructions

* Download CMPDL on the [Releases](https://github.com/Franckyi/CMPDL/releases) page. Run it.
* Find the pack you want. We'll use [Proton](https://minecraft.curseforge.com/projects/proton) as an example.
* Copy the URL of the project home on CurseForge. It should look like the one on the last point. Paste this URL on the "Modpack URL" field on CMPDL.
* To specify a version of the modpack, enter that version in the "File ID" field
* Choose the modpack destination. If you use MultiMC, choose a new folder under the "instances" folder.
* Press "Start Download" and wait.
47 changes: 47 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.github.franckyi</groupId>
<artifactId>cmpdl</artifactId>
<version>2.0.0-b1</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>com.github.franckyi.cmpdl.CMPDL</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
89 changes: 89 additions & 0 deletions src/main/java/com/github/franckyi/cmpdl/CMPDL.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package com.github.franckyi.cmpdl;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

import java.io.File;
import java.net.URL;
import java.util.HashSet;
import java.util.Set;

public class CMPDL extends Application {

private static final String NAME = "Curse Modpack Downloader";
private static final String VERSION = "2.0.0-b1";
private static final String AUTHOR = "Franckyi (original version by Vazkii)";

public static String title() {
return String.format("%s v%s by %s", NAME, VERSION, AUTHOR);
}

public static InterfaceController controller;
public static Parent parent;
public static Stage stage;
public static Gson gson;

public static String path;
public static String zipFileName;

public static final Set<Exception> exceptions = new HashSet<>();

public void start(Stage primaryStage) throws Exception {
stage = primaryStage;
gson = new GsonBuilder().create();
URL interface0 = getClass().getClassLoader().getResource("interface.fxml");
if (interface0 != null) {
FXMLLoader loader = new FXMLLoader(interface0);
parent = loader.load();
controller = loader.getController();
stage.setScene(new Scene(parent));
stage.setResizable(false);
stage.setTitle(title());
stage.show();
} else {
throw new RuntimeException("Impossible to load interface.fxml file : the application can't start");
}
}

@Override
public void stop() throws Exception {
controller.stop(null);
}

public static void main(String[] args) {
launch(args);
}

public static String getTempDirectory() {
return path + File.separator + ".cmpdl_temp";
}

public static String getZipFile() {
return getTempDirectory() + File.separator + zipFileName;
}

private static String getMinecraftDirectory() {
return path + File.separator + "minecraft";
}

public static String getModsDirectory() {
return getMinecraftDirectory() + File.separator + "mods";
}

public static String getInstanceFile() {
return path + File.separator + "instance.cfg";
}

public static String getManifestFile() {
return getTempDirectory() + File.separator + "manifest.json";
}

public static String toOverridePath(File file, String override) {
return file.getPath().replace(".cmpdl_temp" + File.separator + override, "minecraft");
}
}
Loading

0 comments on commit 18919a7

Please sign in to comment.