Package se.llbit.json

Examples of se.llbit.json.JsonArray


      String versionName = obj.get("name").stringValue("");
      if (!versionName.equals(version)) {
        System.err.println("Stored version name does not match file name");
        return false;
      }
      JsonArray array = obj.get("libraries").array();
      for (JsonValue value: array.getElementList()) {
        VersionInfo.Library lib = new VersionInfo.Library(value.object());
        switch (lib.testIntegrity(libDir)) {
        case INCOMPLETE_INFO:
          System.err.println("Missing library name or checksum");
          return false;
View Full Code Here


      }
      break;
    }
    case SKYBOX:
    {
      JsonArray array = new JsonArray();
      for (int i = 0; i < 6; ++i) {
        if (!skybox[i].isEmptyTexture()) {
          array.add(skyboxFileName[i]);
        } else {
          array.add(new JsonNull());
        }
      }
      sky.add("skybox", array);
      break;
    }
View Full Code Here

      }
      break;
    }
    case SKYBOX:
    {
      JsonArray array = sky.get("skybox").array();
      for (int i = 0; i < 6; ++i) {
        JsonValue value = array.get(i);
        skyboxFileName[i] = value.stringValue("");
      }
      break;
    }
    default:
View Full Code Here

    }
    return copy;
  }

  public static JsonArray gradientJson(Collection<Vector4d> gradient) {
    JsonArray array = new JsonArray();
    for (Vector4d stop: gradient) {
      JsonObject obj = new JsonObject();
      obj.add("rgb", Color.toString(stop.x, stop.y, stop.z));
      obj.add("pos", stop.w);
      array.add(obj);
    }
    return array;
  }
View Full Code Here

  public VersionInfo(JsonObject json) {
    name = json.get("name").stringValue("");
    timestamp = json.get("timestamp").stringValue("");
    date = Util.dateFromISO8601(timestamp);
    notes = json.get("notes").stringValue("");
    JsonArray libraryArray = json.get("libraries").array();
    for (JsonValue lib: libraryArray.getElementList()) {
      libraries.add(new Library(lib.object()));
    }
  }
View Full Code Here

  private JsonObject json() {
    JsonObject obj = new JsonObject();
    obj.add("name", name);
    obj.add("timestamp", timestamp);
    obj.add("notes", notes);
    JsonArray libraryArray = new JsonArray();
    for (Library lib: libraries) {
      libraryArray.add(lib.json());
    }
    obj.add("libraries", libraryArray);
    return obj;
  }
View Full Code Here

    desc.add("sun", sun.toJson());
    desc.add("sky", sky.toJson());

    desc.add("cameraPresets", cameraPresets.fullCopy());

    JsonArray chunkList = new JsonArray();
    for (ChunkPosition pos: chunks) {
      JsonArray chunk = new JsonArray();
      chunk.add(pos.x);
      chunk.add(pos.z);
      chunkList.add(chunk);
    }
    desc.add("chunkList", chunkList);

    return desc;
View Full Code Here

    // read these after loading camera, sun, sky because they refresh the scene
    spp = desc.get("spp").intValue(0);
    renderTime = desc.get("renderTime").longValue(0);

    chunks.clear();
    JsonArray chunkList = desc.get("chunkList").array();
    for (JsonValue elem: chunkList.getElementList()) {
      JsonArray chunk = elem.array();
      int x = chunk.get(0).intValue(Integer.MAX_VALUE);
      int z = chunk.get(1).intValue(Integer.MAX_VALUE);
      if (x != Integer.MAX_VALUE && z != Integer.MAX_VALUE) {
        chunks.add(ChunkPosition.get(x, z));
      }
    }
  }
View Full Code Here

    }
    JsonObject version = new JsonObject();
    version.add("name", versionName);
    version.add("timestamp", Util.ISO8601FromDate(new Date()));
    version.add("notes", notes);
    JsonArray libraries = new JsonArray();
    {
      libraries.add(libraryJson(chunkyCore));
    }
    for (File lib: libDir.listFiles()) {
      if (lib.getName().endsWith(".jar")) {
        libraries.add(libraryJson(lib));
      }
    }
    version.add("libraries", libraries);
    JarEntry entry = new JarEntry("version.json");
    entry.setTime(System.currentTimeMillis());
View Full Code Here

TOP

Related Classes of se.llbit.json.JsonArray

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.