WorldEdit API Load Schematic to Location.

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

  1. Offline

    DocRedstone

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    What do you need it for, maybe there are better ways. Plugins without dependency are always better.
  3. Offline

    DocRedstone

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I'm working on loading schematics for server owners who host on their own computers.
  4. Offline

    Dreeass

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I don't get you: for people who host on their own computers? Explain yourself because WorldEdit and MCEdit can open the schematics.
  5. Online

    desht

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    DocRedstone likes this.
  6. Offline

    chaseoes BukkitDev Staff

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Yeah, what's wrong with //schematic load?
    ferrybig likes this.
  7. Offline

    DocRedstone

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Because I want to learn something and challenge myself by making a plugin.
  8. Offline

    chaseoes BukkitDev Staff

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Fair enough.
    I'm interested in this too.
    DocRedstone likes this.
  9. Offline

    chaseoes BukkitDev Staff

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    @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.
    DocRedstone likes this.
  10. Offline

    DocRedstone

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    This looks like it doesn't need WorldEdit. Do you happen to know how to save a schematic without worldedit?
  11. Offline

    ItsHarry

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    This is WorldEdit.
  12. Offline

    chaseoes BukkitDev Staff

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    No, it needs WorldEdit.

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

    This post has been edited 1 time. It was last edited by chaseoes Jul 5, 2012.
  13. Offline

    impatientplague

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    how would i for instance make it so it pastes it infront of the player

Share This Page