Getting block ID and Data from schematic (WE | FAWE)

Discussion in 'Spigot Plugin Development' started by Ficato, Jul 27, 2018.

  1. Hey there,

    I'm trying to check my schematics for certain block, like in my case wool. So I went through my clipboard but all the blocks seem to be air (No the schematic is correct and works).

    Here is my code:
    Code (Java):
        public Test(){
            File schem = new File("test.schematic");

            try {
                Clipboard clipboard = ClipboardFormat.SCHEMATIC.getReader(new FileInputStream(schem)).read(null);

                int x = clipboard.getRegion().getWidth();
                int y = clipboard.getRegion().getHeight();
                int z = clipboard.getRegion().getLength();

                for(int x1 = 0; x1 <= x; x1++){
                    for(int y1 = 0; y1 <= y; y1++){
                        for(int z1 = 0; z1 <= z; z1++){
                                BaseBlock block = clipboard.getBlock(new Vector(x1, y1, z1));

                            int id = block.getId();
                            int data = block.getData();

                            //if(id == 35){
                                Bukkit.broadcastMessage("§7Block found! (§b" + x1 + "§7|§b" + y1 + "§7|§b" + z1 + "§7) // Data(§c" + id + ":" + data + "§7)");

            } catch (Exception ex){
  2. What is baseblock? Is id the baseblocks' id or the material or the baseblocks' id?
  3. It's the id for the block.
  4. Hasn't that got something to do with it then, you're trying to find wool and you're searching the id of a block not the id of the material of the block.
    This is purely a guess, I don't use the WorldeditAPI.
  5. Well the blocks id and data should represent the block? If the block has the id 35 it should be wool and if it has the data 14 it should be red wool.