Download Skill Slots (Fabric) — Minecraft Mods — MetaMods

Skill Slots (Fabric)

Active

Downloads

0

Last update

1 year ago
Client
Adventure
Magic
Utils

Skill Slots (Fabric)

Skill Slots is a library mod that expands gameplay possibilities by adding special slots for item-based skills. These slots serve as an addition to the standard quick access panel and allow activating various abilities using assigned keys.

Image

Create your own skills using KubeJS or Java code, or simply place existing items in the slots to activate their standard right-click behavior.

Example of creating a skill via KubeJS:

// priority: 0
// Server script

// Allow the item to be placed in skill slots
// If the item already has a right-click function, the skill will work automatically
ServerEvents.tags('item', event => {
  event.add('skillslots:skill', 'minecraft:diamond')
})

// Of course, you can create an item via KubeJS and add a special function to it
ItemEvents.rightClicked('minecraft:diamond', event => {
  event.player.tell('You used diamond with right click!')
  // Add cooldown time
  event.player.addItemCooldown(event.item, 60)
})

// This event also triggers when using the skill
BlockEvents.rightClicked(event => {
  // Check cooldown time yourself
  event.player.tell('You right-clicked on a block!')
})

// Example of accessing player's skill slots
ItemEvents.rightClicked('minecraft:emerald', event => {
  let handler = Java.loadClass('snownee.skillslots.SkillSlotsHandler').of(event.player)

  let diamond = Item.of('minecraft:diamond')
  // NBT settings for skill customization
  diamond.nbt = {}
  diamond.nbt.SkillSlots = {
    UseDuration: 20,
    IconScale: 1.5,
    // CanBeToggled: true, // turns the skill into passive. player can toggle it on/off
    ChargeCompleteSound: 'minecraft:entity.player.levelup', // leave empty to disable sound
  }

  // In settings, you can prevent players from changing skills
  // Example of changing skill via KubeJS
  handler.setItem(0, diamond)

  // Check for activated 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)
  }
})

Use handler.setSlots(int) to set the number of available slots or use special unlock items provided by this mod.

The colored button border is displayed only when JEI mod is installed.

Project members
Snownee

Snownee

Created: 14 Feb 2024

ID: 41180