Skip to content

Commit 026ed37

Browse files
committed
docs
1 parent dc35908 commit 026ed37

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

docs/geneticsresequenced/devs/kubejs.mdx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@
44

55
While the mod doesn't explicitly have KubeJS support, it's relatively simple to implement it yourself!
66

7+
### Some necessary reflections
8+
9+
```js
10+
const $ResourceKey = Java.loadClass("net.minecraft.resources.ResourceKey");
11+
const $ResourceLocation = Java.loadClass("net.minecraft.resources.ResourceLocation");
12+
13+
const GENE_REGISTRY_KEY = $ResourceKey.createRegistryKey($ResourceLocation.fromNamespaceAndPath("geneticsresequenced", "gene"));
14+
15+
const toGeneRk = (geneString) => {
16+
const [namespace, path] = geneString.split(":");
17+
return $ResourceKey.create(GENE_REGISTRY_KEY, $ResourceLocation.fromNamespaceAndPath(namespace, path));
18+
};
19+
```
20+
721
### [GeneChangeEvent](https://github.com/Berry-Club/Genetics-Resequenced/blob/NeoForge-1.21/src/main/kotlin/dev/aaronhowser/mods/geneticsresequenced/event/custom/GeneChangeEvent.kt)
822

923
```js
@@ -32,9 +46,7 @@ NativeEvents.onEvent("dev.aaronhowser.mods.geneticsresequenced.event.custom.Modi
3246

3347
```js
3448
const $GenesData = Java.loadClass('dev.aaronhowser.mods.geneticsresequenced.attachment.GenesData')
35-
```
3649

37-
```js
3850
$GenesData.addGene(livingEntity, "geneticsresequenced:chatterbox")
3951
$GenesData.removeGene(livingEntity, "geneticsresequenced:lay_egg")
4052
let hasSlimyDeath = $GenesData.hasGene(livingEntity, "geneticsresequenced:slimy_death")

0 commit comments

Comments
 (0)