Schematic handling

Discussion in 'Plugin Development' started by LordManegane, Mar 31, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    LordManegane

    Well... Im using for the first time the WE Api for schematic handling. And im trying to get if the block type its a sponge and create a spawnpoint.

    This is the code i have

    Code:java
    1. CuboidClipboard schematic = CuboidClipboard.loadSchematic(file);
    2. Vector currentPoint;
    3. int currentBlock;
    4. for (int y = 0; y < schematic.getSize().getBlockY(); ++y) {
    5. for (int x = 0; x < schematic.getSize().getBlockX(); ++x) {
    6. for (int z = 0; z < schematic.getSize().getBlockZ(); ++z) {
    7. currentPoint = new Vector(x, y, z);
    8. currentBlock = schematic.getPoint(currentPoint).getType();
    9.  
    10. if (currentBlock == 0) {
    11. continue;
    12. }
    13.  
    14. if (currentBlock == Material.SPONGE.getId()) {
    15.  
    16. schematic.setBlock(currentPoint, new BaseBlock(0));
    17. createSpawnpoint(currentPoint);
    18. }
    19.  
    20. }
    21. }
    22. }


    So... the createSpawnpoint() works perfectly. But when i try to replace the current block with the air block doesnt work.

    Help please =P

    please..

    bump

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  2. Offline

    LordManegane

  3. Offline

    Syd

    What exactly are you trying to do?
    How do you want to see the change? You're just changing the CuboidClipboard, but nothing in the world itself - maybe this is the problem?
     
    LordManegane likes this.
  4. Offline

    LordManegane

    Syd yes, its that the problem!
     
  5. Offline

    Syd

    LordManegane
    Then you need to modify the actual world.
    Either you try to get the LocalWorld (WE API) for WorldEdit, or you use the paste or place or whatever method of the CuboidClipboard to place the schematic.
     
    LordManegane likes this.
  6. Offline

    LordManegane

    Syd Can you explain me more please?

    Syd I fixed it, but i cant replace it to air!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  7. Offline

    Syd

  8. Offline

    LordManegane

    Syd

    PHP:
        EditSession es = new EditSession(new BukkitWorld(world), 20000);
               
               
                
    CuboidClipboard schematic CuboidClipboard.loadSchematic(file);
               
               
       
         
            
    Vector currentPoint;
                  
    int currentBlock;
                  for (
    int y 0schematic.getSize().getBlockY(); ++y) {
                      for (
    int x 0schematic.getSize().getBlockX(); ++x) {
                          for (
    int z 0schematic.getSize().getBlockZ(); ++z) {
                              
    currentPoint = new Vector(xyz);
                              
    currentBlock schematic.getPoint(currentPoint).getType();
                              if (
    currentBlock == Material.SIGN.getId()) {
                     
                                  
    schematic.getBlock(currentPoint).setType(Material.AIR.getId());
                                  
    createSpawnpoint(currentPoint);
                   
                              }
     
                          }
                      }

    schematic.paste(es,origintrue);
     
                  }
     
  9. Offline

    Syd

    Have tried schematic.setBlock? Otherwise I have no idea right now...
     
  10. Offline

    LordManegane

    Syd Yes. I do everything. but it doesnt work
     
Thread Status:
Not open for further replies.

Share This Page