WorldEdit API Load Schematic to Location.

Discussion in 'Plugin Development' started by DocRedstone, Jun 26, 2012.

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

    DocRedstone

    I've been looking for a way to load a schematic to a specific location using the WorldEdit API. I have come across this function in the WorldEdit documentation but Im not sure how to use it. Would anyone give me a suggestion? Or code examples.

    Code:
    load
     
    public abstract CuboidClipboard load(File file)
                                  throws IOException,
                                        DataException
    Loads a schematic from the given file into a CuboidClipboard
    Parameters:
    file - The file to load from
    Returns:
    The CuboidClipboard containing the contents of this schematic
    Throws:
    IOException - If an error occurs while reading data
    DataException - if data is not in the correct format
     
  2. Offline

    Dreeass

    What do you need it for, maybe there are better ways. Plugins without dependency are always better.
     
  3. Offline

    DocRedstone

    I'm working on loading schematics for server owners who host on their own computers.
     
  4. Offline

    Dreeass

    I don't get you: for people who host on their own computers? Explain yourself because WorldEdit and MCEdit can open the schematics.
     
  5. Offline

    desht

    DocRedstone likes this.
  6. Offline

    chaseoes

    Yeah, what's wrong with //schematic load?
     
    ferrybig likes this.
  7. Offline

    DocRedstone

    Because I want to learn something and challenge myself by making a plugin.
     
  8. Offline

    chaseoes

    Fair enough.
    I'm interested in this too.
     
    DocRedstone likes this.
  9. Offline

    chaseoes

    DocRedstone
    Code:java
    1. private void loadArea(World world, File file,Vector origin) throws DataException, IOException, MaxChangedBlocksException{
    2. EditSession es = new EditSession(new BukkitWorld(world), 999999999);
    3. CuboidClipboard cc = CuboidClipboard.loadSchematic(file);
    4. cc.paste(es, origin, false);
    5. }
    Where file is the schematic, and vector is the location where it should be pasted from.
     
  10. Offline

    DocRedstone

    This looks like it doesn't need WorldEdit. Do you happen to know how to save a schematic without worldedit?
     
  11. Offline

    ItsHarry

    This is WorldEdit.
     
    AstramG likes this.
  12. Offline

    chaseoes

    No, it needs WorldEdit.

    And no, you could look into how WorldEdit does it though.
     
  13. Offline

    impatientplague

    how would i for instance make it so it pastes it infront of the player
     
  14. Offline

    ArsenArsen

    What i need to use? Is it: loadArea(world, tent, origin);
    underlined cant be resolved as variable file is called tent.schematic
     
  15. Offline

    chaseoes

    Because you need to give it a File object. I suggest learning Java first. :)
     
  16. Offline

    ArsenArsen

    I realised later, thanks anyways!
     
  17. Offline

    ItsMattHogan

    Is there a workaround for the loadSchematic deprecated method without suppressing the warning?
     
Thread Status:
Not open for further replies.

Share This Page