Get Pasted Schematic Blocks

Discussion in 'Plugin Development' started by xWatermelon, Aug 11, 2013.

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

    xWatermelon

    I am making a plugin that uses schematics for game maps. I paste a schematic in, loop through the blocks in the schematic, check if it is a certain block, and set the spawn location. However, it is not finding correct blocks. Here is my method to get blocks in a pasted schematic (uses WorldEdit):
    Code:java
    1. for(int x = -(clipboard.getWidth() / 2); x <= clipboard.getWidth() / 2; x++){
    2. for(int y = -(clipboard.getHeight() / 2); y <= clipboard.getHeight() / 2; y++){
    3. for(int z = -(clipboard.getLength() / 2); z <= clipboard.getLength() / 2; z++){
    4. Block block = origin.getBlock().getRelative(x, y, z);
    5.  
    6. blocks.add(block);
    7. }
    8. }
    9. }
    10. }

    However, this is not always outputting the correct blocks. Am I doing something wrong?

    Bump :(

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

    xWatermelon

  3. Offline

    newboyhun

  4. Offline

    xWatermelon

    newboyhun because WE pastes schematics from the origin. Anyone know what's wrong?
     
  5. Offline

    chasechocolate

    When looping through the coordinates, try setting the block to a specific type, such as bedrock. Then, it will probably be easer to find out what's going wrong.

    EDIT: If that doesn't work, try swapping width and length (so x is length and z is width).
     
  6. Offline

    Silus Games

    xWatermelon Did you ever figure out the issue? Please post the code that fixed your issue. Thanks.
     
Thread Status:
Not open for further replies.

Share This Page