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.

  1. Make a file in the addon scripts directory.
  2. 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')
});
  1. Add a preset icon.
StartupEvents.registry('palladium:abilities', (event) => {
	event.create('mycoolpack/mycoolability')
		.icon(palladium.createItemIcon('palladium:vibranium_circuit'))
});
  1. 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!');
		});
});
  1. 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!');
			}
		});
});
  1. 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!');
		});
});