mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +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;
|
private boolean mousePressed;
|
||||||
|
|
||||||
public GuiScreen parentScreen;
|
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.xSize = 146;
|
||||||
this.ySize = 180;
|
this.ySize = 180;
|
||||||
this.parentScreen = parentScreen;
|
this.parentScreen = parentScreen;
|
||||||
|
this.tryOpenMainPage = tryOpenMainPage;
|
||||||
|
this.saveOnClose = saveOnClose;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawHoveringText(List list, int x, int y){
|
public void drawHoveringText(List list, int x, int y){
|
||||||
|
@ -266,8 +270,7 @@ public class GuiBooklet extends GuiScreen{
|
||||||
this.currentChapter = null;
|
this.currentChapter = null;
|
||||||
this.currentIndexEntry = null;
|
this.currentIndexEntry = null;
|
||||||
|
|
||||||
// So that the First Page will still open if used via something like NEI before
|
if(this.tryOpenMainPage && !PersistentClientData.getBoolean("BookAlreadyOpened")){
|
||||||
if(this.parentScreen == null && !PersistentClientData.getBoolean("BookAlreadyOpened")){
|
|
||||||
BookletUtils.openIndexEntry(this, InitBooklet.chapterIntro.entry, 1, true);
|
BookletUtils.openIndexEntry(this, InitBooklet.chapterIntro.entry, 1, true);
|
||||||
BookletUtils.openChapter(this, InitBooklet.chapterIntro, null);
|
BookletUtils.openChapter(this, InitBooklet.chapterIntro, null);
|
||||||
|
|
||||||
|
@ -301,7 +304,9 @@ public class GuiBooklet extends GuiScreen{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onGuiClosed(){
|
public void onGuiClosed(){
|
||||||
PersistentClientData.saveBookPage(this);
|
if(this.saveOnClose){
|
||||||
|
PersistentClientData.saveBookPage(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -143,7 +143,7 @@ public class GuiHandler implements IGuiHandler{
|
||||||
case CLOUD:
|
case CLOUD:
|
||||||
return new GuiSmileyCloud(tile, x, y, z, world);
|
return new GuiSmileyCloud(tile, x, y, z, world);
|
||||||
case BOOK:
|
case BOOK:
|
||||||
return new GuiBooklet(null);
|
return new GuiBooklet(null, true, true);
|
||||||
case DIRECTIONAL_BREAKER:
|
case DIRECTIONAL_BREAKER:
|
||||||
return new GuiDirectionalBreaker(entityPlayer.inventory, tile);
|
return new GuiDirectionalBreaker(entityPlayer.inventory, tile);
|
||||||
case RANGED_COLLECTOR:
|
case RANGED_COLLECTOR:
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class NeiScreenEvents{
|
||||||
if(isPage && event.button.id == NEI_BUTTON_ID){
|
if(isPage && event.button.id == NEI_BUTTON_ID){
|
||||||
for(BookletPage page : InitBooklet.pagesWithItemStackData){
|
for(BookletPage page : InitBooklet.pagesWithItemStackData){
|
||||||
if(ItemUtil.contains(page.getItemStacksForPage(), ((INeiRecipeHandler)handler).getStackForInfo(theGui.page), true)){
|
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);
|
Minecraft.getMinecraft().displayGuiScreen(book);
|
||||||
BookletUtils.openIndexEntry(book, page.getChapter().entry, InitBooklet.entries.indexOf(page.getChapter().entry)/GuiBooklet.CHAPTER_BUTTONS_AMOUNT+1, true);
|
BookletUtils.openIndexEntry(book, page.getChapter().entry, InitBooklet.entries.indexOf(page.getChapter().entry)/GuiBooklet.CHAPTER_BUTTONS_AMOUNT+1, true);
|
||||||
BookletUtils.openChapter(book, page.getChapter(), page);
|
BookletUtils.openChapter(book, page.getChapter(), page);
|
||||||
|
|
Loading…
Reference in a new issue