ItemStackSnapshot itemStackSnapshot = ItemStack.builder()
.quantity(1)
.itemType(ItemTypes.WRITTEN_BOOK)
.add(Keys.DISPLAY_NAME, Text.of("Book Title One"))
.add(Keys.BOOK_AUTHOR, Text.of("Author One"))
.add(Keys.BOOK_PAGES, Collections.singletonList(Text.of("Page Text One")))
.build().createSnapshot();
ItemStackSnapshot a = Sponge.getDataManager().deserialize(ItemStackSnapshot.class, itemStackSnapshot.toContainer()).orElse(null);
player.getInventory().offer(a.createStack());
I don’t get invalid book tag. But here I don’t write it to a config.
Edit: Works now for me: Deserialization of config node fails at data manipulators - #3 by RandomByte
Edit2: Man, I don’t play enough Minecraft; written books look enchanted in Vanilla too.