diff options
Diffstat (limited to 'src/main/java/at/hannibal2')
5 files changed, 40 insertions, 15 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt index 92f6c02c3..7e6e06c80 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt @@ -4,11 +4,9 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.core.config.Position import at.hannibal2.skyhanni.config.core.config.gui.GuiPositionEditor import at.hannibal2.skyhanni.events.GuiRenderEvent -import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.NEUItems import io.github.moulberry.notenoughupdates.NEUOverlay -import io.github.moulberry.notenoughupdates.overlays.AuctionSearchOverlay -import io.github.moulberry.notenoughupdates.overlays.BazaarSearchOverlay import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.client.gui.inventory.GuiEditSign @@ -36,9 +34,7 @@ class GuiEditManager { if (SkyHanniMod.feature.gui.keyBindOpen != key) return if (NEUOverlay.searchBarHasFocus) return - if (AuctionSearchOverlay.shouldReplace()) return - if (BazaarSearchOverlay.shouldReplace()) return - if (InventoryUtils.inStorage()) return + if (NEUItems.neuHasFocus()) return if (isInGui()) return openGuiEditor() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt index 382c5459f..e7051405c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt @@ -142,11 +142,11 @@ class GardenVisitorFeatures { list.add(Renderable.optionalLink("$name §ex${amount.addSeparators()}", { if (Minecraft.getMinecraft().currentScreen is GuiEditSign) { LorenzUtils.setTextIntoSign("$amount") - } else if (!InventoryUtils.inStorage() && !LorenzUtils.noTradeMode) { + } else if (!NEUItems.neuHasFocus() && !LorenzUtils.noTradeMode) { LorenzUtils.sendCommandToServer("bz ${name.removeColor()}") OSUtils.copyToClipboard("$amount") } - }) { GardenAPI.inGarden() && !InventoryUtils.inStorage() }) + }) { GardenAPI.inGarden() && !NEUItems.neuHasFocus() }) if (config.visitorNeedsShowPrice) { val price = NEUItems.getPrice(internalName) * amount diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ChatPeek.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ChatPeek.kt new file mode 100644 index 000000000..795c56290 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ChatPeek.kt @@ -0,0 +1,23 @@ +package at.hannibal2.skyhanni.features.misc + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.utils.NEUItems +import net.minecraft.client.Minecraft +import net.minecraft.client.gui.inventory.GuiEditSign +import org.lwjgl.input.Keyboard + + +object ChatPeek { + @JvmStatic + fun peek(): Boolean { + val key = SkyHanniMod.feature.chat.peekChat + + if (Minecraft.getMinecraft().thePlayer == null) return false + if (key <= Keyboard.KEY_NONE) return false + if (Minecraft.getMinecraft().currentScreen is GuiEditSign) return false + + if (NEUItems.neuHasFocus()) return false + + return Keyboard.isKeyDown(key) + } +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiNewChat.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiNewChat.java index 380963554..19b8de911 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiNewChat.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiNewChat.java @@ -1,9 +1,7 @@ package at.hannibal2.skyhanni.mixins.transformers.gui; -import at.hannibal2.skyhanni.SkyHanniMod; -import net.minecraft.client.Minecraft; +import at.hannibal2.skyhanni.features.misc.ChatPeek; import net.minecraft.client.gui.GuiNewChat; -import org.lwjgl.input.Keyboard; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -14,9 +12,6 @@ public class MixinGuiNewChat { @Inject(method = "getChatOpen", at = @At("HEAD"), cancellable = true) public void onIsOpen(CallbackInfoReturnable<Boolean> cir) { - if (SkyHanniMod.getFeature().chat.peekChat > Keyboard.KEY_NONE - && Minecraft.getMinecraft().thePlayer != null - && Keyboard.isKeyDown(SkyHanniMod.getFeature().chat.peekChat)) - cir.setReturnValue(true); + if (ChatPeek.peek()) cir.setReturnValue(true); } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt index 2437174c3..d605c294e 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt @@ -6,6 +6,8 @@ import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimal import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import io.github.moulberry.notenoughupdates.NEUManager import io.github.moulberry.notenoughupdates.NotEnoughUpdates +import io.github.moulberry.notenoughupdates.overlays.AuctionSearchOverlay +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 @@ -216,4 +218,13 @@ object NEUItems { recipesCache[minionId] = recipes return recipes } + + // TODO add support for neu item list + fun neuHasFocus(): Boolean { + if (AuctionSearchOverlay.shouldReplace()) return true + if (BazaarSearchOverlay.shouldReplace()) return true + if (InventoryUtils.inStorage()) return true + + return false + } }
\ No newline at end of file |