dont always regenerate uuid

This commit is contained in:
zimzaza4
2024-07-23 17:37:26 +08:00
parent 0b17221801
commit b6e6a27c10

View File

@@ -103,7 +103,6 @@ public class GeneratorMain {
} }
File animationsFolder = new File(output, "animations"); File animationsFolder = new File(output, "animations");
File entityFolder = new File(output, "entity");
File modelsFolder = new File(output, "models/entity"); File modelsFolder = new File(output, "models/entity");
File texturesFolder = new File(output, "textures/entity"); File texturesFolder = new File(output, "textures/entity");
File animationControllersFolder = new File(output, "animation_controllers"); File animationControllersFolder = new File(output, "animation_controllers");
@@ -111,33 +110,15 @@ public class GeneratorMain {
File manifestFile = new File(output, "manifest.json"); File manifestFile = new File(output, "manifest.json");
boolean generateManifest = false;
if (!entityFolder.exists()) {
generateManifest = true;
}
File[] files = entityFolder.listFiles();
if (!manifestFile.exists() || files == null || files.length != entityMap.size()) {
generateManifest = true;
}
if (generateManifest) { output.mkdirs();
output.mkdirs(); Path path = manifestFile.toPath();
Path path = manifestFile.toPath(); if (!path.toFile().exists()) {
if (path.toFile().exists()) { try {
try { Files.writeString(path,
JsonObject manifest = new JsonParser().parse(Files.readString(path)).getAsJsonObject(); PackManifest.generate(), StandardCharsets.UTF_8);
manifest.get("header").getAsJsonObject().addProperty("uuid", UUID.randomUUID().toString()); } catch (IOException e) {
Files.writeString(path, GSON.toJson(manifest)); e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
} else {
try {
Files.writeString(path,
PackManifest.generate(), StandardCharsets.UTF_8);
} catch (IOException e) {
e.printStackTrace();
}
} }
} }