From fe037aa766a9cc8e4fcd42fa66099c7b8ec0aea2 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 25 Dec 2022 15:38:10 +0100 Subject: [PATCH] Fix save book --- .../advancedscripts/screen/ScriptEditScreen.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/zonlykroks/advancedscripts/screen/ScriptEditScreen.java b/src/main/java/de/zonlykroks/advancedscripts/screen/ScriptEditScreen.java index 82b734b..628d982 100644 --- a/src/main/java/de/zonlykroks/advancedscripts/screen/ScriptEditScreen.java +++ b/src/main/java/de/zonlykroks/advancedscripts/screen/ScriptEditScreen.java @@ -52,7 +52,14 @@ public class ScriptEditScreen extends Screen { NbtCompound nbtCompound = itemStack.getNbt(); if (nbtCompound != null) { BookScreen.filterPages(nbtCompound, s -> { - lines.addAll(Arrays.asList(s.split("\n"))); + String[] split = s.split("\n"); + for (String s1 : split) { + if (s1.equals(" ")) { + lines.add(""); + } else { + lines.add(s1); + } + } }); } if (lines.isEmpty()) { @@ -385,7 +392,7 @@ public class ScriptEditScreen extends Screen { page = new StringBuilder(); } if (line.isEmpty()) { - page.append("\n"); + page.append(" "); } else { page.append(line); }