Skill Slots
Skill Slots is a modification that introduces special slots for item-activated skills into the game. Using KubeJS or Java code, you can create your own unique abilities and skills for your character.
Creating Skills
To add an item to skill slots, use the following code:
// priority: 0
// Server script
// Allows an item to occupy skill slots
// If the item already has a right-click function, the skill is automatically activated
ServerEvents.tags('item', event => {
event.add('skillslots:skill', 'minecraft:diamond')
})
// Creating an item via KubeJS with right-click function
ItemEvents.rightClicked('minecraft:diamond', event => {
event.player.tell('You used a diamond!')
// Setting cooldown time
event.player.addItemCooldown(event.item, 60)
})
// Event also triggers when using a skill
BlockEvents.rightClicked(event => {
// Cooldown check is done manually
event.player.tell('You interacted with a block!')
})
Working with Skill Slots
Example of accessing the skill system:
ItemEvents.rightClicked('minecraft:emerald', event => {
let handler = Java.loadClass('snownee.skillslots.SkillSlotsHandler').of(event.player)
let diamond = Item.of('minecraft:diamond')
// Configuring skill parameters via NBT
diamond.nbt = {}
diamond.nbt.SkillSlots = {
UseDuration: 20,
IconScale: 1.5,
// CanBeToggled: true, // turns the skill into passive with toggle capability
ChargeCompleteSound: 'minecraft:entity.player.levelup', // leave empty to disable sound
}
// Changing skill via KubeJS
handler.setItem(0, diamond)
// Checking for active passive skill
let index = handler.findActivatedPassiveSkill(skill => skill.item.id === 'minecraft:diamond')
if (index !== -1) {
let skill = handler.skills.get(index)
event.player.tell(skill.item.id)
}
})
Additional Features
Use the handler.setSlots(int) method to configure the number of available slots or apply special unlock items provided by the mod.
Colored button styling is displayed only when JEI modification is installed.