diff --git a/wiki/other/source-code/page.kubedoc b/wiki/other/source-code/page.kubedoc index f7309bd..1718d09 100644 --- a/wiki/other/source-code/page.kubedoc +++ b/wiki/other/source-code/page.kubedoc @@ -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! @@ -18,7 +14,12 @@ 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! @@ -26,6 +27,26 @@ Creating addon mods for KubeJS is easy! Just follow the following steps to your 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 { @@ -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-:${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-:$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: - -

- - KubeJS Latest Version - - - Rhino Latest Version - - - Architectury Latest Version - -

- -(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 { @@ -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