BlockEvents.rightClicked(event => {
    const { player, level, server, block } = event;
    if (!player || !level || !server || level.isClientSide()) return;

    let blockId = String(block.id);

    if (blockId === 'minecraft:crafting_table' || blockId.includes('tacz') || blockId.includes('forge')) {
        let tag = 'has_triggered_forge_scare';
        
        if (!player.persistentData.contains(tag)) {
            // Cancel opening the workstation grid so they focus on the note
            event.cancel();
            
            player.persistentData.putBoolean(tag, true); 
            let username = player.username.getString();
            
            // CONSTRUCT CUSTOM ITEM PAPER OBJECT NATIVELY
            let customNote = Item.of('minecraft:paper');
            
            // Set stylized name data structures
            customNote.setHoverName(Component.darkRed("A Note left in the Forge").italic(true));
            
            // Inject multi-line deep narrative lore details onto the item NBT arrays
            customNote.setLore([
                Component.gray("The lines are drawn in soot..."),
                Component.red("He watches from the assembly line."),
                Component.red("Stop building things. He counts the tools.")
            ]);
            
            // Shove the physical parchment object directly inside their hand slots safely
            player.give(customNote);
            
            // Run audiovisual jumpscare packets
            server.runCommandSilent(`playsound stalker:throw master ${username} ~ ~ ~ 100 0.4`);
            server.runCommandSilent(`particle minecraft:large_smoke ${player.x} ${player.y + 1} ${player.z} 0.5 0.5 0.5 0.05 30`);
            
            player.displayClientMessage(Component.red("Something left a warning inside the terminal mechanisms..."), true);
        }
    }
});