aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2023-10-07 22:39:07 +1100
committerGitHub <noreply@github.com>2023-10-07 13:39:07 +0200
commit0d8b64b8c3d2c111a282774d584208015900ed44 (patch)
tree83dfa08c06a795c473ecac4b072a20e9ec23e215 /src/main/java
parente540823d2869323f2b86c3e478f45eeeb6d7d6ab (diff)
downloadNotEnoughUpdates-0d8b64b8c3d2c111a282774d584208015900ed44.tar.gz
NotEnoughUpdates-0d8b64b8c3d2c111a282774d584208015900ed44.tar.bz2
NotEnoughUpdates-0d8b64b8c3d2c111a282774d584208015900ed44.zip
Fix museum special pages (#869)
i can actually count
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/MuseumPage.java21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/MuseumPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/MuseumPage.java
index 4337e2a2..69f9e85a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/MuseumPage.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/MuseumPage.java
@@ -71,7 +71,7 @@ public class MuseumPage extends GuiProfileViewerPage {
JsonObject museum = Constants.MUSEUM;
int pageArrowsHeight = 164;
int pages = 0;
- int onPage = 0;
+ int onPage = 1;
String currentItemSelected = null;
JsonArray selectedItem = null;
@@ -229,7 +229,7 @@ public class MuseumPage extends GuiProfileViewerPage {
}
Minecraft.getMinecraft().getTextureManager().bindTexture(GuiProfileViewer.resource_packs);
- if (onPage > 0) {
+ if (onPage > 1) {
Utils.drawTexturedRect(
guiLeft + 251 - 12,
guiTop + pageArrowsHeight,
@@ -242,7 +242,7 @@ public class MuseumPage extends GuiProfileViewerPage {
GL11.GL_NEAREST
);
}
- if (onPage < pages && pages > 1) {
+ if (onPage < pages && pages != 1) {
Utils.drawTexturedRect(
guiLeft + 251,
guiTop + pageArrowsHeight,
@@ -283,11 +283,12 @@ public class MuseumPage extends GuiProfileViewerPage {
categoryDonated = museumData.getRaritiesItems();
break;
case "special":
- pages = (int) Math.floor(donated / 28.0);
+ pages = (int) Math.ceil(donated / 28.0);
+ if (pages == 0) pages = 1;
List<JsonArray> specialItems = museumData.getSpecialItems();
- int startIndex = onPage * 28;
+ int startIndex = (onPage - 1) * 28;
int endIndex = Math.min(startIndex + 28, specialItems.size());
int row = 0;
@@ -324,7 +325,7 @@ public class MuseumPage extends GuiProfileViewerPage {
if (categoryItems != null) {
int row = 0;
int slot = 0;
- int startIndex = onPage * 28;
+ int startIndex = (onPage - 1) * 28;
int endIndex = Math.min(startIndex + 28, categoryItems.size());
for (int i = startIndex; i < endIndex; i++) {
boolean actualItem = false;
@@ -494,7 +495,7 @@ public class MuseumPage extends GuiProfileViewerPage {
if (mouseY > guiTop + pageArrowsHeight && mouseY < guiTop + pageArrowsHeight + 16) {
if (mouseX > guiLeft + 251 - 12 && mouseX < guiLeft + 251 + 12) {
if (mouseX < guiLeft + 251) {
- if (onPage > 0) onPage--;
+ if (onPage > 1) onPage--;
} else {
if (onPage < pages) onPage++;
}
@@ -529,8 +530,8 @@ public class MuseumPage extends GuiProfileViewerPage {
private void setPage(String pageName) {
selectedMuseumCategory = pageName;
- onPage = 0;
- pages = (int) Math.floor(getMaximum(pageName) / 28.0);
+ onPage = 1;
+ pages = (int) Math.ceil(getMaximum(pageName) / 28.0);
}
private int getMaximum(String name) {
@@ -540,6 +541,6 @@ public class MuseumPage extends GuiProfileViewerPage {
return maxValues.get(name).getAsInt();
}
}
- return 0;
+ return 1;
}
}