Skip to content

Commit

Permalink
fix: entry description display, and make them non-required in datagen
Browse files Browse the repository at this point in the history
Closes #268
  • Loading branch information
klikli-dev committed Nov 19, 2024
1 parent 55b80c1 commit 0990a0e
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ protected BookEntryModel additionalSetup(BookEntryModel entry) {
/**
* Implement this and return the entry description in the main language.
*/
protected abstract String entryDescription();
protected String entryDescription() {
return "";
}

/**
* Implement this and return the U/V coordinates of the entry background. See also @link{BookEntryModel#withEntryBackground(int, int)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.klikli_dev.modonomicon.util.GuiGraphicsExt;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.components.Tooltip;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.network.chat.Component;
import org.lwjgl.glfw.GLFW;
Expand Down Expand Up @@ -243,6 +244,8 @@ public void render(GuiGraphics guiGraphics, int pMouseX, int pMouseY, float pPar
BookContentRenderer.drawTitleSeparator(guiGraphics, this.parentScreen.getBook(),
BookEntryScreen.RIGHT_PAGE_X + BookEntryScreen.PAGE_WIDTH / 2, BookEntryScreen.TOP_PADDING + 12);



BookPageRenderer.renderBookTextHolder(guiGraphics, this.category.getDescription(), this.font,
BookEntryScreen.LEFT_PAGE_X, BookEntryScreen.TOP_PADDING + 22, BookEntryScreen.PAGE_WIDTH, BookEntryScreen.PAGE_HEIGHT - (BookEntryScreen.TOP_PADDING + 22));
}
Expand Down Expand Up @@ -330,7 +333,9 @@ public void init() {

void addEntryButtons(int x, int y, int start, int count) {
for (int i = 0; i < count && (i + start) < this.visibleEntries.size(); i++) {
Button button = new EntryListButton(this.visibleEntries.get(start + i), this.bookLeft + x, this.bookTop + y + i * 11, this::handleEntryListButton);
var entry = this.visibleEntries.get(start + i);
var button = new EntryListButton(entry, this.bookLeft + x, this.bookTop + y + i * 11, this::handleEntryListButton);
button.setTooltip(Tooltip.create(Component.translatable(entry.getDescription())));
this.addRenderableWidget(button);
this.entryButtons.add(button);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ protected String entryName() {
return "Demo Entry 1";
}

@Override
protected String entryDescription() {
return "Just Demo Stuff (tm)";
}

@Override
protected Pair<Integer, Integer> entryBackground() {
return EntryBackground.DEFAULT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected String entryName() {

@Override
protected String entryDescription() {
return "Just Demo Stuff (tm)";
return "Just Demo Stuff (tm). But with a very long entry description to see if tooltip rendering properly works!";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// 1.21.3 2024-11-12T09:29:38.2683252 Modonomicon/Books: modonomicon
// 1.21.3 2024-11-19T18:23:08.2751533 Modonomicon/Books: modonomicon
59bf0a22c269e4a45fdee22c7d61577b2b9801a9 data\modonomicon\modonomicon\books\demo\entries\index_mode\demo1.json
2f34d264ede292fb4d8eb0c4b41c1fcd383be779 data\modonomicon\modonomicon\books\demo\categories\index_mode.json
357539b3d8a74d7bfced6fc27c1280d9b05acf3b data\modonomicon\modonomicon\books\demo\entries\features\recipe.json
ee56ca8dcb97da78c75ef5c31b561e1e9e7c9e65 data\modonomicon\modonomicon\books\demo\entries\features\empty.json
357539b3d8a74d7bfced6fc27c1280d9b05acf3b data\modonomicon\modonomicon\books\demo\entries\features\recipe.json
56c22a396d523514af2db5eacdf5b70bdcd9fb3b data\modonomicon\modonomicon\books\demo_leaflet\categories\leaflet.json
e53f812ed9a5dd1d87a89d165d960a57f1a248a6 data\modonomicon\modonomicon\books\demo\entries\features\component_icon.json
e09ee0050e4ec5580c3dd7f5521e8e248adafc89 data\modonomicon\modonomicon\books\demo\entries\features\condition_advancement.json
e53f812ed9a5dd1d87a89d165d960a57f1a248a6 data\modonomicon\modonomicon\books\demo\entries\features\component_icon.json
2a948b807be3b8c919e3a1391ae4ffbba7123364 data\modonomicon\modonomicon\books\demo\entries\features\entity.json
99a977c14e496a823810fd889776aa6f8629fc4a data\modonomicon\modonomicon\books\demo\entries\features\redirect.json
96d153396b2b721a78a84ed230c7c919af008b5b data\modonomicon\modonomicon\books\demo\entries\features\two_parents.json
e1bce89a59412b222437ca8fd2ca90a31c85358b data\modonomicon\modonomicon\books\demo\entries\features\spotlight.json
2398b4b1facff1487ab8122044605301c5396cd9 data\modonomicon\modonomicon\books\demo\entries\conditional\always_locked.json
e1bce89a59412b222437ca8fd2ca90a31c85358b data\modonomicon\modonomicon\books\demo\entries\features\spotlight.json
631f8d62bf05e90eba6f7ce2e441e069099b7198 data\modonomicon\modonomicon\books\demo_leaflet\book.json
ea82c1ec5ac99b6c53186c37a2964666b6824399 data\modonomicon\modonomicon\books\demo\book.json
eff793d776fcd5711c6efdb0eb30124a8f633448 data\modonomicon\modonomicon\books\demo_leaflet\entries\leaflet\leaflet.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.21.3 2024-11-12T09:29:38.2713248 Modonomicon/Languages: en_us
1aef02be3cff1a218e12e0114f8fe3ddc2ebef13 assets\modonomicon\lang\en_us.json
// 1.21.3 2024-11-19T18:23:08.2781483 Modonomicon/Languages: en_us
f6969dd5c828c607bed40347d1bd679d225635ce assets\modonomicon\lang\en_us.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// 1.21.3 2024-11-12T09:29:38.2713248 Modonomicon/Tags for minecraft:item
// 1.21.3 2024-11-19T18:23:08.2781483 Modonomicon/Tags for minecraft:item
44de4772d365fcc0e5706dbfcd83d2967ec352c0 data\minecraft\tags\item\lectern_books.json
44de4772d365fcc0e5706dbfcd83d2967ec352c0 data\minecraft\tags\item\bookshelf_books.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.21.3 2024-11-12T09:29:38.2703263 Modonomicon/Model Definitions
// 1.21.3 2024-11-19T18:23:08.2771499 Modonomicon/Model Definitions
b02e0bc9f75e0fde6807935577e74b75348413fb assets\modonomicon\models\item\modonomicon_blue.json
a4a605637998b2d6d6b7cd9c002d5ba0163622c0 assets\modonomicon\models\item\modonomicon_red.json
4b35646623b74487675fa8ec1bb375535100c336 assets\modonomicon\models\item\modonomicon_purple.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.21.3 2024-11-12T09:29:38.2703263 Modonomicon/Multiblocks: modonomicon
// 1.21.3 2024-11-19T18:23:08.2771499 Modonomicon/Multiblocks: modonomicon
9dc306d79a39ee2085be7e1384d8e39640d79e49 data\modonomicon\modonomicon\multiblocks\demo_dense.json
6af533f5fa171fb2cf2d27b166e16ec54b2c5c06 data\modonomicon\modonomicon\multiblocks\test_non_square.json
d359278a8bc55267387b95977def04965a54dd17 data\modonomicon\modonomicon\multiblocks\demo_block_entity.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@
"book.modonomicon.demo.formatting.link.page2.text": "[View a Multiblock](entry://features/multiblock) \\\n[View a Condition](entry://features/condition_level_1) \\\n[View basic formatting](entry://formatting/basic) \\\n[Link without book id](entry://formatting/basic) \\\n[Always locked](entry://formatting/always_locked) \\\n[View Features Category](category://features)\n",
"book.modonomicon.demo.formatting.link.page2.title": "Book Links",
"book.modonomicon.demo.formatting.name": "Formatting Category",
"book.modonomicon.demo.index_mode.demo1.description": "Just Demo Stuff (tm)",
"book.modonomicon.demo.index_mode.demo1.description": "",
"book.modonomicon.demo.index_mode.demo1.intro.text": "Demo\n",
"book.modonomicon.demo.index_mode.demo1.intro.title": "Demo",
"book.modonomicon.demo.index_mode.demo1.name": "Demo Entry 1",
"book.modonomicon.demo.index_mode.demo2.description": "Just Demo Stuff (tm)",
"book.modonomicon.demo.index_mode.demo2.description": "Just Demo Stuff (tm). But with a very long entry description to see if tooltip rendering properly works!",
"book.modonomicon.demo.index_mode.demo2.intro.text": "Demo\n",
"book.modonomicon.demo.index_mode.demo2.intro.title": "Demo",
"book.modonomicon.demo.index_mode.demo2.name": "Demo Entry 2",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.21.3 2024-11-10T10:58:56.116437 Languages: en_us
1aef02be3cff1a218e12e0114f8fe3ddc2ebef13 assets/modonomicon/lang/en_us.json
// 1.21.3 2024-11-19T18:18:32.4008815 Languages: en_us
f6969dd5c828c607bed40347d1bd679d225635ce assets/modonomicon/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@
"book.modonomicon.demo.formatting.link.page2.text": "[View a Multiblock](entry://features/multiblock) \\\n[View a Condition](entry://features/condition_level_1) \\\n[View basic formatting](entry://formatting/basic) \\\n[Link without book id](entry://formatting/basic) \\\n[Always locked](entry://formatting/always_locked) \\\n[View Features Category](category://features)\n",
"book.modonomicon.demo.formatting.link.page2.title": "Book Links",
"book.modonomicon.demo.formatting.name": "Formatting Category",
"book.modonomicon.demo.index_mode.demo1.description": "Just Demo Stuff (tm)",
"book.modonomicon.demo.index_mode.demo1.description": "",
"book.modonomicon.demo.index_mode.demo1.intro.text": "Demo\n",
"book.modonomicon.demo.index_mode.demo1.intro.title": "Demo",
"book.modonomicon.demo.index_mode.demo1.name": "Demo Entry 1",
"book.modonomicon.demo.index_mode.demo2.description": "Just Demo Stuff (tm)",
"book.modonomicon.demo.index_mode.demo2.description": "Just Demo Stuff (tm). But with a very long entry description to see if tooltip rendering properly works!",
"book.modonomicon.demo.index_mode.demo2.intro.text": "Demo\n",
"book.modonomicon.demo.index_mode.demo2.intro.title": "Demo",
"book.modonomicon.demo.index_mode.demo2.name": "Demo Entry 2",
Expand Down

0 comments on commit 0990a0e

Please sign in to comment.