Skip to content

Commit

Permalink
Readd loading plugin
Browse files Browse the repository at this point in the history
Prevents crash because of unloaded Forgelin/Kotlin classes.

Closes #6
Closes #7
  • Loading branch information
shadowfacts committed Feb 16, 2017
1 parent 757db65 commit e0209c6
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 2 deletions.
11 changes: 11 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,24 @@ 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 {
include(dependency("org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"))
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
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mod_version = 1.3.0
mod_version = 1.3.1
group = net.shadowfacts
archivesBaseName = Forgelin

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}

}
Original file line number Diff line number Diff line change
@@ -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;
}

}
2 changes: 1 addition & 1 deletion src/main/kotlin/net/shadowfacts/forgelin/Forgelin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"

}

0 comments on commit e0209c6

Please sign in to comment.