Readd loading plugin

Prevents crash because of unloaded Forgelin/Kotlin classes.

Closes #6
Closes #7
This commit is contained in:
Shadowfacts 2017-02-16 18:22:08 -05:00
parent 757db6540d
commit e0209c61b2
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
5 changed files with 78 additions and 2 deletions

View File

@ -70,6 +70,13 @@ dependencies {
compile group: "org.jetbrains.kotlin", name: "kotlin-runtime", version: kotlin_version
}
jar {
manifest {
attributes "FMLCorePlugin": "net.shadowfacts.forgelin.preloader.ForgelinPlugin",
"FMLCorePluginContainsFMLMod": "true"
}
}
shadowJar {
classifier = ""
dependencies {
@ -77,6 +84,10 @@ shadowJar {
include(dependency("org.jetbrains.kotlin:kotlin-reflect:${kotlin_version}"))
include(dependency("org.jetbrains.kotlin:kotlin-runtime:${kotlin_version}"))
}
manifest {
attributes "FMLCorePlugin": "net.shadowfacts.forgelin.preloader.ForgelinPlugin",
"FMLCorePluginContainsFMLMod": "true"
}
}
tasks.build.dependsOn shadowJar

View File

@ -1,4 +1,4 @@
mod_version = 1.3.0
mod_version = 1.3.1
group = net.shadowfacts
archivesBaseName = Forgelin

View File

@ -0,0 +1,37 @@
package net.shadowfacts.forgelin.preloader;
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;
import java.util.Map;
/**
* @author shadowfacts
*/
public class ForgelinPlugin implements IFMLLoadingPlugin {
@Override
public String[] getASMTransformerClass() {
return new String[0];
}
@Override
public String getModContainerClass() {
return null;
}
@Override
public String getSetupClass() {
return "net.shadowfacts.forgelin.preloader.ForgelinSetup";
}
@Override
public void injectData(Map<String, Object> data) {
}
@Override
public String getAccessTransformerClass() {
return null;
}
}

View File

@ -0,0 +1,28 @@
package net.shadowfacts.forgelin.preloader;
import net.minecraftforge.fml.relauncher.IFMLCallHook;
import java.util.Map;
/**
* @author shadowfacts
*/
public class ForgelinSetup implements IFMLCallHook {
@Override
public void injectData(Map<String, Object> data) {
ClassLoader loader = (ClassLoader)data.get("classLoader");
try {
loader.loadClass("net.shadowfacts.forgelin.KotlinAdapter");
} catch (ClassNotFoundException e) {
// this should never happen
throw new RuntimeException("Couldn't find Forgelin langague adapter, this shouldn't be happening", e);
}
}
@Override
public Void call() throws Exception {
return null;
}
}

View File

@ -10,6 +10,6 @@ object Forgelin {
const val MOD_ID = "forgelin"
const val NAME = "Forgelin"
const val VERSION = "1.3.0"
const val VERSION = "1.3.1"
}