Using a craftscript file (js code), how do I place a Note Block with a particular note set?

Discussion in 'CraftScripts' started by Park, Aug 6, 2016.

  1. Park

    Park New Member

    Using a craftscript file (js code), I am trying to place a Note Block (item 25) in Minecraft (v1.6.4) with a particular note set on that Note Block when it is placed.

    I tried the following with no success:

    Code (Text):

    importPackage(Packages.com.sk89q.worldedit);
    importPackage(Packages.com.sk89q.worldedit.blocks);

    var meGetBlockIn = player.getBlockIn();
    var sess = context.remember();

    //var myNoteBlock = new BaseBlock(BlockID.NOTE_BLOCK);
    var myNoteBlock = new NoteBlock();
    myNoteBlock.setNote(7);

    sess.setBlock(meGetBlockIn.add(2, 0, 0), myNoteBlock);
     
    If someone knows how to do this, please respond by typing a code snippet in your response.

    Thanks so much.