Made booklet save its bookmarks.

Were a bit useless without this...
This commit is contained in:
Ellpeck 2016-06-19 19:28:48 +02:00
parent 9b575c5725
commit 9c16eef80e
3 changed files with 9 additions and 7 deletions

View file

@ -294,7 +294,7 @@ public final class BookletUtils{
}
}
booklet.changedPageSinceOpen = true;
booklet.shouldSaveDataNextClose = true;
}
/**
@ -351,7 +351,7 @@ public final class BookletUtils{
chapterButton.visible = false;
}
booklet.changedPageSinceOpen = true;
booklet.shouldSaveDataNextClose = true;
}
/**
@ -417,7 +417,7 @@ public final class BookletUtils{
}
}
booklet.changedPageSinceOpen = true;
booklet.shouldSaveDataNextClose = true;
}
/**
@ -443,7 +443,7 @@ public final class BookletUtils{
}
}
booklet.changedPageSinceOpen = true;
booklet.shouldSaveDataNextClose = true;
}
public static BookletPage getFirstPageForStack(ItemStack stack){

View file

@ -88,7 +88,7 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
public GuiButton buttonPatreon;
public GuiButton buttonViewOnline;
public GuiTextField searchField;
public boolean changedPageSinceOpen;
public boolean shouldSaveDataNextClose;
private int ticksElapsed;
private boolean mousePressed;
private int hisNameIsAt;
@ -404,7 +404,7 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
ItemBooklet.forcedEntry = null;
}
this.changedPageSinceOpen = false;
this.shouldSaveDataNextClose = false;
}
@Override
@ -445,7 +445,7 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
@Override
public void onGuiClosed(){
if(this.saveOnClose && this.changedPageSinceOpen){
if(this.saveOnClose && this.shouldSaveDataNextClose){
NBTTagCompound bookletData = new NBTTagCompound();
BookletUtils.saveBookPage(this, bookletData);

View file

@ -41,6 +41,7 @@ public class BookmarkButton extends GuiButton{
if(this.assignedEntry.entry != null){
if(GuiScreen.isShiftKeyDown()){
this.assignedEntry.removeEntry();
this.booklet.shouldSaveDataNextClose = true;
}
else{
BookletUtils.openIndexEntry(this.booklet, this.assignedEntry.entry, this.assignedEntry.pageInIndex, true);
@ -50,6 +51,7 @@ public class BookmarkButton extends GuiButton{
else{
if(this.booklet.currentEntrySet.getCurrentEntry() != null){
this.assignedEntry.setEntry(this.booklet.currentEntrySet.getCurrentPage(), this.booklet.currentEntrySet.getCurrentChapter(), this.booklet.currentEntrySet.getCurrentEntry(), this.booklet.currentEntrySet.getPageInIndex());
this.booklet.shouldSaveDataNextClose = true;
}
}
}