Remove collision from water

This commit is contained in:
2026-09-25 17:21:46 -03:00
parent d07528bd0e
commit 05f80c81ad
9 changed files with 26 additions and 7 deletions
+1 -1
View File
@@ -829,7 +829,7 @@ export class GameServer {
if (this.#entities.size === 0) {
return;
}
const is_solid = (x: number, y: number, z: number) => this.world.get_block_nid(x, y, z) !== AIR;
const is_solid = (x: number, y: number, z: number) => this.world.has_collision(x, y, z);
const active = [...this.#entities.values()].filter((entity) => this.#near_any_player(entity.x, entity.z));
for (const entity of active) {
+5
View File
@@ -113,6 +113,11 @@ export class ServerWorld {
return this.#get_chunk(chunk_x, chunk_z)[index_in_chunk(x, y, z, chunk_x, chunk_z)];
}
// whether entities bump into the block there, water and other blocks with "collision": false don't
has_collision(x: number, y: number, z: number) {
return this.get_block_info(x, y, z)?.has_collision ?? false;
}
get_block_info(x: number, y: number, z: number): BlockRegistry | undefined {
const nid = this.get_block_nid(x, y, z);
return nid === AIR ? undefined : EverythingRegistry.get_by_id<BlockRegistry>("blocks", nid);