Repeater
This commit is contained in:
+7
-2
@@ -25,7 +25,7 @@ import { back_to_title } from "./gui/title_screen.ts";
|
||||
import { TICK_DELTA } from "$/common/constants.ts";
|
||||
import { Container } from "$/common/inventory.ts";
|
||||
import { PLAYER_MENU } from "$/common/protocol.ts";
|
||||
import { EverythingRegistry } from "$/common/everything_registry.ts";
|
||||
import { type BlockRegistry, EverythingRegistry } from "$/common/everything_registry.ts";
|
||||
import type { EntityJson } from "$/common/mod_data.ts";
|
||||
import { tick_texture_animations } from "./texture_animations.ts";
|
||||
|
||||
@@ -365,7 +365,12 @@ export class Client {
|
||||
const previous = inventories.hotbar_selected;
|
||||
|
||||
const scroll = InputManager.get_wheel_delta();
|
||||
if (scroll > 0) {
|
||||
// at a block that takes the mouse wheel, like a pulse repeater's delay, it goes to the block instead
|
||||
const hit = this.hit_result;
|
||||
if (scroll !== 0 && hit && EverythingRegistry.get_by_id<BlockRegistry>("blocks", hit.block)?.scrollable) {
|
||||
const { x, y, z, face } = hit;
|
||||
this.connection.send({ type: "scroll_block", x, y, z, face, hit: hit.hit, amount: scroll < 0 ? 1 : -1 });
|
||||
} else if (scroll > 0) {
|
||||
inventories.hotbar_selected = Math.min(8, inventories.hotbar_selected + 1);
|
||||
} else if (scroll < 0) {
|
||||
inventories.hotbar_selected = Math.max(0, inventories.hotbar_selected - 1);
|
||||
|
||||
Reference in New Issue
Block a user