Middling clicking to give in creative

This commit is contained in:
2026-11-22 14:11:37 -03:00
parent fe09e0cdd7
commit a26d801f4e
+6
View File
@@ -352,6 +352,12 @@ export class Client {
return;
}
// middle click in creative gives the block under the crosshair, like minecraft's pick block
if (hit && this.player.creative && InputManager.is_mouse_pressed(1)) {
const block = EverythingRegistry.get_by_id<BlockRegistry>("blocks", hit.block);
if (block) this.connection.send({ type: "chat", text: `/give ${block.id}` });
}
// a click uses right away, holding it on blocks keeps using every USE_REPEAT_MS. not while it's using an item
const now = performance.now();
const use_pressed = InputManager.is_mouse_pressed(2) && !this.player.using_item;