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; 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){ public static BookletPage getFirstPageForStack(ItemStack stack){

View file

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

View file

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