coroutine-based kotlin minecraft game engine
at master 125 lines 2.6 kB view raw view rendered
1# Quickstart 2 3This guide will teach you how to set up an axi gradle project. 4 5## Adding the plugins 6 7::: code-group 8```kts [build.gradle.kts] 9plugins { 10 kotlin("jvm") version "2.1.20" 11 id("net.radsteve.axi") version "AXI-VERSION" 12 // Optional, if you want to use a gradle task to run 13 // the paper server. 14 id("xyz.jpenilla.run-task") version "2.3.1" 15} 16``` 17::: 18 19Replace `AXI-VERSION` with the latest version of axi. 20 21::: info 22If you're using `run-task`, you may have to set the server 23version of the `runServer` task: 24 25```kt 26tasks.runServer { 27 minecraftVersion("1.21.4") 28} 29``` 30::: 31 32## Adding modules 33 34In this guide, we'll only be adding the `core` module of axi. 35To do this, we can use the `axi` gradle extension: 36 37::: code-group 38```kts [build.gradle.kts] 39plugins { 40 kotlin("jvm") version "2.1.20" 41 id("net.radsteve.axi") version "AXI-VERSION" 42 // Optional, if you want to use a gradle task to run 43 // the paper server. 44 id("xyz.jpenilla.run-task") version "2.3.1" 45} 46 47dependencies { 48 axi.modules("core") // [!code focus] 49} 50``` 51::: 52 53## Using internals 54 55If you wish to use Paper internals, you can use the `internals` 56function in the `axi.paper` extension. You can either use 57`internals()` to use the regular Paper dev bundle or you can 58pass in the coordinates to your own dev bundle with the 59`internals(String)` function. Note that you do not need to 60supply a version. 61 62## Using a fork 63 64If you are using a fork of paper, you can use its API instead 65using the `api` function in the `axi.paper` extension. It 66takes in the coordinates to the API, without the version. 67 68## Creating an axi plugin 69 70Now, you can start creating your plugin: 71 72```kotlin 73package my.axi.plugin 74 75class MyPlugin : AxiPlugin() { 76 override suspend fun enable() { 77 slF4JLogger.info("Welcome to Axi!") 78 } 79} 80``` 81 82And of course don't forget to add your `plugin.yml`: 83 84```yml 85name: my-plugin 86version: 0.1.0 87api-version: 1.21.4 88main: my.axi.plugin.MyPlugin 89``` 90 91Now you're good to go! 92 93## Dependencies 94 95If you need a dependency in your plugin, you can use paper's 96library loading feature by adding the dependency using the 97`axi.runtime` function: 98 99```kts 100dependencies { 101 axi.runtime("...") // [!code focus] 102} 103``` 104 105## Complete buildscript 106 107::: code-group 108```kts [build.gradle.kts] 109plugins { 110 kotlin("jvm") version "2.1.20" 111 id("net.radsteve.axi") version "AXI-VERSION" 112 // Optional, if you want to use a gradle task to run 113 // the paper server. 114 id("xyz.jpenilla.run-task") version "2.3.1" 115} 116 117dependencies { 118 axi.modules("core") 119} 120 121tasks.runServer { 122 minecraftVersion("1.21.4") 123} 124``` 125:::