[API] How to get lines on sign from schematic?

Discussion in 'WorldEdit' started by Robotnik, Oct 5, 2017.

  1. Robotnik

    Robotnik New Member

    I want to read the lines from a sign stored in a schematic, but I cant seem to find a way to read the sign data with the API, or find a way to convert a BaseBlock to a bukkit Block so I can read the sign data. Any ideas on how to accomplish this?
  2. wizjany

    wizjany Administrator Developer

    You can try doing: new SignBlock(int,int).setNbtData(baseBlock.getNbtData()), signBlock.getText().
    However, those classes are really old and i'm not sure how the underlying nbt works these days. i know signs were switched to json strings at some point and it caused some oddities in the handling.

    if you have the nbt spec, you can always just look at the nbt from baseBlock.getNbtData() directly (there should be up 4 string tags called "Text#" iirc)
    Last edited: Oct 8, 2017
  3. Robotnik

    Robotnik New Member

    Looks like .getNbtData() is able to read the sign data just fine. Just need to parse the sign text from the JSON string and that should work perfectly