From 2f7ae5a3f2df30deccd4c44b01957af239e3c3ea Mon Sep 17 00:00:00 2001 From: Raul Tambre Date: Thu, 8 May 2014 08:16:01 +0300 Subject: [PATCH] Disable/enable page buttons in blueprint library --- .../builders/TileBlueprintLibrary.java | 2 +- .../builders/gui/GuiBlueprintLibrary.java | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/common/buildcraft/builders/TileBlueprintLibrary.java b/common/buildcraft/builders/TileBlueprintLibrary.java index 1bae7fbb..1279cf48 100644 --- a/common/buildcraft/builders/TileBlueprintLibrary.java +++ b/common/buildcraft/builders/TileBlueprintLibrary.java @@ -51,7 +51,7 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory { public EntityPlayer uploadingPlayer = null; public EntityPlayer downloadingPlayer = null; - private int pageId = 0; + public int pageId = 0; public TileBlueprintLibrary() { diff --git a/common/buildcraft/builders/gui/GuiBlueprintLibrary.java b/common/buildcraft/builders/gui/GuiBlueprintLibrary.java index 2ba7cd1f..d39d0e34 100644 --- a/common/buildcraft/builders/gui/GuiBlueprintLibrary.java +++ b/common/buildcraft/builders/gui/GuiBlueprintLibrary.java @@ -61,6 +61,7 @@ public class GuiBlueprintLibrary extends GuiBuildCraft { buttonList.add(deleteButton); checkDelete(); + checkPages(); } @Override @@ -145,14 +146,28 @@ public class GuiBlueprintLibrary extends GuiBuildCraft { } checkDelete(); + checkPages(); } protected void checkDelete() { if (library.selected != -1) { deleteButton.enabled = true; - } else { deleteButton.enabled = false; } } + + protected void checkPages() { + if (library.pageId != 0) { + prevPageButton.enabled = true; + } else { + prevPageButton.enabled = false; + } + + if (library.pageId < BuildCraftBuilders.clientDB.getPageNumber() - 1) { + nextPageButton.enabled = true; + } else { + nextPageButton.enabled = false; + } + } }