#How can I use an item in a block and get another item?

1 messages · Page 1 of 1 (latest)

rustic perch
#

I want to make it so that when I use the item in the dirt block, it gives the player another specific item.


const itemCustom = {
  onUseOn({ block, player }) {
    if (block.typeId == "minecraft:dirt") {
    }
  }
};

rustic ravine
#

Then use getComponent(“equipable”).setItem(EquipmentSlot.Mainhand, item)

#

Item is whatever you want after they interact

#

To get the item they are holding when they interact use
let item = player.getComponent(“equipable”).getItem(EquipmentSlot.Mainhand)

versed prawn
#

Skibidi Rizz