because ForgeGradle sucks.. at least before 2.3-SNAPSHOT

This commit is contained in:
NikkyAI 2018-02-15 22:10:38 +01:00
parent 5f180f0dbf
commit dc702b2445
11 changed files with 65 additions and 44 deletions

1
.gitignore vendored
View File

@ -98,3 +98,4 @@ gradle-app.setting
run/
*.tmp
**/gen/

View File

@ -48,16 +48,28 @@ minecraft {
runDir = "run"
mappings = project.mcp_mappings
}
replaceIn 'MatterLink.kt'
replace '@VERSION@', project.mod_version
replace '@FORGELIN-VERSION@', project.forgelin_version
replace '@FORGE-VERSION@', project.forge_version
compileKotlin.doFirst {
def target = "src/main/kotlin/matterlink/gen"
copy {
from("../src/templates/kotlin/matterlink/Constants.kt")
into(target)
}
ant.replaceregexp(match:'@VERSION@', replace: project.mod_version, flags:'g', byline:true) {
fileset(dir: target, includes: 'Constants.kt')
}
ant.replaceregexp(match:'@FORGELIN-VERSION@', replace: project.forgelin_version, flags:'g', byline:true) {
fileset(dir: target, includes: 'Constants.kt')
}
ant.replaceregexp(match:'@FORGE-VERSION@', replace: project.forge_version, flags:'g', byline:true) {
fileset(dir: target, includes: 'Constants.kt')
}
}
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "version", project.mod_version
inputs.property "mcversion", project.minecraft.version
// replace stuff in mcmod.info, nothing else
@ -65,7 +77,7 @@ processResources {
include 'mcmod.info'
// replace version and mcversion
expand 'version': project.version, 'mcversion': project.minecraft.version
expand 'version': project.mod_version, 'mcversion': project.minecraft.version
}
// copy everything else except the mcmod.info

View File

@ -1,10 +1,5 @@
package matterlink
import jline.internal.Log
import matterlink.bridge.MessageHandler
import matterlink.bridge.command.BridgeCommandRegistry
import matterlink.bridge.command.HelpCommand
import matterlink.bridge.command.PlayerListCommand
import matterlink.command.CommandMatterlink
import matterlink.command.IMinecraftCommandSender
import matterlink.command.MatterlinkCommandSender
@ -16,10 +11,6 @@ import net.minecraftforge.fml.common.event.*
import org.apache.logging.log4j.Level
import org.apache.logging.log4j.Logger
const val MODID = "matterlink"
const val NAME = "MatterLink"
const val VERSION = "@VERSION@"
lateinit var logger: Logger
@Mod(
@ -29,7 +20,7 @@ lateinit var logger: Logger
useMetadata = true,
acceptableRemoteVersions = "*",
modLanguageAdapter = "net.shadowfacts.forgelin.KotlinAdapter",
dependencies = "required-after:forgelin@[@FORGELIN-VERSION@,);required-after:forge@[@FORGE-VERSION@,);"
dependencies = DEPENDENCIES
)
object MatterLink : IMatterLink() {
init {

View File

@ -34,7 +34,7 @@ object MatterlinkCommandSender : IMinecraftCommandSender, ICommandSender {
}
override fun getEntityWorld(): World {
return FMLCommonHandler.instance().minecraftServerInstance.getWorld(0)
return FMLCommonHandler.instance().minecraftServerInstance.worldServerForDimension(0)
}
override fun canUseCommand(permLevel: Int, commandName: String?): Boolean {

View File

@ -0,0 +1,7 @@
package matterlink
const val MODID = "matterlink"
const val NAME = "MatterLink"
const val VERSION = "@VERSION@"
//const val DEPENDENCIES = "required-after:forgelin@[@FORGELIN-VERSION@,);required-after:forge@[@FORGE-VERSION@,);"
const val DEPENDENCIES = "required-after:forgelin@[@FORGELIN-VERSION@,);"

View File

@ -47,16 +47,28 @@ minecraft {
runDir = "run"
mappings = project.mcp_mappings
}
replaceIn 'MatterLink.kt'
replace '@VERSION@', project.mod_version
replace '@FORGELIN-VERSION@', project.forgelin_version
replace '@FORGE-VERSION@', project.forge_version
compileKotlin.doFirst {
def target = "src/main/kotlin/matterlink/gen"
copy {
from("../src/templates/kotlin/matterlink/Constants.kt")
into(target)
}
ant.replaceregexp(match:'@VERSION@', replace: project.mod_version, flags:'g', byline:true) {
fileset(dir: target, includes: 'Constants.kt')
}
ant.replaceregexp(match:'@FORGELIN-VERSION@', replace: project.forgelin_version, flags:'g', byline:true) {
fileset(dir: target, includes: 'Constants.kt')
}
ant.replaceregexp(match:'@FORGE-VERSION@', replace: project.forge_version, flags:'g', byline:true) {
fileset(dir: target, includes: 'Constants.kt')
}
}
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "version", project.mod_version
inputs.property "mcversion", project.minecraft.version
// replace stuff in mcmod.info, nothing else
@ -64,7 +76,7 @@ processResources {
include 'mcmod.info'
// replace version and mcversion
expand 'version': project.version, 'mcversion': project.minecraft.version
expand 'version': project.mod_version, 'mcversion': project.minecraft.version
}
// copy everything else except the mcmod.info

View File

@ -1,10 +1,5 @@
package matterlink
import jline.internal.Log
import matterlink.bridge.MessageHandler
import matterlink.bridge.command.BridgeCommandRegistry
import matterlink.bridge.command.HelpCommand
import matterlink.bridge.command.PlayerListCommand
import matterlink.command.CommandMatterlink
import matterlink.command.IMinecraftCommandSender
import matterlink.command.MatterlinkCommandSender
@ -16,10 +11,6 @@ import net.minecraftforge.fml.common.event.*
import org.apache.logging.log4j.Level
import org.apache.logging.log4j.Logger
const val MODID = "matterlink"
const val NAME = "MatterLink"
const val VERSION = "@VERSION@"
lateinit var logger: Logger
@Mod(
@ -29,7 +20,7 @@ lateinit var logger: Logger
useMetadata = true,
acceptableRemoteVersions = "*",
modLanguageAdapter = "net.shadowfacts.forgelin.KotlinAdapter",
dependencies = "required-after:forgelin@[@FORGELIN-VERSION@,);required-after:forge@[@FORGE-VERSION@,);"
dependencies = DEPENDENCIES
)
object MatterLink : IMatterLink() {
init {

View File

@ -0,0 +1,7 @@
package matterlink
const val MODID = "matterlink"
const val NAME = "MatterLink"
const val VERSION = "@VERSION@"
const val DEPENDENCIES = "required-after:forgelin@[@FORGELIN-VERSION@,);required-after:forge@[@FORGE-VERSION@,);"

View File

@ -48,7 +48,7 @@ minecraft {
mappings = project.mcp_mappings
replaceIn 'MatterLink.kt'
replaceIn 'Constants.kt'
replace '@VERSION@', project.mod_version
replace '@FORGELIN-VERSION@', project.forgelin_version
replace '@FORGE-VERSION@', project.forge_version
@ -56,7 +56,7 @@ minecraft {
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "version", project.mod_version
inputs.property "mcversion", project.minecraft.version
// replace stuff in mcmod.info, nothing else
@ -64,7 +64,7 @@ processResources {
include 'mcmod.info'
// replace version and mcversion
expand 'version': project.version, 'mcversion': project.minecraft.version
expand 'version': project.mod_version, 'mcversion': project.minecraft.version
}
// copy everything else except the mcmod.info

View File

@ -0,0 +1,7 @@
package matterlink
const val MODID = "matterlink"
const val NAME = "MatterLink"
const val VERSION = "@VERSION@"
const val DEPENDENCIES = "required-after:forgelin@[@FORGELIN-VERSION@,);required-after:forge@[@FORGE-VERSION@,);"

View File

@ -1,8 +1,5 @@
package matterlink
import matterlink.bridge.command.BridgeCommandRegistry
import matterlink.bridge.command.HelpCommand
import matterlink.bridge.command.PlayerListCommand
import matterlink.command.CommandMatterlink
import matterlink.command.IMinecraftCommandSender
import matterlink.command.MatterlinkCommandSender
@ -14,10 +11,6 @@ import net.minecraftforge.fml.common.event.*
import org.apache.logging.log4j.Level
import org.apache.logging.log4j.Logger
const val MODID = "matterlink"
const val NAME = "MatterLink"
const val VERSION = "@VERSION@"
lateinit var logger: Logger
@Mod(
@ -27,7 +20,7 @@ lateinit var logger: Logger
useMetadata = true,
acceptableRemoteVersions = "*",
modLanguageAdapter = "net.shadowfacts.forgelin.KotlinAdapter",
dependencies = "required-after:forgelin@[@FORGELIN-VERSION@,);required-after:forge@[@FORGE-VERSION@,);"
dependencies = DEPENDENCIES
)
object MatterLink : IMatterLink() {
init {