Middling clicking to give in creative
This commit is contained in:
@@ -352,6 +352,12 @@ export class Client {
|
|||||||
return;
|
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
|
// 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 now = performance.now();
|
||||||
const use_pressed = InputManager.is_mouse_pressed(2) && !this.player.using_item;
|
const use_pressed = InputManager.is_mouse_pressed(2) && !this.player.using_item;
|
||||||
|
|||||||
Reference in New Issue
Block a user