Mmc秒杀圈百科 

EntityCommand:查看版本 v1

由 朝武芳乃 于 2026-10-04 01:01 保存 · 977 字节
''本条基于 Minecraft 1.20.1 + Forge,Mojang 映射名。'' '''EntityCommand'''(<code>net.minecraftforge.server.command.EntityCommand</code>)是 Forge 提供的 <code>/forge entity list [过滤器] [维度]</code> 指令实现,用来统计某个维度中各类实体的数量和分布。 == /forge entity list 链路 == <code>EntityCommand</code> → [[ServerLevel]]<code>.getEntities()</code> → [[LevelEntityGetterAdapter]]<code>.getAll()</code> → [[Iterable.forEach]] → 用 [[Map]] 汇总 == 与实体储存的关系 == * 数据来源是 <code>getAll()</code>,即 [[EntityLookup]] 的 [[Int2ObjectMap]] <code>byId</code>,只统计当前已加载(可见)的实体。 * 先按实体类型注册名分组,再按 <code>ChunkPos</code> 统计每个区块的数量;过滤器支持 <code>*</code>、<code>?</code> 通配。 * 不读 [[EntityTickList]],所以不 tick 的实体也会被计入;不在 <code>byId</code> 里的实体则不会出现。

其他版本