Solved WorldEdit API schematic problem

Discussion in 'Spigot Plugin Development' started by Videosambo, Oct 20, 2018.

Thread Status:
Not open for further replies.
  1. hello, I have tried to make code that can load schematic, since 1.13 come, WorldEdit API changed and I dont know how to fix this issue:

    Code (Text):

    package com.videosambo.motimaa.Taivas;

    import java.io.File;

    import org.bukkit.Bukkit;
    import org.bukkit.World;
    import org.bukkit.util.Vector;

    import com.sk89q.worldedit.EditSession;
    import com.sk89q.worldedit.WorldEdit;

    public class CreatePortalToDestworld {
       
        Main plugin = Main.getPlugin(Main.class);
       
        World destworld = Bukkit.getServer().getWorld(plugin.getConfig().getString("destworld"));
       
        public void onCreate (int x, int y, int z) {
           
            File portalfile = new File("./schematics/portal.schematic");
           
            int xu = x + 0;
            int yu = y + 0;
            int zu = z + 0;
           
            Vector v = new Vector(xu, yu, zu);
            EditSession es = WorldEdit.getInstance().getEditSessionFactory().getEditSession((com.sk89q.worldedit.world.World) destworld, WorldEdit.getInstance().getConfiguration().maxChangeLimit);
            SchematicFormat format = SchematicFormat.getFormat(portalfile);
            CuboidClipboard cc = format.load(portalfile);
            cc.paste(es, v, false);
           
        }

    }
     
    Problem here is SchematicFormat and CuboidClipboard.
     
  2. WorldEdit 1.13 no longer supports the same structure formats as 1.7-1.12.
     
  3. Ok, do you know any other replacements or way to paste schematics?
     
  4. You can paste 1.7-1.12 schematic formats using FAWE 1.13 but you cannot save schematic formats with this version for now as it is not stable.
    https://github.com/boy0001/FastAsyncWorldedit/wiki/Pasting-a-schematic

    This is why developers are suggesting to use Minecrafts structure format.
     
    • Useful Useful x 1
  5. I tried code from website that you linked.
    Code (Text):

    EditSession editSession = ClipboardFormats.findByFile(portalfile).load(portalfile).paste(destworld, v, false, false, (Transform) null);
     
    And it gives error:
    The method paste(com.sk89q.worldedit.world.World, com.sk89q.worldedit.Vector, boolean, boolean, com.sk89q.worldedit.math.transform.Transform) in the type Schematic is not
    applicable for the arguments (org.bukkit.World, com.sk89q.worldedit.Vector, boolean, boolean, com.sk89q.worldedit.math.transform.Transform)
     
  6. You need to use:
    Code (Text):
    new BukkitWorld(destworld)
     
    • Useful Useful x 2
  7. not working
     
  8. What are the errors on your IDE and what's the variable 'v'?
     
  9. Variable v is vector, but do it need to be worldedit vector. I may use couple for loops to build my schematics, woud that be better idea?
     
  10. Yes
     
Thread Status:
Not open for further replies.