Basic swimming

This commit is contained in:
2026-10-01 21:12:30 -03:00
parent 6e5703a482
commit d5015edfa1
10 changed files with 203 additions and 20 deletions
+7
View File
@@ -7,6 +7,7 @@ import {
block_light_opacity,
BlockRegistry,
EverythingRegistry,
is_liquid_block,
RENDER_LAYERS,
RenderLayer,
} from "$/common/everything_registry.ts";
@@ -302,6 +303,12 @@ export class ClientLevel {
return block === VOID || (block !== AIR && (this.#blocks[block]?.has_collision ?? true));
}
// water, see is_liquid_block. unloaded chunks aren't
is_liquid(x: number, y: number, z: number) {
const block = this.get_block(x, y, z);
return block !== VOID && block !== AIR && is_liquid_block(this.#blocks[block]);
}
// only changes what this client shows, drops and everything else happen on the server
break_block(x: number, y: number, z: number) {
const block_chunk_x = Math.floor(x / CHUNK_SIZE);