|
|
|
|
@ -73,7 +73,7 @@ public class ScriptEditScreen extends Screen {
|
|
|
|
|
this.itemStack = itemStack;
|
|
|
|
|
this.hand = hand;
|
|
|
|
|
|
|
|
|
|
List<RawFilteredPair<String>> pages = itemStack.get(DataComponentTypes.WRITABLE_BOOK_CONTENT).pages();
|
|
|
|
|
List<RawFilteredPair<String>> pages = itemStack.getComponents().get(DataComponentTypes.WRITABLE_BOOK_CONTENT).pages();
|
|
|
|
|
pages.forEach(stringRawFilteredPair -> {
|
|
|
|
|
for (String s : stringRawFilteredPair.raw().split("\n")) {
|
|
|
|
|
if (s.isEmpty()) {
|
|
|
|
|
@ -103,7 +103,7 @@ public class ScriptEditScreen extends Screen {
|
|
|
|
|
this.addDrawableChild(
|
|
|
|
|
new Button(BOOK, this.width - 98 - 5, height - 20 - 5, () -> {
|
|
|
|
|
finalizeBook();
|
|
|
|
|
this.client.setScreen(new BookEditScreen(player, itemStack, hand, toContent(toPages())));
|
|
|
|
|
this.client.setScreen(new BookEditScreen(player, itemStack, hand));
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
@ -157,7 +157,7 @@ public class ScriptEditScreen extends Screen {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void applyBlur() {
|
|
|
|
|
protected void applyBlur(float delta) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ -634,7 +634,7 @@ public class ScriptEditScreen extends Screen {
|
|
|
|
|
private void finalizeBook() {
|
|
|
|
|
List<String> pages = toPages();
|
|
|
|
|
this.writeNbtData(pages);
|
|
|
|
|
int i = this.hand == Hand.MAIN_HAND ? this.player.getInventory().getSelectedSlot() : 40;
|
|
|
|
|
int i = this.hand == Hand.MAIN_HAND ? this.player.getInventory().selectedSlot : 40;
|
|
|
|
|
this.client.getNetworkHandler().sendPacket(new BookUpdateC2SPacket(i, pages, Optional.empty()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|