aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2023-08-05 23:12:32 +1000
committerGitHub <noreply@github.com>2023-08-05 15:12:32 +0200
commit42c0ffec59967355e94aefecf9e269a47b2a7b19 (patch)
treeb050ee63b7e843e2a4f63a4e1049d00eef83d900 /src/main/java/io
parent0ee93d0237f29f7ee296fd694c260dba58a92a67 (diff)
downloadNotEnoughUpdates-42c0ffec59967355e94aefecf9e269a47b2a7b19.tar.gz
NotEnoughUpdates-42c0ffec59967355e94aefecf9e269a47b2a7b19.tar.bz2
NotEnoughUpdates-42c0ffec59967355e94aefecf9e269a47b2a7b19.zip
Made a texture display for sets with 5 items (#792)
* fixed things with 5 in museum * fix level crash
Diffstat (limited to 'src/main/java/io')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipRngListener.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/MuseumPage.java23
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java2
3 files changed, 18 insertions, 9 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipRngListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipRngListener.java
index 2cb01f23..8602ef34 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipRngListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipRngListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 - 2023 NotEnoughUpdates contributors
+ * Copyright (C) 2022-2023 NotEnoughUpdates contributors
*
* This file is part of NotEnoughUpdates.
*
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 0b68f798..4337e2a2 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/MuseumPage.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/MuseumPage.java
@@ -28,6 +28,7 @@ import io.github.moulberry.notenoughupdates.util.Constants;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
@@ -413,7 +414,7 @@ public class MuseumPage extends GuiProfileViewerPage {
GL11.GL_NEAREST
);
break;
- case 8:
+ default:
Utils.drawTexturedRect(
guiLeft + 365,
guiTop + 100,
@@ -426,30 +427,38 @@ public class MuseumPage extends GuiProfileViewerPage {
GL11.GL_NEAREST
);
startX = guiLeft + 365 + 5;
- break;
- default:
}
int startY = guiTop + 100 + 8;
int row = 0;
int column = 0;
+ boolean is_five = false;
+ if (size == 5) {
+ size = 8;
+ is_five = true;
+ }
for (int i = 0; i < size; i++) {
- JsonObject item = (JsonObject) selectedItem.get(i);
+ ItemStack stack = new ItemStack(Blocks.barrier);
+ if (!is_five || i < 5) {
+ JsonObject item = (JsonObject) selectedItem.get(i);
+ stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(item, true);
+ }
if (row % 4 == 0 && row > 1) {
column = 1;
row = 0;
}
- int x = startX + (column * 18);
+ int x = startX + (column * 19);
int y = startY + (row * 18);
- ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(item, true);
Utils.drawItemStack(stack, x, y);
if ((mouseX >= x && mouseX <= x + 16) &&
(mouseY >= y && mouseY <= y + 16)) {
- getInstance().tooltipToDisplay = stack.getTooltip(Minecraft.getMinecraft().thePlayer, false);
+ if (!is_five || i < 5) {
+ getInstance().tooltipToDisplay = stack.getTooltip(Minecraft.getMinecraft().thePlayer, false);
+ }
}
row++;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java
index 105c7056..77d6589c 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java
@@ -46,7 +46,7 @@ public class EssenceTaskLevel extends GuiTaskLevel {
JsonObject categoryXp = levelPage.getConstant().get("category_xp").getAsJsonObject();
JsonObject essenceShopTask = levelPage.getConstant().get("essence_shop_task").getAsJsonObject();
JsonArray essenceSteps = essenceShopTask.get("essence_shop_xp").getAsJsonArray();
- JsonObject essencePerks = object.get("perks").getAsJsonObject();
+ JsonObject essencePerks = object.has("perks") ? object.get("perks").getAsJsonObject() : new JsonObject();
Map<String, EssenceShop> loreMap = new HashMap<>();
for (Map.Entry<String, JsonElement> stringJsonElementEntry : Constants.ESSENCESHOPS.entrySet()) {