diff --git a/src/client/java/minicraft/util/BookData.java b/src/client/java/minicraft/util/BookData.java index e99c568a8..19352278f 100644 --- a/src/client/java/minicraft/util/BookData.java +++ b/src/client/java/minicraft/util/BookData.java @@ -2,6 +2,8 @@ import minicraft.item.BookItem; +import java.util.HashMap; + public class BookData { public static BookItem.BookContent about; @@ -10,12 +12,44 @@ public class BookData { public static BookItem.BookContent antVenomBook; public static BookItem.BookContent storylineGuide; + private static final HashMap loreBooks = new HashMap<>(); + + public static final LoreBookKey lore1 = new LoreBookKey("lore1"); + public static final LoreBookKey lore2 = new LoreBookKey("lore2"); + + public static class LoreBook { + public final String title; // First line is the title. + public final BookItem.BookContent content; // The text left is the content. + + public LoreBook(String title, String content) { + this.title = title; + this.content = () -> content; + } + } + + public static class LoreBookKey { + private final String key; + + private LoreBookKey(String key) { + this.key = key; + } + + public final LoreBook getBook() { + return loreBooks.get(key); + } + + public final void loadBook(LoreBook book) { + loreBooks.put(key, book); + } + } + public static void resetBooks() { about = null; credits = null; instructions = null; antVenomBook = null; storylineGuide = null; + loreBooks.clear(); } public static String loadBook(String content) { diff --git a/src/client/resources/assets/books/lore1.txt b/src/client/resources/assets/books/lore1.txt new file mode 100644 index 000000000..8406de3b4 --- /dev/null +++ b/src/client/resources/assets/books/lore1.txt @@ -0,0 +1,5 @@ +Page 1 +Once upon a time, in a space far far away...a being not yet known banished a wizard learning to fly and a odd shamed knight... + +Throughout countless eons, the wizard found distaste of those who were friendly. Flocks of sheep, cows, and pigs, villages of happy people. +Their anger from long ago, the reason they were banished. They sought the other whom followed the same sentence, only to discover more hatred... diff --git a/src/client/resources/assets/books/lore2.txt b/src/client/resources/assets/books/lore2.txt new file mode 100644 index 000000000..6f960c69f --- /dev/null +++ b/src/client/resources/assets/books/lore2.txt @@ -0,0 +1,8 @@ +Page 2 +The shamed Knight who was shunned for the use of magic. Unfit to the ways of a knight, yet they sought flames. +They learnt the way of fire but at the cost of destruction of their home, armor, and burns. Banished from their home to fend in another world. + +They found peace in the depth of their prison, where their lifetime discovery was made. They built armor, built a mighty fortress from a hard rock of lava and water. +They mastered the magical arts of flame without burns thanks to their armor. They raised knights and lived in harmory. + +All was well in the depths of the world...until a wizard's hatred for those with "friends" laid ruin...