diff options
| -rw-r--r-- | src/main/kotlin/features/inventory/storageoverlay/StorageOverlay.kt | 1 | ||||
| -rw-r--r-- | src/main/kotlin/features/inventory/storageoverlay/StorageOverlayScreen.kt | 17 | ||||
| -rw-r--r-- | translations/en_us.json | 2 |
3 files changed, 19 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 diff --git a/translations/en_us.json b/translations/en_us.json index 4f8c408..a4a2d9f 100644 --- a/translations/en_us.json +++ b/translations/en_us.json @@ -403,6 +403,8 @@ "firmament.config.storage-overlay.highlight-search-results-colour": "Highlight Search Colour", "firmament.config.storage-overlay.highlight-search-results-colour.description": "Change the colour of the highlighted search result.", "firmament.config.storage-overlay.highlight-search-results.description": "Highlight the search results in the ender chest overlay.", + "firmament.config.storage-overlay.inactive-page-tooltips": "Inactive Page Tooltips", + "firmament.config.storage-overlay.inactive-page-tooltips.description": "Show item tooltips when hovering over items on pages other than the active one.", "firmament.config.storage-overlay.inverse-scroll": "Invert Scroll", "firmament.config.storage-overlay.inverse-scroll.description": "Invert the mouse wheel scrolling in Firmament's storage overlay.", "firmament.config.storage-overlay.margin": "Margin", |
