diff options
| author | Natalia Spence <52349324+Septikai@users.noreply.github.com> | 2025-10-31 15:29:11 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-31 16:29:11 +0100 |
| commit | ffd7e1a90941065bdc835deafd51f42688078ab2 (patch) | |
| tree | 11b58a0e0aed81faeb444b2a51012f780a29900f /src | |
| parent | 96989cc63c11da87efe39030f1da9a91d3b7812a (diff) | |
| download | Firmament-ffd7e1a90941065bdc835deafd51f42688078ab2.tar.gz Firmament-ffd7e1a90941065bdc835deafd51f42688078ab2.tar.bz2 Firmament-ffd7e1a90941065bdc835deafd51f42688078ab2.zip | |
feat: Inactive Storage Page Tooltips3.11.0+mc1.21.7
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/kotlin/features/inventory/storageoverlay/StorageOverlay.kt | 1 | ||||
| -rw-r--r-- | src/main/kotlin/features/inventory/storageoverlay/StorageOverlayScreen.kt | 17 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/main/kotlin/features/inventory/storageoverlay/StorageOverlay.kt b/src/main/kotlin/features/inventory/storageoverlay/StorageOverlay.kt index 7ae2a14..7dbb02a 100644 --- a/src/main/kotlin/features/inventory/storageoverlay/StorageOverlay.kt +++ b/src/main/kotlin/features/inventory/storageoverlay/StorageOverlay.kt @@ -43,6 +43,7 @@ object StorageOverlay { 255 ) } + val showInactivePageTooltips by toggle("inactive-page-tooltips") { false } val columns by integer("rows", 1, 10) { 3 } val height by integer("height", 80, 3000) { 3 * 18 * 6 } val retainScroll by toggle("retain-scroll") { true } diff --git a/src/main/kotlin/features/inventory/storageoverlay/StorageOverlayScreen.kt b/src/main/kotlin/features/inventory/storageoverlay/StorageOverlayScreen.kt index a023ce6..463eb33 100644 --- a/src/main/kotlin/features/inventory/storageoverlay/StorageOverlayScreen.kt +++ b/src/main/kotlin/features/inventory/storageoverlay/StorageOverlayScreen.kt @@ -19,6 +19,7 @@ import net.minecraft.client.gui.screen.ingame.HandledScreen import net.minecraft.item.ItemStack import net.minecraft.screen.slot.Slot import net.minecraft.text.Text +import net.minecraft.util.Formatting import net.minecraft.util.Identifier import moe.nea.firmament.events.SlotRenderEvents import moe.nea.firmament.gui.EmptyComponent @@ -292,10 +293,13 @@ class StorageOverlayScreen : Screen(Text.literal("")) { rect.y, page, inventory, if (excluding == page) slots else null, - slotOffset + slotOffset, + mouseX, + mouseY ) } context.disableScissor() + } @@ -482,6 +486,8 @@ class StorageOverlayScreen : Screen(Text.literal("")) { inventory: StorageData.StorageInventory, slots: List<Slot>?, slotOffset: Point, + mouseX: Int, + mouseY: Int, ): Int { val inv = inventory.inventory if (inv == null) { @@ -527,6 +533,15 @@ class StorageOverlayScreen : Screen(Text.literal("")) { context.drawItem(stack, slotX, slotY) context.drawStackOverlay(textRenderer, stack, slotX, slotY) SlotRenderEvents.After.publish(SlotRenderEvents.After(context, fakeSlot)) + if (StorageOverlay.TConfig.showInactivePageTooltips && !stack.isEmpty && mouseX >= slotX && mouseY >= slotY && mouseX <= slotX + 16 && mouseY <= slotY + 16) { + try { + context.drawItemTooltip(textRenderer, stack, mouseX, mouseY) + } catch (e: IllegalStateException) { + context.drawTooltip(textRenderer, listOf(Text.of(Formatting.RED.toString() + + "Error Getting Tooltip!"), Text.of(Formatting.YELLOW.toString() + + "Open page to fix" + Formatting.RESET)), mouseX, mouseY) + } + } } else { val slot = slots[index] slot.x = slotX - slotOffset.x |
