mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 00:38:35 +01:00
Made Booklet opening more configurable
This commit is contained in:
parent
88d6c18708
commit
e46c4f217a
3 changed files with 11 additions and 6 deletions
|
@ -72,11 +72,15 @@ public class GuiBooklet extends GuiScreen{
|
|||
private boolean mousePressed;
|
||||
|
||||
public GuiScreen parentScreen;
|
||||
private boolean tryOpenMainPage;
|
||||
private boolean saveOnClose;
|
||||
|
||||
public GuiBooklet(GuiScreen parentScreen){
|
||||
public GuiBooklet(GuiScreen parentScreen, boolean tryOpenMainPage, boolean saveOnClose){
|
||||
this.xSize = 146;
|
||||
this.ySize = 180;
|
||||
this.parentScreen = parentScreen;
|
||||
this.tryOpenMainPage = tryOpenMainPage;
|
||||
this.saveOnClose = saveOnClose;
|
||||
}
|
||||
|
||||
public void drawHoveringText(List list, int x, int y){
|
||||
|
@ -266,8 +270,7 @@ public class GuiBooklet extends GuiScreen{
|
|||
this.currentChapter = null;
|
||||
this.currentIndexEntry = null;
|
||||
|
||||
// So that the First Page will still open if used via something like NEI before
|
||||
if(this.parentScreen == null && !PersistentClientData.getBoolean("BookAlreadyOpened")){
|
||||
if(this.tryOpenMainPage && !PersistentClientData.getBoolean("BookAlreadyOpened")){
|
||||
BookletUtils.openIndexEntry(this, InitBooklet.chapterIntro.entry, 1, true);
|
||||
BookletUtils.openChapter(this, InitBooklet.chapterIntro, null);
|
||||
|
||||
|
@ -301,8 +304,10 @@ public class GuiBooklet extends GuiScreen{
|
|||
|
||||
@Override
|
||||
public void onGuiClosed(){
|
||||
if(this.saveOnClose){
|
||||
PersistentClientData.saveBookPage(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesGuiPauseGame(){
|
||||
|
|
|
@ -143,7 +143,7 @@ public class GuiHandler implements IGuiHandler{
|
|||
case CLOUD:
|
||||
return new GuiSmileyCloud(tile, x, y, z, world);
|
||||
case BOOK:
|
||||
return new GuiBooklet(null);
|
||||
return new GuiBooklet(null, true, true);
|
||||
case DIRECTIONAL_BREAKER:
|
||||
return new GuiDirectionalBreaker(entityPlayer.inventory, tile);
|
||||
case RANGED_COLLECTOR:
|
||||
|
|
|
@ -68,7 +68,7 @@ public class NeiScreenEvents{
|
|||
if(isPage && event.button.id == NEI_BUTTON_ID){
|
||||
for(BookletPage page : InitBooklet.pagesWithItemStackData){
|
||||
if(ItemUtil.contains(page.getItemStacksForPage(), ((INeiRecipeHandler)handler).getStackForInfo(theGui.page), true)){
|
||||
GuiBooklet book = new GuiBooklet(Minecraft.getMinecraft().currentScreen);
|
||||
GuiBooklet book = new GuiBooklet(Minecraft.getMinecraft().currentScreen, false, true);
|
||||
Minecraft.getMinecraft().displayGuiScreen(book);
|
||||
BookletUtils.openIndexEntry(book, page.getChapter().entry, InitBooklet.entries.indexOf(page.getChapter().entry)/GuiBooklet.CHAPTER_BUTTONS_AMOUNT+1, true);
|
||||
BookletUtils.openChapter(book, page.getChapter(), page);
|
||||
|
|
Loading…
Reference in a new issue