Change how targetting liquids work

This commit is contained in:
2026-10-07 17:48:50 -03:00
parent ff53d30a7e
commit b128da0631
13 changed files with 42 additions and 18 deletions
+3 -3
View File
@@ -34,7 +34,7 @@ export class MultiPlayerGameMode {
// called every tick the attack button is held on a block
continue_destroy_block(hit: BlockHitResult) {
const block_info = EverythingRegistry.get_by_id<BlockRegistry>("blocks", hit.block)!;
const tool = this.#held_item()?.tool;
const tool = this.held_item()?.tool;
// looking at another block starts it over
const pos = this.destroy_pos;
@@ -75,7 +75,7 @@ export class MultiPlayerGameMode {
const current = level.get_block(target.x, target.y, target.z);
const below = level.get_block(target.x, target.y - 1, target.z);
const below_id = EverythingRegistry.get_by_id<BlockRegistry>("blocks", below)?.id ?? AIR_ID;
const held = this.#held_item();
const held = this.held_item();
// items with components might do something else on the server, like on_use
const place_id = held?.components ? undefined : held?.block_id;
const place_block = place_id !== undefined
@@ -150,7 +150,7 @@ export class MultiPlayerGameMode {
return inventories.inventory.get_slot(inventories.hotbar_selected);
}
#held_item() {
held_item() {
return EverythingRegistry.get<ItemRegistry>("items", this.#held_slot().type_id ?? "");
}
}