#Ambiguous method error when trying to spawn item

1 messages · Page 1 of 1 (latest)

worn socket
#

I'm trying to replicate the ability to brush armadillos for scutes on Turtles in 1.20.1, and my code for it looks like this (in a server script):

ItemEvents.entityInteracted('minecraft:brush', event => {
    if (event.item.getDamageValue() == event.item.getMaxDamage()) return // Doesn't work if tool is broken (I have a mod that makes it so that tools don't disappear when they break but simply become unusable, hence why this is needed)
    // If target is an adult turtle...
    if (event.target.type == 'minecraft:turtle' && event.target.age >= 0) {
        // Damage player's brush in survival, spawn a scute, and play the brushing sound
        if (!event.player.creative())
        {
            event.item.setDamageValue(Math.min(event.item.getDamageValue() + 4, event.item.getMaxDamage()))
        }
        event.target.spawnAtLocation('minecraft:scute')
        event.target.playSound('minecraft:item.brush.brushing.generic')
    }
})```
However, the `event.target.spawnAtLocation('minecraft:scute')` line always returns an error saying the call is ambiguous between a version that uses an ItemLike and a version that uses an ItemStack as the first input. I've tried using `Ingredient.of('minecraft:scute')`, I've tried adding a second argument (formatted both as `1` and `1.0` to see if that'd change anything), and I've even tried loading the `ItemStack` class to call `$ItemStack.of('minecraft:scute')` but the call remains ambiguous regardless. What am I missing here that I need to do to make the call work properly?
compact mulchBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

mystic dagger
worn socket
#

Yep, that worked! Thank you so much!