Schematic class

Discussion in 'Resources' started by nathanaelps, Oct 4, 2012.

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

    nathanaelps

    Hey, all. I keep running into schematics, lovin' them but hatin' the work involved with dealing with them.

    And as much as I have enjoyed WorldEdit, I'm not using it right now.

    So I decided to whip up a little class to help me deal with it better. And I bet I'm not the only person who's wanted to do this.

    And github hates me. (Or I just don't understand how to make it work.)

    So, with all those ideas together, here's a class for dealing with schematics.

    -> the schematic class. <-
    Or on GitHub (If this works)

    Anyone who wants to use it, please do so. Anyone who doesn't, don't.

    And if you fix it up, tinker with it, or whatever, pass me a copy.
     
    p000ison likes this.
  2. Offline

    slater96

    This looks interesting, I've done
    File prefix = new File(plugin.getDataFolder() + File.separator + "Schematics" + File.separator + "test.schematic");
    As the schematic is in a folder in my plugin directory, but on command when I do Schematic.paste(p.getLocation());
    Nothing appears :( What am I doing wrong?
     
  3. Offline

    nathanaelps

    Ugh. Without seeing your actual code, I'm shooting in the dark, but I'll take a guess:

    I already coded it to add ".schematic" on the end, as well as put the filename in a couple of lines later. My guess is that you've managed to mangle my carefully mangled mess. :D Output exactly the filename that it's trying to use in the file_get_contents function. See if that clears anything up.

    I'll check it out here, see if anything else comes up.

    --edit--

    I added a couple of lines that should automatically log the filename that you're using. Try it now.
     
  4. Offline

    chaseoes

    What's wrong with TerrainManager?
     
  5. Offline

    nathanaelps

    Nothing! It just has WorldEdit as a dependency, and I'm trying to thin down my server. My snippet has no plugin dependencies at all!
     
  6. Offline

    chaseoes

    Ah, nice. :)
     
  7. Offline

    md_5

    Moved to resources.
     
    nathanaelps likes this.
  8. Offline

    nathanaelps

  9. Offline

    p000ison

  10. Offline

    nathanaelps

    Offsets aren't part of the official spec, anyway. WE uses them for pasting.

    Would you mind if I pulled some of your class (specifically loadSchematic) into mine? It's far cleaner, especially since yours isn't reimagined PHP. lol.
     
  11. Offline

    p000ison

    sure, I think I have some parts from WE, but I think it's ok.
     
  12. Offline

    JeroenV

    How should I be using this? Because this seems very usefull but I'm having troubles finding out wich methods to actually use. This is what I have so far:

    Code:
        static File SchematicFolder = new File(getDataFolder(),"Schematics");
        public static void Build(Chunk chunk,String Buildingname, Player player){
       
            int ChunkX = chunk.getX()*16;
            int ChunkZ = chunk.getZ()*16;
           
            World world = player.getWorld();
            Location Ploc = player.getLocation();
            double PlocY = Ploc.getY();
            Location loc = new Location(world,ChunkX,PlocY,ChunkZ);
           
            File prefix = new File(SchematicFolder +"block.schematic");
            Schematic.paste(loc);
            
    Now the problem is that although I have the file stored in prefix, there should be a method that actually puts it into a clipboard/session so when I use 'Schematic.paste(loc)' it pastes the data from that file. And I'm having a hard time finding that, mostly because I don't understand anything about bytes.
     
  13. Offline

    nathanaelps

    Oh, bother. I've re-written enough of the class now that I'm forgetting how it needs accessed. I've added JNBT as a dependency, which means that it now isn't just a single file... Lemme read my old code, try to get an answer for you.

    (Plus, I'll upload my new code sometime, it's able to handle TileEntities much more effectively.)

    (Oh, gosh. Did *I* write this?!)

    Mm... Lemme clean up my new code and post it. This old code would require me to walk you through a few changes to make it compatible with your project, and by that time I might as well just give you the better code. I'll try to have it up this afternoon.

    ~~EDIT~~

    I got distracted. I'll tag you when I do get it up.
     
Thread Status:
Not open for further replies.

Share This Page