aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/io')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java71
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java3
2 files changed, 38 insertions, 36 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
index 99dce3bb..201cec86 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
@@ -4,6 +4,7 @@ import com.google.common.collect.Lists;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
+import com.google.gson.JsonPrimitive;
import io.github.moulberry.notenoughupdates.auction.CustomAHGui;
import io.github.moulberry.notenoughupdates.core.BackgroundBlur;
import io.github.moulberry.notenoughupdates.core.GuiScreenElementWrapper;
@@ -24,6 +25,7 @@ import io.github.moulberry.notenoughupdates.util.Constants;
import io.github.moulberry.notenoughupdates.util.GuiTextures;
import io.github.moulberry.notenoughupdates.util.LerpingFloat;
import io.github.moulberry.notenoughupdates.util.NotificationHandler;
+import io.github.moulberry.notenoughupdates.util.SBInfo;
import io.github.moulberry.notenoughupdates.util.SpecialColour;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
@@ -87,36 +89,6 @@ import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.ascending_overlay;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.close;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.descending_overlay;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.help;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.itemPaneTabArrow;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.item_haschild;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.item_mask;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.order_alphabetical;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.order_alphabetical_active;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.order_rarity;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.order_rarity_active;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.order_value;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.order_value_active;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.quickcommand_background;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.rightarrow;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.rightarrow_overlay;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.settings;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.sort_accessory;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.sort_accessory_active;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.sort_all;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.sort_all_active;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.sort_armor;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.sort_armor_active;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.sort_mob;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.sort_mob_active;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.sort_pet;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.sort_pet_active;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.sort_tool;
-import static io.github.moulberry.notenoughupdates.util.GuiTextures.sort_tool_active;
-
public class NEUOverlay extends Gui {
private static final ResourceLocation SUPERGEHEIMNISVERMOGEN = new ResourceLocation(
"notenoughupdates:supersecretassets/bald.png");
@@ -1901,17 +1873,44 @@ public class NEUOverlay extends Gui {
}
}
- private ItemStack getWardrobeSlot(int armourSlot) {
- if (isInNamedGui("Your Equipment")) {
- return getChestSlotsAsItemStack(armourSlot);
- } else return null;
- }
-
public ItemStack slot1 = null;
public ItemStack slot2 = null;
public ItemStack slot3 = null;
public ItemStack slot4 = null;
public ItemStack petSlot = null;
+ private String lastProfile;
+
+ private ItemStack getWardrobeSlot(int armourSlot) {
+ if (!SBInfo.getInstance().currentProfile.equals(lastProfile)) {
+ lastProfile = SBInfo.getInstance().currentProfile;
+ slot1 = null;
+ slot2 = null;
+ slot3 = null;
+ slot4 = null;
+ petSlot = null;
+ }
+
+ if (isInNamedGui("Your Equipment")) {
+ ItemStack itemStack = getChestSlotsAsItemStack(armourSlot);
+ if (itemStack != null) {
+ JsonObject itemToSave = NotEnoughUpdates.INSTANCE.manager.getJsonForItem(itemStack);
+ if (!itemToSave.has("internalname")) {
+ //would crash without internalName when trying to construct the ItemStack again
+ itemToSave.add("internalname", new JsonPrimitive("_"));
+ }
+ NotEnoughUpdates.INSTANCE.config.getProfileSpecific().savedEquipment.put(armourSlot, itemToSave);
+ return itemStack;
+ }
+ } else {
+ if (NotEnoughUpdates.INSTANCE.config.getProfileSpecific().savedEquipment.containsKey(armourSlot)) {
+ //don't use cache since the internalName is identical in most cases
+ return NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.config.getProfileSpecific().savedEquipment
+ .get(armourSlot)
+ .getAsJsonObject(), false);
+ }
+ }
+ return null;
+ }
public static boolean isRenderingArmorHud() {
return renderingArmorHud;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
index 2e31fbf3..5ed990a4 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
@@ -1,6 +1,7 @@
package io.github.moulberry.notenoughupdates.options;
import com.google.common.collect.Lists;
+import com.google.gson.JsonObject;
import com.google.gson.annotations.Expose;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.core.GuiScreenElementWrapper;
@@ -517,6 +518,8 @@ public class NEUConfig extends Config {
public HashMap<String, Boolean> unlockedWarpScrolls = new HashMap<>();
@Expose
public long dailyHeavyPearlCompleted = 0L;
+ @Expose
+ public HashMap<Integer, JsonObject> savedEquipment = new HashMap<>();
}
public HiddenLocationSpecific getLocationSpecific() {