aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/commands
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-10-26 18:17:10 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-10-26 18:17:10 +0200
commit51cfe4de8e902e614ea73627fce7d34eabea2e62 (patch)
tree5f3da71724052c61ad2c08e112a86337971bcfd2 /src/main/java/at/hannibal2/skyhanni/features/commands
parent4416d272a774be2afd89cf5fbe05595d41349fc7 (diff)
downloadskyhanni-51cfe4de8e902e614ea73627fce7d34eabea2e62.tar.gz
skyhanni-51cfe4de8e902e614ea73627fce7d34eabea2e62.tar.bz2
skyhanni-51cfe4de8e902e614ea73627fce7d34eabea2e62.zip
Added support for tab completing the items with recipe in Hypixel command /viewrecipe.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/commands')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt21
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/TabComplete.kt2
2 files changed, 22 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt
index 0563f21ee..4464959e2 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/commands/ViewRecipeCommand.kt
@@ -3,10 +3,11 @@ package at.hannibal2.skyhanni.features.commands
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.PacketEvent
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.NEUItems
import net.minecraft.network.play.client.C01PacketChatMessage
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-class ViewRecipeCommand {
+object ViewRecipeCommand {
private val config get() = SkyHanniMod.feature.commands
@SubscribeEvent
@@ -22,4 +23,22 @@ class ViewRecipeCommand {
}
}
}
+
+ val list by lazy {
+ val list = mutableListOf<String>()
+ for ((key, value) in NEUItems.manager.itemInformation) {
+ if (value.has("recipe")) {
+ list.add(key.lowercase())
+ }
+ }
+ list
+ }
+
+ fun customTabComplete(command: String): List<String>? {
+ if (command == "viewrecipe" && config.tabComplete.viewrecipeItems) {
+ return list
+ }
+
+ return null
+ }
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/TabComplete.kt b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/TabComplete.kt
index 9c03e3a87..a835efd38 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/TabComplete.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/commands/tabcomplete/TabComplete.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.features.commands.tabcomplete
import at.hannibal2.skyhanni.features.commands.PartyCommands
+import at.hannibal2.skyhanni.features.commands.ViewRecipeCommand
import at.hannibal2.skyhanni.features.misc.CollectionTracker
object TabComplete {
@@ -26,6 +27,7 @@ object TabComplete {
PlayerTabComplete.handleTabComplete(command)?.let { return it }
CollectionTracker.handleTabComplete(command)?.let { return it }
PartyCommands.customTabComplete(command)?.let { return it }
+ ViewRecipeCommand.customTabComplete(command)?.let { return it }
return null
}