fabric cleanup, move lang and config to common

This commit is contained in:
dfsek 2021-02-24 13:59:25 -07:00
parent 1637644bdd
commit 0fcc0f798c
18 changed files with 22 additions and 31 deletions

View File

@ -6,7 +6,9 @@ import org.gradle.api.plugins.JavaPluginConvention
import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.api.tasks.javadoc.Javadoc
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.filter
import org.gradle.kotlin.dsl.withType
import org.gradle.language.jvm.tasks.ProcessResources
fun Project.configureCompilation() {
configure<JavaPluginConvention> {
@ -21,6 +23,15 @@ fun Project.configureCompilation() {
}
}
tasks.withType<ProcessResources> {
include("**/*.*")
filter<org.apache.tools.ant.filters.ReplaceTokens>(
"tokens" to mapOf(
"VERSION" to project.version.toString()
)
)
}
tasks.withType<Javadoc> {
options.encoding = "UTF-8"
}

View File

@ -22,7 +22,7 @@ dependencies {
"compileOnly"("com.googlecode.json-simple:json-simple:1.1")
"shadedApi"("com.google.guava:guava:30.0-jre")
"compileOnly"("com.google.guava:guava:30.0-jre")
}
publishing {

View File

@ -31,15 +31,8 @@ dependencies {
"shadedImplementation"("org.bstats:bstats-bukkit:1.7")
"compileOnly"("com.sk89q.worldedit:worldedit-bukkit:7.2.0-SNAPSHOT")
}
tasks.withType<ProcessResources> {
include("**/*.*")
filter<org.apache.tools.ant.filters.ReplaceTokens>(
"tokens" to mapOf(
"VERSION" to project.version.toString()
)
)
"shadedImplementation"("com.google.guava:guava:30.0-jre")
}
val testDir = "target/server/"

View File

@ -1,4 +1,5 @@
import com.dfsek.terra.configureCommon
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import net.fabricmc.loom.LoomGradleExtension
import net.fabricmc.loom.task.RemapJarTask
@ -23,6 +24,11 @@ plugins {
configureCommon()
tasks.named<ShadowJar>("shadowJar") {
relocate("org.json", "com.dfsek.terra.lib.json")
relocate("org.yaml", "com.dfsek.terra.lib.yaml")
}
group = "com.dfsek.terra.fabric"

View File

@ -163,11 +163,7 @@ public class TerraFabricPlugin implements TerraPlugin, ModInitializer {
@Override
public Language getLanguage() {
try {
return new Language(new File(getDataFolder(), "lang/en_us.yml"));
} catch(IOException e) {
throw new IllegalArgumentException();
}
return LangUtil.getLanguage();
}
@Override
@ -267,10 +263,10 @@ public class TerraFabricPlugin implements TerraPlugin, ModInitializer {
public void onInitialize() {
instance = this;
config = new File(FabricLoader.getInstance().getConfigDir().toFile(), "Terra");
this.config = new File(FabricLoader.getInstance().getConfigDir().toFile(), "Terra");
saveDefaultConfig();
plugin.load(this);
LangUtil.load("en_us", this);
LangUtil.load(plugin.getLanguage(), this);
logger.info("Initializing Terra...");
if(!addonRegistry.loadAll()) {

View File

@ -20,7 +20,6 @@
]
},
"mixins": [
"terra.mixins.json"
],
"depends": {
"fabricloader": ">=0.7.4",

View File

@ -1,14 +0,0 @@
{
"required": true,
"minVersion": "0.8",
"package": "com.dfsek.terra.fabric.mixin",
"compatibilityLevel": "JAVA_8",
"mixins": [
],
"client": [
],
"server": [],
"injectors": {
"defaultRequire": 1
}
}