一个用于查询服务器中实体/生物数量和定位实体/生物位置的 LeviLamina 插件。
- 查询实体数量: 统计当前加载区块中所有实体或指定类型实体的数量
- 定位实体位置: 获取指定类型实体的坐标位置
- 坐标合并: 自动合并相邻坐标(±5格范围内)的相同实体,显示群落数量
- GUI面板: 提供友好的图形界面查询
| 命令 | 描述 |
|---|---|
/mobcount |
查询实体总数与生物总数 |
/mobcount <type> |
查询指定类型实体数量 |
/moblocate <type> |
定位指定类型实体的位置 |
/mobmenu |
打开GUI查询面板 |
<type>: 实体类型标识符,如minecraft:zombie、minecraft:creeper、minecraft:item等
配置文件位于 plugins/MobLocator/config.json:
{
"version": 1,
"language": "zh_CN",
"maxDisplayCount": 50,
"mergeRadius": 5
}maxDisplayCount: 最大显示数量,防止刷屏mergeRadius: 坐标合并半径,范围内相同生物会被合并显示
/mobcount # 显示实体总数与生物总数
/mobcount minecraft:zombie # 查询僵尸数量
/moblocate minecraft:creeper # 定位爬行者
/moblocate minecraft:item # 定位掉落物
/mobmenu # 打开GUI面板
实体总数:1234
生物总数:890
=== minecraft:zombie 位置 ===
总计: 256 个
-------------------
[主世界] (100.5, 64.0, -200.3) x5
[主世界] (150.2, 32.0, -180.7) x3
[下界] (-50.0, 45.0, 100.5) x2
...
其他插件可查询当前 上一 tick 发生 tick 的已加载实体(与命令一致,非全图未加载实体)。
| 接口 | 是否排除玩家 | 匹配方式 |
|---|---|---|
getTotalEntityCount / getLivingMobCount / getAllCounts / listTypes |
是 | — |
countByType / locate |
否(按类型精确匹配) | getTypeName() 全等,如 minecraft:zombie |
locate:同维度、合并半径内的同类型位置会合并;count 为群落数量;maxCount 限制返回的群落条数。
接口头:src/api/IMobLocatorApi.h、src/api/Types.h
#include "api/IMobLocatorApi.h"
#include "ll/api/service/ServiceManager.h"
auto api = ll::service::ServiceManager::getInstance().getService<MobLocator::IMobLocatorApi>();
if (api) {
int n = (*api)->countByType("minecraft:zombie");
auto locs = (*api)->locate("minecraft:zombie", 5, 50);
}也可 subscribeService<IMobLocatorApi> 等待晚加载。
需安装 LegacyRemoteCall(LSE 依赖)。命名空间:MobLocator。
| 导出名 | 参数 | 返回 |
|---|---|---|
getTotalEntityCount |
— | number |
getLivingMobCount |
— | number |
countByType |
typeName: string |
number |
getAllCounts |
— | object(类型 → 数量) |
listTypes |
— | string[] |
locate |
typeName, mergeRadius, maxCount |
{x,y,z,dim,count}[] |
mc.listen("onServerStarted", () => {
if (!ll.hasExported("MobLocator", "countByType")) {
logger.error("MobLocator API 不可用");
return;
}
const countByType = ll.imports("MobLocator", "countByType");
const locate = ll.imports("MobLocator", "locate");
logger.info(countByType("minecraft:zombie"));
logger.info(JSON.stringify(locate("minecraft:zombie", 5, 50)));
});脚本侧无默认参数,locate 请显式传入 mergeRadius(如 5)和 maxCount(如 50)。
- LeviLamina 26.10.14+(对应 BDS 26.10.4)
- Minecraft Bedrock Dedicated Server 26.10.4
- (可选)LegacyRemoteCall — 供 LSE / RemoteCall 调用
- 将编译产物的
MobLocator.dll放入plugins/MobLocator/目录 - 将
manifest.json放入同一目录 - 重启服务器
xmake f -c
xmake f --target_type=server
xmake
xmake installMIT License