aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/features/inventory/buttons
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2025-11-24 23:42:00 +0100
committerLinnea Gräf <nea@nea.moe>2025-11-24 23:42:00 +0100
commit6dd14e7225ff60361fe9f87020c424c0eb89a68b (patch)
tree6977d5a71850924becc71b1ac53f1865a1c8330a /src/main/kotlin/features/inventory/buttons
parent3f33928c8fefe4816af9d538fa3fce48d5e76f7c (diff)
downloadFirmament-6dd14e7225ff60361fe9f87020c424c0eb89a68b.tar.gz
Firmament-6dd14e7225ff60361fe9f87020c424c0eb89a68b.tar.bz2
Firmament-6dd14e7225ff60361fe9f87020c424c0eb89a68b.zip
feat: firmament api
Diffstat (limited to 'src/main/kotlin/features/inventory/buttons')
-rw-r--r--src/main/kotlin/features/inventory/buttons/InventoryButtons.kt7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/kotlin/features/inventory/buttons/InventoryButtons.kt b/src/main/kotlin/features/inventory/buttons/InventoryButtons.kt
index fa376bc..eaa6138 100644
--- a/src/main/kotlin/features/inventory/buttons/InventoryButtons.kt
+++ b/src/main/kotlin/features/inventory/buttons/InventoryButtons.kt
@@ -11,6 +11,7 @@ import moe.nea.firmament.annotations.Subscribe
import moe.nea.firmament.events.HandledScreenClickEvent
import moe.nea.firmament.events.HandledScreenForegroundEvent
import moe.nea.firmament.events.HandledScreenPushREIEvent
+import moe.nea.firmament.impl.v1.FirmamentAPIImpl
import moe.nea.firmament.util.MC
import moe.nea.firmament.util.ScreenUtil
import moe.nea.firmament.util.TimeMark
@@ -40,9 +41,11 @@ object InventoryButtons {
)
fun getValidButtons(screen: AbstractContainerScreen<*>): Sequence<InventoryButton> {
- return DConfig.data.buttons.asSequence().filter { button ->
- button.isValid() && (!TConfig.onlyInv || screen is InventoryScreen)
+ if (TConfig.onlyInv && screen !is InventoryScreen) return emptySequence()
+ if (FirmamentAPIImpl.extensions.any { it.shouldHideInventoryButtons(screen) }) {
+ return emptySequence()
}
+ return DConfig.data.buttons.asSequence().filter(InventoryButton::isValid)
}