Schematic doesn't paste at correct location?

Discussion in 'Plugin Development' started by ThunderWaffeMC, Feb 8, 2014.

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

    ThunderWaffeMC

    Hi. I'm trying to paste a MCEdit schematic file but the schematic doesn't seem to paste where I want it to.

    I have a car made of blocks that look like this:

    [​IMG]

    When it pastes with the code shown below, it pastes it like so:

    [​IMG]

    It should really paste one block ahead if it's facing north but it doesn't.

    My code:

    Code:java
    1.  
    2. pasteVehicleSchematic(schematicName, player.getLocation().getBlock().getRelative(BlockFace.NORTH).getLocation());
    3.  
    4. public static void pasteVehicleSchematic(String schematicName, Location location) {
    5. EditSession session = new EditSession(new BukkitWorld(location.getWorld()), Integer.MAX_VALUE);
    6. try {
    7. try {
    8. File file = new File("plugins/WorldEdit/schematics/" + schematicName + ".schematic");
    9. SchematicFormat schematic = SchematicFormat.getFormat(file);
    10. CuboidClipboard clipboard = schematic.load(file);
    11. clipboard.place(session, BukkitUtil.toVector(location), true);
    12. } catch (NullPointerException ex) {
    13.  
    14. }
    15. } catch (IOException | DataException | MaxChangedBlocksException e) {
    16. ((Throwable)e).printStackTrace();
    17. }
    18. }
    19.  


    Thanks for any help!
     
  2. ThunderWaffeMC
    It might select the wrong corner of the schematic when pasting. Just modify the location to move it.
     
    ThunderWaffeMC likes this.
Thread Status:
Not open for further replies.

Share This Page