aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorZachary Jaser <76439587+Zickles@users.noreply.github.com>2024-03-06 03:33:07 -0500
committerGitHub <noreply@github.com>2024-03-06 09:33:07 +0100
commit82a00ed51d55d2be7d65d24c2e93e797cab33864 (patch)
tree0deee292d673718086394f82cb336e827166a9bf /src/main/java
parent88404bf8dc0f2aa9493000591e9db2e5d2caa369 (diff)
downloadskyhanni-82a00ed51d55d2be7d65d24c2e93e797cab33864.tar.gz
skyhanni-82a00ed51d55d2be7d65d24c2e93e797cab33864.tar.bz2
skyhanni-82a00ed51d55d2be7d65d24c2e93e797cab33864.zip
[Feat] block player from destroying fuel in inferno minion (#1103)
Co-authored-by: Cal <cwolfson58@gmail.com>
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/minion/MinionsConfig.java6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/InfernoMinionFuelsJson.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/minion/InfernoMinionFeatures.kt77
4 files changed, 94 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index 5bc418258..5c8d414ff 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -239,6 +239,7 @@ import at.hannibal2.skyhanni.features.mining.KingTalismanHelper
import at.hannibal2.skyhanni.features.mining.crystalhollows.CrystalHollowsNamesInCore
import at.hannibal2.skyhanni.features.mining.eventtracker.MiningEventTracker
import at.hannibal2.skyhanni.features.mining.powdertracker.PowderTracker
+import at.hannibal2.skyhanni.features.minion.InfernoMinionFeatures
import at.hannibal2.skyhanni.features.minion.MinionCollectLogic
import at.hannibal2.skyhanni.features.minion.MinionFeatures
import at.hannibal2.skyhanni.features.minion.MinionXp
@@ -758,6 +759,7 @@ class SkyHanniMod {
loadModule(QuiverNotification)
loadModule(MaxPurseItems())
loadModule(SuperCraftFeatures())
+ loadModule(InfernoMinionFeatures())
init()
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/minion/MinionsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/minion/MinionsConfig.java
index 4f089ce9d..6d45c4400 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/minion/MinionsConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/minion/MinionsConfig.java
@@ -49,4 +49,10 @@ public class MinionsConfig {
@ConfigEditorBoolean
@FeatureToggle
public boolean hideMobsNametagNearby = false;
+
+ @Expose
+ @ConfigOption(name = "Inferno Fuel Blocker", desc = "Prevents the player from picking up the fuel or minion while there is active fuel.")
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean infernoFuelBlocker = false;
}
diff --git a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/InfernoMinionFuelsJson.kt b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/InfernoMinionFuelsJson.kt
new file mode 100644
index 000000000..d6d3931c2
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/InfernoMinionFuelsJson.kt
@@ -0,0 +1,9 @@
+package at.hannibal2.skyhanni.data.jsonobjects.repo
+
+import at.hannibal2.skyhanni.utils.NEUInternalName
+import com.google.gson.annotations.Expose
+import com.google.gson.annotations.SerializedName
+
+data class InfernoMinionFuelsJson(
+ @Expose @SerializedName("inferno_minion_fuels") val minionFuels: List<NEUInternalName>
+)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/InfernoMinionFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/InfernoMinionFeatures.kt
new file mode 100644
index 000000000..37593552d
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/minion/InfernoMinionFeatures.kt
@@ -0,0 +1,77 @@
+package at.hannibal2.skyhanni.features.minion
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.jsonobjects.repo.InfernoMinionFuelsJson
+import at.hannibal2.skyhanni.events.GuiContainerEvent
+import at.hannibal2.skyhanni.events.InventoryCloseEvent
+import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent
+import at.hannibal2.skyhanni.events.LorenzToolTipEvent
+import at.hannibal2.skyhanni.events.RepositoryReloadEvent
+import at.hannibal2.skyhanni.utils.ItemUtils.name
+import at.hannibal2.skyhanni.utils.KeyboardManager
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.NEUInternalName
+import at.hannibal2.skyhanni.utils.StringUtils.matches
+import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class InfernoMinionFeatures {
+ private val config get() = SkyHanniMod.feature.minions
+ private val infernoMinionTitlePattern by RepoPattern.pattern(
+ "minion.infernominiontitle",
+ "Inferno Minion .*"
+ )
+ private var fuelItemIds = listOf<NEUInternalName>()
+ private var inInventory = false
+
+ @SubscribeEvent
+ fun onRepoReload(event: RepositoryReloadEvent) {
+ val data = event.getConstant<InfernoMinionFuelsJson>("InfernoMinionFuels")
+ fuelItemIds = data.minionFuels
+ }
+
+ @SubscribeEvent
+ fun onInventoryOpen(event: InventoryFullyOpenedEvent) {
+ inInventory = infernoMinionTitlePattern.matches(event.inventoryName)
+ }
+
+ @SubscribeEvent
+ fun onInventoryClose(event: InventoryCloseEvent) {
+ inInventory = false
+ }
+
+ @SubscribeEvent
+ fun onSlotClick(event: GuiContainerEvent.SlotClickEvent) {
+ if (!LorenzUtils.inSkyBlock) return
+ if (!config.infernoFuelBlocker) return
+ if (!inInventory) return
+
+ val containsFuel = NEUInternalName.fromItemNameOrNull(event.container.getSlot(19).stack.name.toString()) in fuelItemIds
+ if (!containsFuel) return
+
+ if (event.slot?.slotNumber == 19 || event.slot?.slotNumber == 53) {
+ if (KeyboardManager.isModifierKeyDown()) return
+ event.cancel()
+ }
+ }
+
+ @SubscribeEvent
+ fun onTooltip(event: LorenzToolTipEvent) {
+ if (!config.infernoFuelBlocker) return
+ if (!inInventory) return
+
+ val containsFuel = NEUInternalName.fromItemNameOrNull(event.itemStack.name.toString()) in fuelItemIds
+ if (!containsFuel) return
+
+ if (event.slot.slotNumber == 19) {
+ event.toolTip.add("")
+ event.toolTip.add("§c[SkyHanni] is blocking you from taking this out!")
+ event.toolTip.add(" §7(Bypass by holding the ${KeyboardManager.getModifierKeyName()} key)")
+ }
+ if (event.slot.slotNumber == 53) {
+ event.toolTip.add("")
+ event.toolTip.add("§c[SkyHanni] is blocking you from picking this minion up!")
+ event.toolTip.add(" §7(Bypass by holding the ${KeyboardManager.getModifierKeyName()} key)")
+ }
+ }
+}