mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +01:00
Made forward and backward button visibility calculation less stupid
This commit is contained in:
parent
26aab74cb1
commit
99878a1eef
1 changed files with 6 additions and 9 deletions
|
@ -375,6 +375,9 @@ public class GuiBooklet extends GuiScreen{
|
|||
if(this.currentPage != null){
|
||||
BookletPage page = this.getNextPage(this.currentChapter, this.currentPage);
|
||||
if(page != null) this.currentPage = page;
|
||||
|
||||
this.getButton(BUTTON_FORWARD_ID).visible = this.getNextPage(this.currentChapter, this.currentPage) != null;
|
||||
this.getButton(BUTTON_BACK_ID).visible = this.getPrevPage(this.currentChapter, this.currentPage) != null;
|
||||
}
|
||||
else{
|
||||
this.openIndexEntry(this.currentIndexEntry, this.pageOpenInIndex+1, !(this.currentIndexEntry instanceof BookletEntryAllSearch));
|
||||
|
@ -386,6 +389,9 @@ public class GuiBooklet extends GuiScreen{
|
|||
if(this.currentPage != null){
|
||||
BookletPage page = this.getPrevPage(this.currentChapter, this.currentPage);
|
||||
if(page != null) this.currentPage = page;
|
||||
|
||||
this.getButton(BUTTON_FORWARD_ID).visible = this.getNextPage(this.currentChapter, this.currentPage) != null;
|
||||
this.getButton(BUTTON_BACK_ID).visible = this.getPrevPage(this.currentChapter, this.currentPage) != null;
|
||||
}
|
||||
else{
|
||||
this.openIndexEntry(this.currentIndexEntry, this.pageOpenInIndex-1, !(this.currentIndexEntry instanceof BookletEntryAllSearch));
|
||||
|
@ -416,15 +422,6 @@ public class GuiBooklet extends GuiScreen{
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(button.id == BUTTON_FORWARD_ID || button.id == BUTTON_BACK_ID){
|
||||
if(this.currentChapter != null && this.currentIndexEntry != null){
|
||||
if(this.currentPage != null){
|
||||
this.getButton(BUTTON_FORWARD_ID).visible = this.getNextPage(this.currentChapter, this.currentPage) != null;
|
||||
this.getButton(BUTTON_BACK_ID).visible = this.getPrevPage(this.currentChapter, this.currentPage) != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
Loading…
Reference in a new issue