This is a fork of fabric-language-scala,support the newest LTS Scala3 version and bundled Scala Library.
The number of people who use Scala is very small, but the power of Scala's expressiveness makes the language practically perfect for developing mods.
The original fabric-language-scala was unmaintained and the maintainers couldn't spare any more effort to maintain it, so it slowly became unmaintained and non-functional.
Support for Scala3 is, if anything, almost non-existent.
So I decided to fork it and maintain it myself and implement it to be compatible with the original fabric-language-scala,named krysztal-language-scala.
From a number of perspectives, the library needs to bind some popular scala libraries.
org.scala-lang:scala3-library_3:3.3.3org.scala-lang:scala-library:2.13.12org.typelevel:cats-core_3:2.12.0com.chuusai:shapeless_2.13:2.3.12org.typelevel:mouse_3:1.3.1Add those lines to your project's build.gradle
plugins {
...
id 'scala' // Add `scala` plugin for gradle
...
}
repositories {
...
maven { url "" rel="noopener nofollow" target="_blank">https://maven.dragons.plus/releases" }
...
}
dependencies {
...
modImplementation "dev.krysztal:krysztal-language-scala:$VERSION$"
...
}
classSuppose your entry name is ExampleEntry.scala
import net.fabricmc.api.ModInitializer;
class ExampleEntry extends ModInitializer {
lazy val logger = LoggerFactory.getLogger("KMMO")
override def onInitialize(): Unit = {
logger.info("Hi")
}
}
And in fabric.mod.json
...
"entrypoints": {
"main": [
"dev.example.ExampleEntry"
],
},
...
But thanks to Scala's excellent interoperability with Java, we can use this library simply as a Java entry point :)
objectSuppose your entry name is ExampleEntry.scala
import net.fabricmc.api.ModInitializer;
object ExampleEntry extends ModInitializer {
lazy val logger = LoggerFactory.getLogger("KMMO")
override def onInitialize(): Unit = {
logger.info("Hi")
}
}
And in fabric.mod.json
...
"entrypoints": {
"main": [
{
"adapter": "scala",
"value": "dev.example.ExampleEntry"
}
],
},
...
This issues caused by scala's class loading mechanism.
It won't affect almost anything. Ignore it.