• Stars
    star
    250
  • Rank 156,939 (Top 4 %)
  • Language
    Kotlin
  • License
    Apache License 2.0
  • Created over 7 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Fabric language module for Kotlin.

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.9.4+kotlin.1.8.21")
}

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.9.4+kotlin.1.8.21"
    }
}

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.

More Repositories

1

fabric

Essential hooks for modding with Fabric.
Java
2,019
star
2

fabric-example-mod

Example Fabric mod
Java
1,434
star
3

yarn

Libre Minecraft mappings, free to use for everyone. No exceptions.
Java
823
star
4

fabric-loader

Fabric's mostly-version-independent mod loader.
Java
534
star
5

Enigma

This is a fork of cuchaz's Enigma, a deobfuscation/remapping tool for Java software.
Java
408
star
6

fabric-loom

Gradle build system plugin used to automate the setup of a minecraft mod development environment.
Java
208
star
7

tiny-remapper

Tiny JAR remapping tool.
Java
97
star
8

fabric-installer

An Installer for Fabric. For the vanilla launcher
Java
97
star
9

intermediary

Match and mapping information between different versions of Minecraft
85
star
10

fabric-language-scala

Fabric language module for Scala.
Scala
39
star
11

fabricmc.net

The source code and content for https://fabricmc.net/
TypeScript
38
star
12

mapping-io

Mapping-IO is a small and efficient library for working with deobfuscation mapping files.
Java
33
star
13

fabric-meta

Fabric Meta is a JSON-based HTTP api that can be used to query metadata about key Fabric projects.
Java
25
star
14

stitch

Stitch is a set of tools for working with and updating Tiny-format mappings. Potentially a future replacement for Weave.
Java
24
star
15

access-widener

Access wideners provide a way to loosen the access limits of classes.
Java
14
star
16

tiny-mappings-parser

Library for parsing .tiny mapping files
Java
13
star
17

fabric-docs

[WIP] Official curated documentation for Fabric, a modding toolchain for Minecraft.
Java
11
star
18

weave

Fabric auxillary tools
Java
10
star
19

fabric-language-groovy

Groovy
9
star
20

MappingPoet

A skeleton java code generator used to generate javadoc for yarn
Java
8
star
21

community

Docs, tags and orchestration.
8
star
22

fabric-network

Packet hooks for Fabric.
Java
7
star
23

fabric-mixin-compile-extensions

Extensions for Mixin's annotation processor.
Java
7
star
24

fabric-docs-old

Code formatters, guidelines, and design documentation for Fabric.
JavaScript
7
star
25

discord-bot

Bot for the official Discord server
Java
6
star
26

lorenz-tiny

Lorenz tiny mappings reader
Java
6
star
27

fabric-registry

Registry hooks for Fabric.
Java
5
star
28

kotlin-fabric-discord-bot

The discord bot previously used in the fabric discord server.
Kotlin
5
star
29

outdated-fabric-mod-template

Template for Fabric mod workspaces
Java
5
star
30

fabric-commands

A module for fabric to allow custom commands
Java
5
star
31

class-tweaker

Java
5
star
32

fabric-installer-native-bootstrap

A native bootstrap for fabric-installer that utlises the JRE included with minecraft.
C++
5
star
33

name-proposal

Enigma Plugin and standalone CLI application used to automatically name obfuscated members based on data contained in a jar file.
Java
5
star
34

procyon

A fork of https://bitbucket.org/mstrobel/procyon/
Java
4
star
35

fabric-event-entity

Fabric player events module
Java
4
star
36

fabric-filament

A ingredient of yarn - A gradle plugin designed for minecraft mapping projects (such as yarn) to handle complex build logic. Requires Java 16
Java
4
star
37

fabric-loom-native-support

A small mod to improve support for architectures and libraries officially unsupported by Minecraft. Mainly targeting Apple Macs using arm processors.
Java
4
star
38

fabric-resources

Fabric module that adds mod resource packs
Java
3
star
39

fabric-action-scripts

A collection of custom scripts used by Fabric's Github action workflows
TypeScript
3
star
40

mercury-tiny-cli

CLI for the Mercury source code, operating on Tiny-mappings.
Java
3
star
41

fabric-loader-sat4j

sat4j, forked, trimmed and repackaged for Fabric Loader usage
Java
2
star
42

dev-launch-injector

Injects version dependent args and properties to avoid having to rewrite IDE run configs
Java
2
star
43

fabric-installer-native-lib

A native library used by fabric-installer
CMake
1
star