aboutsummaryrefslogtreecommitdiff
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
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
-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
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt5
4 files changed, 20 insertions, 12 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()) {
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt
index 8ad765eb..3c45d1e1 100644
--- a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt
@@ -19,9 +19,7 @@
package io.github.moulberry.notenoughupdates.commands.dev
-import com.google.gson.JsonObject
import com.mojang.brigadier.arguments.StringArgumentType
-import com.mojang.brigadier.arguments.StringArgumentType.string
import io.github.moulberry.notenoughupdates.BuildFlags
import io.github.moulberry.notenoughupdates.NotEnoughUpdates
import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe
@@ -66,7 +64,8 @@ class DevTestCommand {
"0ce87d5a-fa5f-4619-ae78-872d9c5e07fe", // ascynx
"a049a538-4dd8-43f8-87d5-03f09d48b4dc", // egirlefe
"7a9dc802-d401-4d7d-93c0-8dd1bc98c70d", // efefury
- "bb855349-dfd8-4125-a750-5fc2cf543ad5" // hannibal2
+ "bb855349-dfd8-4125-a750-5fc2cf543ad5", // hannibal2
+ "eaa5623c-8413-46b7-a74b-2d74a42b2841" // calmwolfs
)
val SPECIAL_KICK = "SPECIAL_KICK"