From e89033286c4d1e7582fb9d7994793b926fc90a77 Mon Sep 17 00:00:00 2001 From: MiniDigger | Martin Date: Sat, 7 Dec 2024 15:55:12 +0100 Subject: [PATCH] dont break nbt files --- .../paperweight/tasks/mache/SetupVanilla.kt | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/mache/SetupVanilla.kt b/paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/mache/SetupVanilla.kt index b8cd66133..5ca19a77c 100644 --- a/paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/mache/SetupVanilla.kt +++ b/paperweight-lib/src/main/kotlin/io/papermc/paperweight/tasks/mache/SetupVanilla.kt @@ -128,12 +128,17 @@ abstract class SetupVanilla : BaseTask() { .forEach { val target = outputPath.resolve(it.toString().substring(1)) target.parent.createDirectories() - // make sure we have a trailing newline - var content = it.readText() - if (!content.endsWith("\n")) { - content += "\n" + if (it.toString().endsWith(".nbt")) { + // nbt files are binary, so we can't just copy them + it.copyTo(target) + } else { + // make sure we have a trailing newline + var content = it.readText() + if (!content.endsWith("\n")) { + content += "\n" + } + target.writeText(content) } - target.writeText(content) } println("Setup git repo...")