Skip to content

Commit 5a62868

Browse files
committed
kjs-eio: add capacitor registration docs
1 parent 6831d12 commit 5a62868

3 files changed

Lines changed: 78 additions & 0 deletions

File tree

wikis/kubejs-enderio/.vitepress/config.mts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ export default defineConfig({
3030
{
3131
text: "Events",
3232
items: [
33+
{ text: "Overview", link: "event/overview" },
34+
{ text: "Capacitor Registration", link: "event/capacitorregistry" },
3335
{ text: "Conduit Registration", link: "event/conduitregistry" },
3436
{ text: "Grinding Ball Modification", link: "event/grindingballs" },
3537
{ text: "Vat Reagent Modification", link: "event/vatreagents" },
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Capacitor Registration
2+
3+
This registry event extension allows you to register custom Capacitors. Capacitors are used in EnderIO machines and can modify different properties of them.
4+
5+
> [!WARNING] NOTE
6+
> This event extension only exists since mod version 1.21.1-0.12.0, release date: 2026-02-18.
7+
8+
**It is a startup event and not reloadable!**
9+
Keep in mind that startup events have to be located inside the `kubejs/startup_scripts` folder.
10+
11+
## Overview
12+
13+
This is an extension to the built-in KubeJS item registry event. It adds convenience methods to register custom Capacitors via KubeJS.
14+
15+
- access in a startup script via: `StartupEvents.registry`
16+
- functions:
17+
- `baseValue(float)`
18+
- description: sets the base value of the Capacitor; this is the value for all Capacitor modifiers if no custom value is set for them
19+
- required: no
20+
- default value: `1`
21+
- `modifierValue(CapacitorModifier, float)`
22+
- description: sets the value for a specific Capacitor modifier; this overrides the base value for the specified modifier
23+
- required: no
24+
- default value: same as base value
25+
- `CapacitorModifier` is an enum and can be specified by using `CapacitorModifier.<VALUE>` or by an case-insensitive string
26+
- possible values:
27+
- `ENERGY_CAPACITY` - modifies the energy capacity of the machine
28+
- `ENERGY_USE` - modifies the energy use of the machine
29+
- `FUEL_EFFICIENCY` - modifies the fuel efficiency of the machine
30+
- `BURNING_ENERGY_GENERATION` - modifies the burning energy generation of the machine; only applies to generators
31+
- `hideFromCreativeTab()`
32+
- description: hides the Capacitor from the creative tab; this is useful for Capacitors that are only used for loot as a surprise
33+
- required: no
34+
- default value: `false`
35+
- all functions of the KubeJS `ItemBuilder`, for example `displayName`, `rarity`, `tooltip`, etc.
36+
37+
## Event Listener
38+
39+
To access the event, the first thing you need to do is to open an event listener for the `registry` event in a startup script.
40+
41+
```js
42+
StartupEvents.registry("item", event => {
43+
// ...
44+
})
45+
```
46+
47+
After that, you can use the `CapacitorBuilder` to register a custom Capacitor.
48+
49+
## Example
50+
51+
```js
52+
StartupEvents.registry("item", event => {
53+
event
54+
.create(
55+
"my_modpack:my_capacitor", // id of the capacitor (will use kubejs if no namespace is specified)
56+
"enderio:capacitor" // type to register (always enderio:capacitor)
57+
)
58+
.displayName("My Capacitor") // overrides the automatically generated display name, can still be changed with lang file
59+
.rarity("rare") // common, uncommon, rare, epic
60+
.glow(true) // enchantment overlay
61+
.baseValue(1.4)
62+
.modifierValue("energy_use", 0.2)
63+
.modifierValue("ENERGY_CAPACITY", 2)
64+
.modifierValue(CapacitorModifier.FUEL_EFFICIENCY, 2.3)
65+
.hideFromCreativeTab()
66+
.texture("minecraft:item/acacia_boat") // custom texture for the capacitor; this example uses the vanilla acacia boat texture
67+
})
68+
```
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Event Overview
2+
3+
| Name | Startup | Server |
4+
| -------------------------- | :-----: | :----: |
5+
| Capacitor Registry || |
6+
| Conduit Registry | ||
7+
| Grinding Ball Modification || |
8+
| Vat Reagent Modification | ||

0 commit comments

Comments
 (0)