private void writeComponents(BufferedWriter writer, ElementManager manager) throws IOException {
   writer.write("{");
   writer.newLine();
   writer.write(
       space(1)
           + "\"__comment\": \"Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)\",");
   writer.newLine();
   if (!manager.getAmbientOcc()) {
     writer.write("\"ambientocclusion\": " + manager.getAmbientOcc() + ",");
     writer.newLine();
   }
   writeTextures(writer);
   writer.newLine();
   writer.write(space(1) + "\"elements\": [");
   for (int i = 0; i < manager.getElementCount(); i++) {
     writer.newLine();
     writer.write(space(2) + "{");
     writer.newLine();
     writeElement(writer, manager.getElement(i));
     writer.newLine();
     writer.write(space(2) + "}");
     if (i != manager.getElementCount() - 1) writer.write(",");
   }
   writer.newLine();
   writer.write(space(1) + "]");
   writer.newLine();
   writer.write("}");
 }
 private void writeTextures(BufferedWriter writer) throws IOException {
   writer.write(space(1) + "\"textures\": {");
   writer.newLine();
   if (manager.getParticle() != null) {
     writer.write(space(2) + "\"particle\": \"blocks/" + manager.getParticle() + "\"");
     if (textureList.size() > 0) {
       writer.write(",");
     }
     writer.newLine();
   }
   for (String texture : textureList) {
     writer.write(space(2) + "\"" + textureList.indexOf(texture) + "\": \"" + texture + "\"");
     if (textureList.indexOf(texture) != textureList.size() - 1) {
       writer.write(",");
     }
     writer.newLine();
   }
   writer.write(space(1) + "},");
 }
 private void compileTextureList() {
   for (Element cuboid : manager.getAllElements()) {
     for (Face face : cuboid.getAllFaces()) {
       System.out.println(face.getTextureLocation() + " " + face.getTextureName());
       if (face.getTextureName() != null && !face.getTextureName().equals("null")) {
         if (!textureList.contains(face.getTextureLocation() + face.getTextureName())) {
           textureList.add(face.getTextureLocation() + face.getTextureName());
         }
       }
     }
   }
 }