Custom Abilities - souppCodez/Palladium-Wiki-Enhancements GitHub Wiki
This page of the wiki will show you how to make a custom ability. Custom abilities are made using KubeJS scripts.
- Make a file in the addon scripts directory.
- Add the code to register the ability.
StartupEvents.registry('palladium:abilities', (event) => {
// ID of the condition will be: 'kubejs:mycoolpack/mycoolability'
event.create('mycoolpack/mycoolability')
});
- Add a preset icon.
StartupEvents.registry('palladium:abilities', (event) => {
event.create('mycoolpack/mycoolability')
.icon(palladium.createItemIcon('palladium:vibranium_circuit'))
});
- Add the first tick handler.
StartupEvents.registry('palladium:abilities', (event) => {
event.create('mycoolpack/mycoolability')
.icon(palladium.createItemIcon('palladium:vibranium_circuit'))
.firstTick((entity, entry, holder, enabled) => {
entity.tell('First Tick!');
});
});
- Add the tick handler.
StartupEvents.registry('palladium:abilities', (event) => {
event.create('mycoolpack/mycoolability')
.icon(palladium.createItemIcon('palladium:vibranium_circuit'))
.firstTick((entity, entry, holder, enabled) => {
entity.tell('First Tick!');
});
.tick((entity, entry, holder, enabled) => {
if (enabled) {
entity.tell('Tick!');
}
});
});
- Add the last tick handler.
StartupEvents.registry('palladium:abilities', (event) => {
event.create('mycoolpack/mycoolability')
.icon(palladium.createItemIcon('palladium:vibranium_circuit'))
.firstTick((entity, entry, holder, enabled) => {
entity.tell('First Tick!');
});
.tick((entity, entry, holder, enabled) => {
if (enabled) {
entity.tell('Tick!');
}
});
.lastTick((entity, entry, holder, enabled) => {
entity.tell('Last Tick!');
});
});