Add safety checks to the book UI when the player is lost (death/dimension change should can cause that)

This commit is contained in:
Bernhard Bonigl committed 2016-06-17 20:10:12 +02:00
1 parent 273cca6465
commit 4b42e30be6
2 files changed
+6

No files matched your search

@@ -155,6 +155,9 @@ public class BookLoader implements IResourceManagerReloadListener {
}
public static void updateSavedPage(EntityPlayer player, ItemStack item, String page) {
if(player == null) {
return;
}
if(player.getHeldItem(EnumHand.MAIN_HAND) == null) {
return;
}
@@ -570,6 +570,9 @@ public class GuiBook extends GuiScreen implements IProgressMeter {
if(loadingAchievements) {
return;
}
if(mc.thePlayer == null) {
return;
}
PageData page = this.page == 0 ? book.findPage(0, statisticsManager) : book.findPage((this.page - 1) * 2 + 1, statisticsManager);