aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/Storage.java3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt13
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenDeskInSBMenu.kt10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/EnigmaSoulWaypoints.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt36
7 files changed, 52 insertions, 19 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/Storage.java b/src/main/java/at/hannibal2/skyhanni/config/Storage.java
index a1f9fbfb1..d720b0211 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/Storage.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/Storage.java
@@ -35,6 +35,9 @@ public class Storage {
@Expose
public long nextCityProjectParticipationTime = 0L;
+
+ @Expose
+ public String lastRepoIssueVersion = "";
}
public static class ProfileSpecific {
diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
index 59b850784..b91bf4252 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
@@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.config.ConfigGuiManager
import at.hannibal2.skyhanni.config.commands.SimpleCommand.ProcessCommandRunnable
import at.hannibal2.skyhanni.data.ApiDataLoader
import at.hannibal2.skyhanni.data.GuiEditManager
+import at.hannibal2.skyhanni.data.ProfileStorageData
import at.hannibal2.skyhanni.features.bingo.BingoCardDisplay
import at.hannibal2.skyhanni.features.bingo.BingoNextStepHelper
import at.hannibal2.skyhanni.features.event.diana.BurrowWarpHelper
@@ -86,6 +87,7 @@ object Commands {
registerCommand("shtestcomposter") { ComposterOverlay.onCommand(it) }
registerCommand("shtestinquisitor") { InquisitorWaypointShare.test() }
registerCommand("shshowcropmoneycalculation") { CropMoneyDisplay.toggleShowCalculation() }
+ registerCommand("shstoprepowarnings") { stopRepoWarnings()}
// for developers - coding help
registerCommand("shreloadlocalrepo") { SkyHanniMod.repo.reloadLocalRepo() }
@@ -113,6 +115,17 @@ object Commands {
}
}
+ private fun stopRepoWarnings() {
+ val hidden = ProfileStorageData.playerSpecific?.lastRepoIssueVersion
+ if (hidden == SkyHanniMod.version) {
+ ProfileStorageData.playerSpecific?.lastRepoIssueVersion = ""
+ LorenzUtils.chat("§e[SkyHanni] Re-enabled repo warnings.")
+ } else {
+ ProfileStorageData.playerSpecific?.lastRepoIssueVersion = SkyHanniMod.version
+ LorenzUtils.chat("§e[SkyHanni] Disabled repo warnings until next update.")
+ }
+ }
+
private fun clearFarmingItems() {
val config = GardenAPI.config?.fortune ?: return
LorenzUtils.chat("§e[SkyHanni] clearing farming items")
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt
index a85b73363..67e6f0197 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt
@@ -46,7 +46,7 @@ class GardenComposterInventoryFeatures {
}
val internalName = NEUItems.getInternalNameOrNull(itemName)
if (internalName == null) {
- LorenzUtils.chat("§c[SkyHanni] Error reading internal name for item '$itemName' " +
+ LorenzUtils.chat("§c[SkyHanni] Error reading internal name for item '$itemName§c' " +
"(in GardenComposterInventoryFeatures)")
continue
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenDeskInSBMenu.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenDeskInSBMenu.kt
index b397d7c1d..ca8e4dbe3 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenDeskInSBMenu.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenDeskInSBMenu.kt
@@ -10,8 +10,6 @@ import io.github.moulberry.notenoughupdates.events.ReplaceItemEvent
import io.github.moulberry.notenoughupdates.events.SlotClickEvent
import io.github.moulberry.notenoughupdates.util.Utils
import net.minecraft.client.player.inventory.ContainerLocalMenu
-import net.minecraft.init.Blocks
-import net.minecraft.item.ItemStack
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -21,12 +19,8 @@ class GardenDeskInSBMenu {
private var showItem = false
private val item by lazy {
- var neuItem = NEUItems.getItemStackOrNull("DOUBLE_PLANT")
- if (neuItem == null) {
- neuItem = ItemStack(Blocks.double_plant)
- Utils.showOutdatedRepoNotification()
- }
- Utils.createItemStack(neuItem!!.item, "§bDesk", "§7Click here to", "§7run §e/desk")
+ val neuItem = NEUItems.getItemStack("DOUBLE_PLANT")
+ Utils.createItemStack(neuItem.item, "§bDesk", "§7Click here to", "§7run §e/desk")
}
@SubscribeEvent
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/EnigmaSoulWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/EnigmaSoulWaypoints.kt
index e43ef03f7..bf70e8b8d 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/rift/EnigmaSoulWaypoints.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/EnigmaSoulWaypoints.kt
@@ -18,9 +18,7 @@ import io.github.moulberry.notenoughupdates.events.SlotClickEvent
import io.github.moulberry.notenoughupdates.util.Utils
import net.minecraft.client.gui.inventory.GuiChest
import net.minecraft.client.player.inventory.ContainerLocalMenu
-import net.minecraft.init.Blocks
import net.minecraft.inventory.ContainerChest
-import net.minecraft.item.ItemStack
import net.minecraftforge.client.event.RenderWorldLastEvent
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -34,8 +32,7 @@ object EnigmaSoulWaypoints {
private var adding = true
private val item by lazy {
- val neuItem = NEUItems.getItemStackOrNull("SKYBLOCK_ENIGMA_SOUL")
- ?: ItemStack(Blocks.obsidian) // can prob have a better fallback
+ val neuItem = NEUItems.getItemStack("SKYBLOCK_ENIGMA_SOUL")
Utils.createItemStack(
neuItem.item,
"§5Toggle Missing",
diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt
index 112768637..94716762f 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt
@@ -54,7 +54,7 @@ object CopyErrorCommand {
"```\nSkyHanni ${SkyHanniMod.version}: $message\n(full stack trace)\n \n$fullStackTrace\n```"
LorenzUtils.clickableChat(
- "§c[SkyHanni ${SkyHanniMod.version}]: $message. Click here to copy the error into the clipboard.",
+ "§c[SkyHanni ${SkyHanniMod.version}]: $message§c. Click here to copy the error into the clipboard.",
"shcopyerror $randomId"
)
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
index 97f1b7ca3..848acd0ff 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
@@ -1,6 +1,9 @@
package at.hannibal2.skyhanni.utils
+import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.config.ConfigManager
+import at.hannibal2.skyhanni.data.ProfileStorageData
+import at.hannibal2.skyhanni.test.command.CopyErrorCommand
import at.hannibal2.skyhanni.utils.ItemBlink.checkBlinkItem
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimal
@@ -16,9 +19,11 @@ import io.github.moulberry.notenoughupdates.overlays.BazaarSearchOverlay
import io.github.moulberry.notenoughupdates.recipes.CraftingRecipe
import io.github.moulberry.notenoughupdates.recipes.NeuRecipe
import io.github.moulberry.notenoughupdates.util.ItemResolutionQuery
+import io.github.moulberry.notenoughupdates.util.Utils
import net.minecraft.client.Minecraft
import net.minecraft.client.renderer.GlStateManager
import net.minecraft.client.renderer.RenderHelper
+import net.minecraft.init.Blocks
import net.minecraft.init.Items
import net.minecraft.item.ItemStack
import net.minecraft.nbt.NBTTagCompound
@@ -32,6 +37,15 @@ object NEUItems {
private val enchantmentNamePattern = Pattern.compile("^(?<format>(?:§.)+)(?<name>[^§]+) (?<level>[IVXL]+)$")
var allItemsCache = mapOf<String, String>() // item name -> internal name
var allInternalNames = mutableListOf<String>()
+ private var warnedAlready = false
+
+ private val fallbackItem by lazy {
+ Utils.createItemStack(
+ ItemStack(Blocks.barrier).item,
+ "§cMissing Repo Item",
+ "§cYour NEU repo seems to be out of date"
+ )
+ }
fun getInternalName(itemName: String): String {
return getInternalNameOrNull(itemName) ?: throw Error("getInternalName is null for '$itemName'")
@@ -71,6 +85,11 @@ object NEUItems {
return itemNameCache[lowercase]!!
}
+ if (itemName == "§cmissing repo item") {
+ itemNameCache[lowercase] = "MISSING_ITEM"
+ return "MISSING_ITEM"
+ }
+
resolveEnchantmentByName(itemName)?.let {
itemNameCache[itemName] = it
return it
@@ -137,11 +156,18 @@ object NEUItems {
.withKnownInternalName(internalName)
.resolveToItemStack()?.copy()
- fun getItemStack(internalName: String): ItemStack = getItemStackOrNull(internalName)
- ?: throw IllegalStateException(
- "Could not find the Item '$internalName' in NEU Repo",
- Error("ItemResolutionQuery returns null for internalName '$internalName'")
- )
+ fun getItemStack(internalName: String): ItemStack = getItemStackOrNull(internalName) ?: run {
+ if (ProfileStorageData.playerSpecific?.lastRepoIssueVersion != SkyHanniMod.version || !warnedAlready) {
+ Utils.showOutdatedRepoNotification()
+ CopyErrorCommand.logError(
+ IllegalStateException("Something went wrong!"),
+ "Encountered an error getting the item for §7$internalName§c. " +
+ "This is probably because your NEU repo is outdated"
+ )
+ }
+ warnedAlready = true
+ fallbackItem
+ }
fun isVanillaItem(item: ItemStack) = manager.auctionManager.isVanillaItem(item.getInternalName())