This commit is contained in:
2026-09-26 18:06:05 -03:00
parent 01a81b926e
commit e22f12c0b6
12 changed files with 215 additions and 35 deletions
+8 -1
View File
@@ -7,6 +7,7 @@ import { InputManager } from "../input_manager.ts";
import { ClientInventories } from "../inventory.ts";
import { canvas, Texture } from "../renderer/mod.ts";
import { draw_item, draw_nine_slice } from "../rendering/render_utils.ts";
import { draw_tooltip, item_tooltip } from "./tooltip.ts";
export class Slot {
container: ContainerKey;
@@ -99,9 +100,15 @@ export class GuiInventoryScreen extends GuiScreen {
}
}
const mouse = InputManager.get_mouse_position();
if (this.inventories.cursor.item) {
const mouse = InputManager.get_mouse_position();
draw_item(this.inventories.cursor.item, mouse.x, mouse.y);
} else if (this.hovering) {
// what's in the slot under the mouse, while not carrying anything
const item = this.get_container(this.hovering.container)?.get_item(this.hovering.index);
if (item) {
draw_tooltip(item_tooltip(item), mouse.x, mouse.y);
}
}
}