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.
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?
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. 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.
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!
Think I managed to finally *start* understanding github. Try this: https://github.com/nathanaelps/Schematic
Have done almost the same some time ago: http://forums.bukkit.org/threads/pasting-loading-schematics.87129/ The only thing it does not support are offsets I think
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.
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.
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.