WorldEdit | Create a Selection

Discussion in 'Plugin Development' started by WiseHollow, Jul 19, 2015.

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

    WiseHollow

    I have two Location objects.
    Code:
            Location l1 = plot.getLocation().clone();
            Location l2 = plot.getLocation().clone();
            l1.add(Settings.getPlotMaxRadius(), plot.getHeightLimit(), Settings.getPlotMaxRadius());
            l2.add(-Settings.getPlotMaxRadius(), -plot.getHeightLimit(), -Settings.getPlotMaxRadius());
    
    I am wanting to create a schematic from this. Using the WorldEdit API, is there a way to turn these two locations into a CuboidClipboard and save it to a schematic file?
     
  2. Offline

    WiseHollow

  3. @WiseHollow
    Create a new CuboidClipboard object using a Vector as the parameter, the Vector being Vector of first location subtracted by Vector of the second location.
    Code:
    CuboidClipboard board = new CuboidClipboard(l1.toVector().subtract(l2.toVector()));
    Create your schematic file:
    Code:
    File schematicFile = new File("...");
    
    if(!(schematicFile.exists())) {
        schematicFile.createNewFile();
    }
    Then save it:
    Code:
    board.saveSchematic(schematicFile);
    If that doesn't work, try
    Code:
    SchematicFormat.MCEDIT.save(board, schematicFile);
    I've never used CuboidClipboards, so this information came from the WorldEdit API documentation (it's not very well documented). You may have to use the setOrigin() and setOffset() methods in the CuboidClipboard class.
     
    Last edited: Jul 21, 2015
Thread Status:
Not open for further replies.

Share This Page