Skip to content

Commit

Permalink
Fix index links sending you to the wrong page when advancements lock …
Browse files Browse the repository at this point in the history
…sections

Also updates a couple of places assuming index is always unlocked/the first section. Probably a good assumption, but might as well be safe
See SlimeKnights/TinkersConstruct#4856
  • Loading branch information
KnightMiner committed May 14, 2022
1 parent 2c84f6b commit ec8179c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public ProtocolGoToPage(boolean returner) {

@Override
public void processCommand(BookScreen book, String param) {
int pageNum = book.book.findPageNumber(param);
int pageNum = book.book.findPageNumber(param, book.advancementCache);

if (pageNum >= 0) {
book.openPage(pageNum, this.returner);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ protected void init() {
}));

this.indexArrow = this.addRenderableWidget(new ArrowButton(book, this.width / 2 - PAGE_WIDTH_UNSCALED - ArrowButton.WIDTH / 2, this.height / 2 - PAGE_HEIGHT_UNSCALED / 2, ArrowButton.ArrowType.BACK_UP, this.book.appearance.arrowColor, this.book.appearance.arrowColorHover, (p_212998_1_) -> {
this.openPage(this.book.findPageNumber("index.page1"));
this.openPage(this.book.findPageNumber("index.page1", this.advancementCache));

this.oldPage = -2;
this.buildPages();
Expand Down Expand Up @@ -341,7 +341,7 @@ public void tick() {
this.previousArrow.x = this.width / 2 - 184;
this.nextArrow.x = this.width / 2 + 165;

SectionData index = this.book.findSection("index");
SectionData index = this.book.findSection("index", this.advancementCache);
this.indexArrow.visible = index != null && (this.page - 1) * 2 + 2 > index.getPageCount();
}

Expand Down

0 comments on commit ec8179c

Please sign in to comment.