Giter Site home page Giter Site logo

kottle's Introduction

Kottle

Kotlin language provider for Forge 1.13.2+. Originally a rewrite of Shadowfacts's Forgelin.

  • Shades the Kotlin standard library, runtime, and reflect libraries so you don't have to.
  • Provides a Forge IModLanguageProvider for using Kotlin object classes as your main mod class and adds support for object instances for @Mod.EventBusSubscriber

Usage

First of all, make sure you're on Forge 25.0.15 or higher.

Then, in your build.gradle:

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        // Remove this line: classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
        // trove is forked and used by kotlin and we have to use it instead of the one forked by Forge
        // to avoid compilation errors on Linux (see PR #2)
        classpath(group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true) {
            exclude group: 'trove', module: 'trove'
        }
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
    }
}

apply plugin: 'kotlin'

repositories {
    maven { url 'https://minecraft.curseforge.com/api/maven/' }
}

configurations {
    mod
}

dependencies {
    compile "kottle:Kottle:$kottleVersion"
    mod "kottle:Kottle:$kottleVersion"
}

task installMods(type: Copy, dependsOn: "deinstallMods") {
    from { configurations.mod }
    include "**/*.jar"
    into file("run/mods")
}

task deinstallMods(type: Delete) {
    delete fileTree(dir: "run/mods", include: "*.jar")
}

project.afterEvaluate {
    project.tasks['prepareRuns'].dependsOn(project.tasks['installMods'])
}

, in your gradle.properties:

# This is your kotlin gradle plugin version. For now, use 1.3.21.
kotlinVersion = 1.3.21

# For now, use 1.0.6.
kottleVersion = 1.0.6

, in your mods.toml:

modLoader="kotlinfml"
loaderVersion="[1,)"

Finally, replace FMLJavaModLoadingContext references in your code with FMLKotlinModLoadingContext and Mod.EventBusSubcriber with KotlinEventBusSubcriber. For more info, checkout test sources here or my mod, Roomery, here.

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.