You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ScriptCraft - Scripting Minecraft
Hi there!
I have some code that should be able to tell what type of block was broken when one is broken:
functionblockbroken(event) {
constmaterial = event.block.type
if (material === "STONE") {
//do something
} else {
console.log(material)
console.log("not stone!")
}
}
events.blockBreak(blockbroken);
When I break stone, It logs "STONE" to the console just as written in the if statement, but it still says "not stone!". Does anyone know what I'm doing wrong?
Randy Friend
unread,
Dec 3, 2022, 10:11:59 AM12/3/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ScriptCraft - Scripting Minecraft
Where do you have your event?
Odds are it is firing when you don't think it should. Remember Air is a block as well and thus your code could be firing after the block breaks and when your pick 'hits' air.