-
Notifications
You must be signed in to change notification settings - Fork 1
dev_quickstart
It's easy!
We recommend you use Gradle to easily handle the dependencies.
You will need to add the following to your build.gradle
repositories {
maven {
name 'Candor Bintray'
url 'https://dl.bintray.com/candor/candor-alpha'
}
maven {
name "Cybernize Bintray"
url "https://dl.bintray.com/candor/cybernize"
}
maven {
name "SwingExtensions Bintray"
url "https://dl.bintray.com/innoxium/SwingExtensions"
}
}
dependencies {
implementation 'uk.co.innoxium.candor:candor-api:0.2.8'
implementation 'uk.co.innoxium.cybernize:cybernize:1.1.4'
}Lets walk through this code, first we need to specify where to get the candor api's from, this is why we add the maven notations to the repositories section.
We can then ask gradle to download them using the implementation notation in the dependencies section.
There is currently no easy way to run Candor from an IDE, without a bit of set up, although you can safely build and test your module right within candor itself!
Before we can run candor, we require a tweak to the run configs and require download a small library.
We should first download the jar-loader library (This is what actually loads your modules in to the mod manager)
from here.
You should place this in folder called "libs" in the same directory as your build.gradle.
From here we can create a run config.
Set the main class to uk.co.innoxium.candor.CandorLauncher.
and add the following to the JVM arguments: -javaagent:<path to jar-loader.jar>.
If you are using IDEA, you can use "-javaagent:$ProjectFileDir$/libs/jar-loader.jar".
You should now be able to run candor from your IDE.
Another piece we will need to add to the build.gradle is to modify the built jar file.
jar {
manifest {
attributes 'Candor-Module-Class': "path to your module class, e.g. com.company.candormodule.CandorModule"
}
}This will tell Candor what class to load for your module. How do you set up a module then?
We can now create our Module class!
Below is a very simple example of a module, you may need to fill out some parts for yourself!
import uk.co.innoxium.candor.module.AbstractModInstaller;
import uk.co.innoxium.candor.module.AbstractModule;
import uk.co.innoxium.candor.module.RunConfig;
import java.io.File;
public class CandorModule extends AbstractModule {
@Override
public File getGame() {
return null;
}
@Override
public File getModsFolder() {
return null;
}
@Override
public void setGame(File file) {
}
@Override
public void setModsFolder(File file) {
}
@Override
public String getModuleName() {
return null;
}
@Override
public String getReadableGameName() {
return null;
}
@Override
public AbstractModInstaller getModInstaller() {
return null;
}
@Override
public boolean requiresModFolderSelection() {
return false;
}
@Override
public String[] acceptedExe() {
return new String[0];
}
@Override
public String getModFileFilterList() {
return null;
}
@Override
public RunConfig getDefaultRunConfig() {
return null;
}
}You should try to fill out all of these methods with at least something, otherwise it probably won't work :(
Say you want to add a tool to your module, it recommended to either package it inside your jar, or download from the internet.
Either way, when extracting/downloading the should be placed in the following location: <path-to-candor>\tools\<game-name>\<tool-name>
This is reduce conflicts and maintain a well organised file system. You should also set the working directory of the tool to the location it is stored in.
p.s. It is NOT the job of Candor to track these tools, it is solely the job of the Module. Candor will just provide the utilities for you to use.