Pathfinding search
This commit is contained in:
@@ -8,6 +8,7 @@ import { CHUNK_SIZE } from "@/common/constants.ts";
|
||||
import { is_within_view } from "@/common/chunk_streaming.ts";
|
||||
import { fluid_block, fluid_in_cell } from "@/common/utils.ts";
|
||||
import { biome_season } from "@/common/worldgen/biomes.ts";
|
||||
import { Tags } from "@/common/tags.ts";
|
||||
import type { ItemStack } from "@/common/inventory.ts";
|
||||
import type { EntityEvent, EntityInfo, ServerMessage } from "@/common/protocol.ts";
|
||||
import type { ServerPlayer } from "../player.ts";
|
||||
@@ -15,6 +16,7 @@ import type { ServerWorld } from "../world.ts";
|
||||
import type { DamageSource, Entity, EntityLevel, SavedEntity } from "./entity.ts";
|
||||
import { load_entity } from "./entity_types.ts";
|
||||
import { ItemEntity } from "./item_entity.ts";
|
||||
import { MOBS_PATH_THROUGH } from "./pathfinding.ts";
|
||||
import type { LivingEntity } from "./living_entity.ts";
|
||||
|
||||
// everything the entities need from the game server
|
||||
@@ -105,6 +107,15 @@ export class EntityManager implements EntityLevel {
|
||||
return this.#host.world.has_collision(x, y, z);
|
||||
}
|
||||
|
||||
has_chunk(chunk_x: number, chunk_z: number) {
|
||||
return this.#host.world.has_chunk(chunk_x, chunk_z);
|
||||
}
|
||||
|
||||
passes_through(x: number, y: number, z: number) {
|
||||
const block = this.#host.world.get_block_info(x, y, z);
|
||||
return block !== undefined && Tags.has("blocks", MOBS_PATH_THROUGH, block.id);
|
||||
}
|
||||
|
||||
collision_shape(x: number, y: number, z: number) {
|
||||
return this.#host.world.collision_shape(x, y, z);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user