Skip to content

Pull in GitHub README to wiki #62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 52 additions & 35 deletions wiki/other/source-code/page.kubedoc
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# [![[banner.png|KubeJS]]](https://kubejs.com)

**Note: If you are a script developer (i.e. pack dev, server admin, etc.), you likely want to visit our [website](https://kubejs.com) or the [wiki](/wiki) instead.**

(For a Table Of Contents, click the menu icon in the top left!)

## Introduction

KubeJS is a multi-modloader Minecraft mod which lets you create scripts in the JavaScript programming language to manage your server using events, change recipes, add ~~and edit~~ (coming soon!) loot tables, customise your world generation, add new blocks and items, or use custom integration with other mods like [FTB Quests](https://mods.latvian.dev/books/kubejs/page/ftb-quests-integration) for even more advanced features!
Expand All @@ -18,14 +14,39 @@ And if you're just looking for help with KubeJS overall and the wiki didn't have

KubeJS is distributed under the GNU Lesser General Public License v3.0, or LGPLv3. See our [LICENSE](/LICENSE.txt) file for more information.

## Creating addons
## Creating an addon

>>> info
This section is primarily geared towards *mod developers* creating addons for KubeJS.
If you are a script developer (pack dev, server admin, etc.) you may want to visit the other wiki pages instead.
<<<

Creating addon mods for KubeJS is easy! Just follow the following steps to your own liking, depending on how deep you want your integration to go!

### Initial setup

To add a Gradle dependency on KubeJS, you will need to add the following repositories to your `build.gradle`'s `repositories`:

|> 1.21, and above
```groovy
repositories {
maven {
url "https://maven.latvian.dev/releases"
content {
includeGroup "dev.latvian.mods"
includeGroup "dev.latvian.apps"
}
}

maven {
url 'https://jitpack.io'
content {
includeGroup "com.github.rtyley"
}
}
}
```
<||>+ 1.20.1 and below
```groovy
repositories {
maven {
Expand All @@ -41,47 +62,36 @@ repositories {
url = "https://maven.saps.dev/releases"
content {
includeGroup "dev.latvian.mods"
includeGroup "dev.latvian.apps"
}
}
}
```
<|

You can then declare KubeJS as a regular `compile`-time dependency in your `dependencies` block:

|> MDG / modern NG
```groovy
// Loom (Fabric / Quilt / Architectury)
modImplementation("dev.latvian.mods:kubejs-<loader>:${kubejs_version}")

// ForgeGradle
implementation fg.deobf("dev.latvian.mods:kubejs-forge:${kubejs_version}")

// these two are unfortunately needed since fg.deobf doesn't respect transitive dependencies yet
implementation fg.deobf("dev.latvian.mods:rhino-forge:${rhino_version}")
implementation fg.deobf("dev.architectury:architectury-forge:${architectury_version}")
api("dev.latvian.mods:kubejs-neoforge:$kubejs_version")
interfaceInjectionData("dev.latvian.mods:kubejs-neoforge:$kubejs_version") // optional
```
<||> (Fabric / Architectury) Loom
```groovy
// use "common", "fabric", or "forge"
// transitive dependencies will be pulled in automatically
modImplementation("dev.latvian.mods:kubejs-<loader>:$kubejs_version")
```
<||> ForgeGradle
```groovy
implementation fg.deobf("dev.latvian.mods:kubejs-forge:$kubejs_version")

Just set the versions with most up-to-date version of the required mod(s), which you also find using these badges:

<p align="center">
<a href="https://maven.saps.dev/#/releases/dev/latvian/mods/kubejs">
<img src="https://flat.badgen.net/maven/v/metadata-url/https/maven.saps.dev/releases/dev/latvian/mods/kubejs/maven-metadata.xml?color=C186E6&label=KubeJS" alt="KubeJS Latest Version">
</a>
<a href="https://maven.saps.dev/#/releases/dev/latvian/mods/rhino">
<img src="https://flat.badgen.net/maven/v/metadata-url/https/maven.saps.dev/releases/dev/latvian/mods/rhino/maven-metadata.xml?color=3498DB&label=Rhino" alt="Rhino Latest Version">
</a>
<a href="https://linkie.shedaniel.dev/dependencies">
<img src="https://flat.badgen.net/badge/Architectury/See%20this%20page%20for%20more%20information/F95F1E" alt="Architectury Latest Version">
</a>
</p>

(Note: The above badges may not represent the *true* latest version of these mods. As a basic rule of thumb, for KubeJS and Rhino, you should always be using the latest version compiled against your version of Minecraft, for example `1802.+` for Minecraft 1.18.2, while for Architectury, the corresponding major version will be provided. You can also click on the badge to see all versions of each mod)

You should of course use `kubejs-forge` for Forge projects and `kubejs-fabric` for Fabric projects. KubeJS' dependencies (notably, Rhino and Architectury) ***should*** all be downloaded automatically; otherwise, you may need to add them manually.
// these two are unfortunately needed since fg.deobf doesn't respect transitive dependencies
implementation fg.deobf("dev.latvian.mods:rhino-forge:$rhino_version")
implementation fg.deobf("dev.architectury:architectury-forge:$architectury_version")
```

### Fixing refmaps (ForgeGradle only)
### Fixing refmaps

KubeJS uses the official mappings for Minecraft ("mojmap"). Since the refmap remapper for Mixins on ModLauncher **currently** doesn't support non-MCP mappings, you will need to add some extra lines to your runs to keep it from crashing, as detailed [here](https://github.com/SpongePowered/Mixin/issues/462#issuecomment-791370319) on the Mixin issue tracker. Be sure to regenerate your runs afterwards!
KubeJS uses the official mappings for Minecraft ("mojmap"). Since the refmap remapper for Mixins on ModLauncher doesn't support non-MCP mappings on older versions, you may need to add some extra lines to your runs to keep it from crashing, as detailed [here](https://github.com/SpongePowered/Mixin/issues/462#issuecomment-791370319) on the Mixin issue tracker. Be sure to regenerate your runs afterwards!

```groovy
minecraft {
Expand All @@ -94,6 +104,13 @@ minecraft {
}
}
```
<|

We only officially support ModDevGradle and NeoGradle on 1.21+, though if you are an Architectury project using loom, the above should still work fine on modern versions!

>>> warning
A version listing page showing the newest versions of KubeJS is currently NYI, use the latest version from CurseForge or Modrinth where possible!
<<<

### Creating a plugin

Expand Down