aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java
diff options
context:
space:
mode:
authorNopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com>2022-09-16 02:28:13 +1000
committerGitHub <noreply@github.com>2022-09-15 18:28:13 +0200
commitd4350c2943dab39326ed268e859731649ba53f1b (patch)
tree6c8fc87225f9b4c503ddaaf85765d8d054e33ea6 /src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java
parentf270bf2074d3c10e6bfabc17b22df203aff12c2c (diff)
downloadnotenoughupdates-d4350c2943dab39326ed268e859731649ba53f1b.tar.gz
notenoughupdates-d4350c2943dab39326ed268e859731649ba53f1b.tar.bz2
notenoughupdates-d4350c2943dab39326ed268e859731649ba53f1b.zip
Fix a few bugs with et/hex overlay (#285)
* Fix a few bugs with et/hex overlay * Moved fixEnchantId into ItemUtils Co-authored-by: Lorenz <lo.scherf@gmail.com>
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java
index c59a7003..c981f75c 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java
@@ -33,6 +33,7 @@ import io.github.moulberry.notenoughupdates.miscgui.util.OrbDisplay;
import io.github.moulberry.notenoughupdates.mixins.AccessorGuiContainer;
import io.github.moulberry.notenoughupdates.options.NEUConfig;
import io.github.moulberry.notenoughupdates.util.Constants;
+import io.github.moulberry.notenoughupdates.util.ItemUtils;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
@@ -118,9 +119,7 @@ public class GuiCustomHex extends Gui {
if (bazaarInfo != null && bazaarInfo.get("curr_buy") != null) {
this.price = bazaarInfo.get("curr_buy").getAsInt();
}
- if (this.enchId.equals("prosecute")) {
- this.enchId = "PROSECUTE";
- }
+ this.enchId = ItemUtils.fixEnchantId(this.enchId, true);
if (Constants.ENCHANTS != null) {
if (checkConflicts && Constants.ENCHANTS.has("enchant_pools")) {
@@ -134,7 +133,7 @@ public class GuiCustomHex extends Gui {
for (int j = 0; j < pool.size(); j++) {
String enchIdPoolElement = pool.get(j).getAsString();
- if (enchId.equalsIgnoreCase(enchIdPoolElement)) {
+ if (this.enchId.equalsIgnoreCase(enchIdPoolElement)) {
hasThis = true;
} else if (playerEnchantIds.containsKey(enchIdPoolElement)) {
hasApplied = true;
@@ -149,8 +148,8 @@ public class GuiCustomHex extends Gui {
if (level >= 1 && Constants.ENCHANTS.has("enchants_xp_cost")) {
JsonObject allCosts = Constants.ENCHANTS.getAsJsonObject("enchants_xp_cost");
- if (allCosts.has(enchId)) {
- JsonArray costs = allCosts.getAsJsonArray(enchId);
+ if (allCosts.has(this.enchId)) {
+ JsonArray costs = allCosts.getAsJsonArray(this.enchId);
if (costs.size() >= 1) {
if (useMaxLevelForCost) {
@@ -279,12 +278,16 @@ public class GuiCustomHex extends Gui {
}
shouldOverrideXp = config &&
- (containerName.length() >= 21 && Objects.equals("Bottles of Enchanting", containerName.substring(0, "Bottles of Enchanting".length()))) &&
+ (containerName.length() >= 21 && Objects.equals(
+ "Bottles of Enchanting",
+ containerName.substring(0, "Bottles of Enchanting".length())
+ )) &&
NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard();
GuiContainer chest = ((GuiContainer) Minecraft.getMinecraft().currentScreen);
ContainerChest cc = (ContainerChest) chest.inventorySlots;
ItemStack hexStack = cc.getLowerChestInventory().getStackInSlot(50);
- CalendarOverlay.ableToClickCalendar = !(shouldOverrideET || shouldOverrideFast || shouldOverrideGemstones || shouldOverrideXp);
+ CalendarOverlay.ableToClickCalendar =
+ !(shouldOverrideET || shouldOverrideFast || shouldOverrideGemstones || shouldOverrideXp);
if (hexStack != null && hexStack.getItem() == Items.experience_bottle)
return (shouldOverrideET || shouldOverrideFast);
if (!shouldOverrideFast && !shouldOverrideET && !shouldOverrideGemstones && !shouldOverrideXp) {
@@ -564,9 +567,7 @@ public class GuiCustomHex extends Gui {
.replace(" ", "_")
.replace("-", "_");
if (enchId.equalsIgnoreCase("_")) continue;
- if (enchId.equals("prosecute")) {
- enchId = "PROSECUTE";
- }
+ enchId = ItemUtils.fixEnchantId(enchId, true);
String name = Utils.cleanColour(book.getDisplayName());
if (searchField.getText().trim().isEmpty() ||
@@ -1233,7 +1234,8 @@ public class GuiCustomHex extends Gui {
renderHex(partialTicks);
} else if (containerName.contains("Enchant Item")) {
renderEnchantment(partialTicks);
- } else if (containerName.contains("Books") || containerName.contains("Modifiers") || containerName.contains("Bottles of Enchanting")) {
+ } else if (containerName.contains("Books") || containerName.contains("Modifiers") || containerName.contains(
+ "Bottles of Enchanting")) {
renderBooks(partialTicks);
} else if (containerName.contains("Gemstones")) {
renderGemstones(partialTicks);
@@ -1638,7 +1640,9 @@ public class GuiCustomHex extends Gui {
Minecraft.getMinecraft().fontRendererObj.drawString(levelStr, left + 8 - levelWidth / 2, top + 4, colour, false);
//Enchant name
- String name = WordUtils.capitalizeFully(enchanterCurrentEnch.enchId.replace("_", " "));
+ String name = WordUtils.capitalizeFully(ItemUtils
+ .fixEnchantId(enchanterCurrentEnch.enchId, false)
+ .replace("_", " "));
if (name.equalsIgnoreCase("Bane of Arthropods")) {
name = "Bane of Arth.";
} else if (name.equalsIgnoreCase("Projectile Protection")) {
@@ -3770,7 +3774,8 @@ public class GuiCustomHex extends Gui {
}
public void overrideIsMouseOverSlot(Slot slot, int mouseX, int mouseY, CallbackInfoReturnable<Boolean> cir) {
- if ((shouldOverrideFast || shouldOverrideGemstones || shouldOverrideXp) && currentState != EnchantState.ADDING_ENCHANT) {
+ if ((shouldOverrideFast || shouldOverrideGemstones || shouldOverrideXp) &&
+ currentState != EnchantState.ADDING_ENCHANT) {
boolean playerInv = slot.inventory == Minecraft.getMinecraft().thePlayer.inventory;
int slotId = slot.getSlotIndex();
if (playerInv && slotId < 36) {