Hello ! When I execute the command "!furnace", this didn't work and I have this error In my console : [2023-06-23 18:11:00:551 ERROR] [Scripting] Unhandled promise rejection: TypeError: not a function
This is my code in the file "furnace.js"
import { world } from "@minecraft/server"
world.beforeEvents.chatSend.subscribe(async (ev) => {
const player = ev.sender
const msg = ev.message
if (!msg.startsWith("!",0)) return
ev.cancel = true
await null
if (msg == "!furnace") {
const mainHandItem = player.getMainhandItem();
if (mainHandItem) {
const meltedItem = world.createItemStack("minecraft:melted_item", mainHandItem.count, mainHandItem.metadata);
player.setMainhandItem(meltedItem);
player.sendMessage("§aVotre minerai a été fondu !");
}
}
});```
Can you help me please ?
Thanks in advance !