aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2025-03-14 20:18:29 +0100
committerLinnea Gräf <nea@nea.moe>2025-03-14 20:20:24 +0100
commitce2e4f48d4631a48162203872f8fd87c5aeab49e (patch)
tree8a70a0412da6e156a21e5adb58478f08ce9d6f45 /src/main/kotlin
parent2cfe476909673dff921674bc9d19b046e850ef9d (diff)
downloadFirmament-ce2e4f48d4631a48162203872f8fd87c5aeab49e.tar.gz
Firmament-ce2e4f48d4631a48162203872f8fd87c5aeab49e.tar.bz2
Firmament-ce2e4f48d4631a48162203872f8fd87c5aeab49e.zip
refactor: Move transparent ui into built in resource pack
Diffstat (limited to 'src/main/kotlin')
-rw-r--r--src/main/kotlin/Firmament.kt9
-rw-r--r--src/main/kotlin/features/inventory/storageoverlay/StorageOverlay.kt12
-rw-r--r--src/main/kotlin/features/inventory/storageoverlay/StorageOverlayScreen.kt10
3 files changed, 14 insertions, 17 deletions
diff --git a/src/main/kotlin/Firmament.kt b/src/main/kotlin/Firmament.kt
index 01905c7..f43018b 100644
--- a/src/main/kotlin/Firmament.kt
+++ b/src/main/kotlin/Firmament.kt
@@ -19,6 +19,8 @@ import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents
import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback
import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents
+import net.fabricmc.fabric.api.resource.ResourceManagerHelper
+import net.fabricmc.fabric.api.resource.ResourcePackActivationType
import net.fabricmc.loader.api.FabricLoader
import net.fabricmc.loader.api.Version
import net.fabricmc.loader.api.metadata.ModMetadata
@@ -49,6 +51,7 @@ import moe.nea.firmament.repo.RepoManager
import moe.nea.firmament.util.MC
import moe.nea.firmament.util.SBData
import moe.nea.firmament.util.data.IDataHolder
+import moe.nea.firmament.util.tr
object Firmament {
val modContainer by lazy { FabricLoader.getInstance().getModContainer(MOD_ID).get() }
@@ -145,6 +148,12 @@ object Firmament {
})
})
ClientInitEvent.publish(ClientInitEvent())
+ ResourceManagerHelper.registerBuiltinResourcePack(
+ identifier("transparent_storage"),
+ modContainer,
+ tr("firmament.resourcepack.transparentstorage", "Transparent Firmament Storage Overlay"),
+ ResourcePackActivationType.NORMAL
+ )
}
diff --git a/src/main/kotlin/features/inventory/storageoverlay/StorageOverlay.kt b/src/main/kotlin/features/inventory/storageoverlay/StorageOverlay.kt
index 0e3a0a8..2e807de 100644
--- a/src/main/kotlin/features/inventory/storageoverlay/StorageOverlay.kt
+++ b/src/main/kotlin/features/inventory/storageoverlay/StorageOverlay.kt
@@ -7,7 +7,6 @@ import net.minecraft.client.gui.screen.ingame.HandledScreen
import net.minecraft.entity.player.PlayerInventory
import net.minecraft.item.Items
import net.minecraft.network.packet.c2s.play.CloseHandledScreenC2SPacket
-import net.minecraft.util.StringIdentifiable
import moe.nea.firmament.annotations.Subscribe
import moe.nea.firmament.events.ScreenChangeEvent
import moe.nea.firmament.events.SlotClickEvent
@@ -34,16 +33,6 @@ object StorageOverlay : FirmamentFeature {
val inverseScroll by toggle("inverse-scroll") { false }
val padding by integer("padding", 1, 20) { 5 }
val margin by integer("margin", 1, 60) { 20 }
- val texture by choice("texture") { StorageTexture.DEFAULT }
- }
-
- enum class StorageTexture(val id: Int) : StringIdentifiable {
- DEFAULT(0),
- CLEAR(1);
-
- override fun asString(): String? {
- return id.toString()
- }
}
fun adjustScrollSpeed(amount: Double): Double {
@@ -162,5 +151,4 @@ object StorageOverlay : FirmamentFeature {
}
}
}
-
}
diff --git a/src/main/kotlin/features/inventory/storageoverlay/StorageOverlayScreen.kt b/src/main/kotlin/features/inventory/storageoverlay/StorageOverlayScreen.kt
index 292850a..633a8fe 100644
--- a/src/main/kotlin/features/inventory/storageoverlay/StorageOverlayScreen.kt
+++ b/src/main/kotlin/features/inventory/storageoverlay/StorageOverlayScreen.kt
@@ -108,12 +108,12 @@ class StorageOverlayScreen : Screen(Text.literal("")) {
fun getMaxScroll() = lastRenderedInnerHeight.toFloat() - getScrollPanelInner().height
- val playerInventorySprite = Identifier.of("firmament:storageoverlay/player_inventory_${StorageOverlay.TConfig.texture.asString()}")
- val upperBackgroundSprite = Identifier.of("firmament:storageoverlay/upper_background_${StorageOverlay.TConfig.texture.asString()}")
- val slotRowSprite = Identifier.of("firmament:storageoverlay/storage_row_${StorageOverlay.TConfig.texture.asString()}")
- val scrollbarBackground = Identifier.of("firmament:storageoverlay/scroll_bar_background_${StorageOverlay.TConfig.texture.asString()}")
+ val playerInventorySprite = Identifier.of("firmament:storageoverlay/player_inventory")
+ val upperBackgroundSprite = Identifier.of("firmament:storageoverlay/upper_background")
+ val slotRowSprite = Identifier.of("firmament:storageoverlay/storage_row")
+ val scrollbarBackground = Identifier.of("firmament:storageoverlay/scroll_bar_background")
val scrollbarKnob = Identifier.of("firmament:storageoverlay/scroll_bar_knob")
- val controllerBackground = Identifier.of("firmament:storageoverlay/storage_controls_${StorageOverlay.TConfig.texture.asString()}")
+ val controllerBackground = Identifier.of("firmament:storageoverlay/storage_controls")
override fun close() {
isExiting = true