Created
February 6, 2017 11:14
-
-
Save Robijnvogel/ea0b13db92e0c22384b357a5b0d87927 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void saveSchematic(Schematic schematic, String name) { | |
NBTTagCompound schematicNBT = Schematic.saveToNBT(schematic); | |
File saveFolder = new File(DDConfig.configurationFolder, "/Schematics/Saved"); | |
if (!saveFolder.exists()) { | |
saveFolder.mkdirs(); | |
} | |
File saveFile = new File(saveFolder.getAbsolutePath() + "/" + name + ".schem"); | |
try { | |
saveFile.createNewFile(); | |
GZIPOutputStream schematicZipStream = new GZIPOutputStream(new FileOutputStream(saveFile)); | |
CompressedStreamTools.write(schematicNBT, new DataOutputStream(schematicZipStream)); | |
saveFile.createNewFile(); | |
} catch (IOException ex) { | |
Logger.getLogger(SchematicHandler.class.getName()).log(Level.SEVERE, null, ex); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment