9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-27 10:59:07 +00:00

修好了喵

This commit is contained in:
XiaoMoMi
2025-05-16 21:23:21 +08:00
parent bfc0741b08
commit a870532f7e

View File

@@ -1188,7 +1188,7 @@ public abstract class AbstractPackManager implements PackManager {
private void generateFonts(Path generatedPackPath) {
// generate image font json
for (Font font : plugin.fontManager().fonts()) {
for (Font font : this.plugin.fontManager().fonts()) {
Key namespacedKey = font.key();
Path fontPath = generatedPackPath.resolve("assets")
.resolve(namespacedKey.namespace())
@@ -1202,14 +1202,14 @@ public abstract class AbstractPackManager implements PackManager {
fontJson = JsonParser.parseString(content).getAsJsonObject();
} catch (IOException e) {
fontJson = new JsonObject();
plugin.logger().warn(fontPath + " is not a valid font json file");
this.plugin.logger().warn(fontPath + " is not a valid font json file");
}
} else {
fontJson = new JsonObject();
try {
Files.createDirectories(fontPath.getParent());
} catch (IOException e) {
throw new RuntimeException(e);
this.plugin.logger().severe("Error creating " + fontPath.toAbsolutePath(), e);
}
}
@@ -1225,10 +1225,10 @@ public abstract class AbstractPackManager implements PackManager {
providers.add(image.get());
}
try (BufferedWriter writer = Files.newBufferedWriter(fontPath)) {
GsonHelper.get().toJson(fontJson, writer);
try {
Files.writeString(fontPath, fontJson.toString().replace("\\\\u", "\\u"));
} catch (IOException e) {
this.plugin.logger().warn("Failed to save font for " + namespacedKey, e);
this.plugin.logger().severe("Error writing font to " + fontPath.toAbsolutePath(), e);
}
}