Skip to content

Commit ce2e4f4

Browse files
committed
refactor: Move transparent ui into built in resource pack
1 parent 2cfe476 commit ce2e4f4

23 files changed

+24
-21
lines changed

src/main/kotlin/Firmament.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents
1919
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents
2020
import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback
2121
import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents
22+
import net.fabricmc.fabric.api.resource.ResourceManagerHelper
23+
import net.fabricmc.fabric.api.resource.ResourcePackActivationType
2224
import net.fabricmc.loader.api.FabricLoader
2325
import net.fabricmc.loader.api.Version
2426
import net.fabricmc.loader.api.metadata.ModMetadata
@@ -49,6 +51,7 @@ import moe.nea.firmament.repo.RepoManager
4951
import moe.nea.firmament.util.MC
5052
import moe.nea.firmament.util.SBData
5153
import moe.nea.firmament.util.data.IDataHolder
54+
import moe.nea.firmament.util.tr
5255

5356
object Firmament {
5457
val modContainer by lazy { FabricLoader.getInstance().getModContainer(MOD_ID).get() }
@@ -145,6 +148,12 @@ object Firmament {
145148
})
146149
})
147150
ClientInitEvent.publish(ClientInitEvent())
151+
ResourceManagerHelper.registerBuiltinResourcePack(
152+
identifier("transparent_storage"),
153+
modContainer,
154+
tr("firmament.resourcepack.transparentstorage", "Transparent Firmament Storage Overlay"),
155+
ResourcePackActivationType.NORMAL
156+
)
148157
}
149158

150159

src/main/kotlin/features/inventory/storageoverlay/StorageOverlay.kt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import net.minecraft.client.gui.screen.ingame.HandledScreen
77
import net.minecraft.entity.player.PlayerInventory
88
import net.minecraft.item.Items
99
import net.minecraft.network.packet.c2s.play.CloseHandledScreenC2SPacket
10-
import net.minecraft.util.StringIdentifiable
1110
import moe.nea.firmament.annotations.Subscribe
1211
import moe.nea.firmament.events.ScreenChangeEvent
1312
import moe.nea.firmament.events.SlotClickEvent
@@ -34,16 +33,6 @@ object StorageOverlay : FirmamentFeature {
3433
val inverseScroll by toggle("inverse-scroll") { false }
3534
val padding by integer("padding", 1, 20) { 5 }
3635
val margin by integer("margin", 1, 60) { 20 }
37-
val texture by choice("texture") { StorageTexture.DEFAULT }
38-
}
39-
40-
enum class StorageTexture(val id: Int) : StringIdentifiable {
41-
DEFAULT(0),
42-
CLEAR(1);
43-
44-
override fun asString(): String? {
45-
return id.toString()
46-
}
4736
}
4837

4938
fun adjustScrollSpeed(amount: Double): Double {
@@ -162,5 +151,4 @@ object StorageOverlay : FirmamentFeature {
162151
}
163152
}
164153
}
165-
166154
}

src/main/kotlin/features/inventory/storageoverlay/StorageOverlayScreen.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,12 @@ class StorageOverlayScreen : Screen(Text.literal("")) {
108108

109109
fun getMaxScroll() = lastRenderedInnerHeight.toFloat() - getScrollPanelInner().height
110110

111-
val playerInventorySprite = Identifier.of("firmament:storageoverlay/player_inventory_${StorageOverlay.TConfig.texture.asString()}")
112-
val upperBackgroundSprite = Identifier.of("firmament:storageoverlay/upper_background_${StorageOverlay.TConfig.texture.asString()}")
113-
val slotRowSprite = Identifier.of("firmament:storageoverlay/storage_row_${StorageOverlay.TConfig.texture.asString()}")
114-
val scrollbarBackground = Identifier.of("firmament:storageoverlay/scroll_bar_background_${StorageOverlay.TConfig.texture.asString()}")
111+
val playerInventorySprite = Identifier.of("firmament:storageoverlay/player_inventory")
112+
val upperBackgroundSprite = Identifier.of("firmament:storageoverlay/upper_background")
113+
val slotRowSprite = Identifier.of("firmament:storageoverlay/storage_row")
114+
val scrollbarBackground = Identifier.of("firmament:storageoverlay/scroll_bar_background")
115115
val scrollbarKnob = Identifier.of("firmament:storageoverlay/scroll_bar_knob")
116-
val controllerBackground = Identifier.of("firmament:storageoverlay/storage_controls_${StorageOverlay.TConfig.texture.asString()}")
116+
val controllerBackground = Identifier.of("firmament:storageoverlay/storage_controls")
117117

118118
override fun close() {
119119
isExiting = true

src/main/resources/assets/firmament/textures/gui/sprites/storageoverlay/player_inventory_0.png renamed to src/main/resources/assets/firmament/textures/gui/sprites/storageoverlay/player_inventory.png

File renamed without changes.

src/main/resources/assets/firmament/textures/gui/sprites/storageoverlay/scroll_bar_background_0.png renamed to src/main/resources/assets/firmament/textures/gui/sprites/storageoverlay/scroll_bar_background.png

File renamed without changes.

src/main/resources/assets/firmament/textures/gui/sprites/storageoverlay/scroll_bar_background_0.png.mcmeta renamed to src/main/resources/assets/firmament/textures/gui/sprites/storageoverlay/scroll_bar_background.png.mcmeta

File renamed without changes.

src/main/resources/assets/firmament/textures/gui/sprites/storageoverlay/storage_controls_0.png renamed to src/main/resources/assets/firmament/textures/gui/sprites/storageoverlay/storage_controls.png

File renamed without changes.

src/main/resources/assets/firmament/textures/gui/sprites/storageoverlay/storage_controls_0.png.mcmeta renamed to src/main/resources/assets/firmament/textures/gui/sprites/storageoverlay/storage_controls.png.mcmeta

File renamed without changes.

src/main/resources/assets/firmament/textures/gui/sprites/storageoverlay/storage_row_0.png renamed to src/main/resources/assets/firmament/textures/gui/sprites/storageoverlay/storage_row.png

File renamed without changes.

src/main/resources/assets/firmament/textures/gui/sprites/storageoverlay/storage_row_0.png.mcmeta renamed to src/main/resources/assets/firmament/textures/gui/sprites/storageoverlay/storage_row.png.mcmeta

File renamed without changes.

0 commit comments

Comments
 (0)