GithubHelp home page GithubHelp logo

madis0 / fabric-language-kotlin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fabricmc/fabric-language-kotlin

0.0 0.0 0.0 307 KB

Fabric language module for Kotlin.

License: Apache License 2.0

Kotlin 100.00%

fabric-language-kotlin's Introduction

fabric-language-kotlin

maven-badge modrinth-badge curseforge-badge

Fabric language module for Kotlin. Adds support for Kotlin exclusive entrypoints and bundles the Kotlin Stdlib as well as common kotlinx libraries.

Usage

Dependency

Add it as a dependency to your Gradle project:

dependencies {
    modImplementation("net.fabricmc:fabric-language-kotlin:1.8.2+kotlin.1.7.10")
}

Adapter

Use the kotlin adapter for your mod by setting the adapter property in the fabric.mod.json file. Remember to the add a dependency entry to your fabric.mod.json file:

{
    "schemaVersion":  1, 
    "entrypoints": {
        "main": [
            {
                "adapter": "kotlin",
                "value": "package.ClassName"
            }
        ]
    },
    "depends": {
        "fabric-language-kotlin": ">=1.8.2+kotlin.1.7.10"
    }
}

For more info reference the fabric.mod.json documentation.

Do not forget to set the schemaVersion to 1 or it will fall back to schema 0 and will not attempt to load entrypoints.

Entrypoint samples

Kind Class reference Function reference Field reference
class
{
    "adapter": "kotlin",
    "value": "mymod.MyMod"
}
package mymod
class MyMod : ModInitializer {
    override fun onInitialize() {
        TODO()
    }
}
object
{
    "adapter": "kotlin",
    "value": "mymod.MyMod"
}
package mymod
object MyMod : ModInitializer {
    override fun onInitialize() {
        TODO()
    }
}
{
    "adapter": "kotlin",
    "value": "mymod.MyMod::init"
}
package mymod
object MyMod  {
    fun init() {
        TODO()
    }
}
{
    "adapter": "kotlin",
    "value": "mymod.MyMod::initializer"
}
package mymod
object MyMod  {
    val initializer = ModInitializer {
        TODO()
    }
}
companion object
{
    "adapter": "kotlin",
    "value": "mymod.MyMod$Companion"
}
package mymod
class MyMod {
    companion object : ModInitializer {
        override fun onInitialize() {
            TODO()
        }
    }
}
{
    "adapter": "kotlin",
    "value": "mymod.MyMod$Companion::init"
}
package mymod
class MyMod  {
    companion object {
        fun init() {
            TODO()
        }
    }
}
{
    "adapter": "kotlin",
    "value": "mymod.MyMod$Companion::initializer"
}
package mymod
class MyMod  {
    companion object {
        val initializer = ModInitializer {
            TODO()
        }
    }
}
top level
{
    "adapter": "kotlin",
    "value": "mymod.MyModKt::init"
}

File: src/main/kotlin/mymod/MyMod.kt

package mymod

fun init() {
    TODO()
}

Companion objects can be used by appending $Companion to the class. Take care of processResources there, it might try to expand it, in that case escape it.

Bundled libraries

org.jetbrains.kotlin namespace:

org.jetbrains.kotlinx namespace:

Available Versions

https://maven.fabricmc.net/net/fabricmc/fabric-language-kotlin/

Updating README

  • Update the readme in templates/README.template.md.
  • Run ./gradlew processMDTemplates.

fabric-language-kotlin's People

Contributors

asiekierka avatar ejektaflex avatar isxander avatar jakobkmar avatar james58899 avatar kanpov avatar modmuss50 avatar natanfudge avatar nikkyai avatar octol1ttle avatar shadowfacts avatar username404-59 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.