Extended World

基本信息

com.mitchej123.supernova.api.ExtendedWorld 与内部子接口 com.mitchej123.supernova.world.SupernovaWorld —— mixin 注入 net.minecraft.world.World 的光照扩展点。

接口 文件 性质
ExtendedWorld api/ExtendedWorld.java 公开 API
SupernovaWorld world/SupernovaWorld.java 内部(SupernovaWorld extends ExtendedWorld)

ExtendedWorld 的两个方法

方法 行 返回
supernova$getAnyChunkImmediately(int chunkX, int chunkZ) 17 Chunk,未加载返回 null
supernova$hasChunkPendingLight(int chunkX, int chunkZ) 26 boolean

getAnyChunkImmediately 的 null 语义很重要:它不触发区块加载, 返回值只表示「此刻是否已在内存中」。

hasChunkPendingLight 覆盖两条 lane(方块光与天光)中 任一者的排队或执行中状态。

SupernovaWorld 额外暴露的引擎句柄

方法 行 说明
supernova$getLightManager() 13 惰性构造并返回 WorldLightManager
supernova$lightManagerIfPresent() 16 只读已存在字段,不惰性构造
supernova$shutdown() 18 关闭,闩死

supernova$shutdown 是闩锁(源码 Latched by supernova$shutdown): 每个 World 对象一生中至多一个 manager,关闭后永远为 null。

lightManagerIfPresent 存在的理由写在源码注释里: 区块保存发生在 shutdown 之后是可能的,若走 getLightManager() 的 惰性构造路径,会复活 manager 及其工作线程。

相关条目

源码

  • src/main/java/com/mitchej123/supernova/api/ExtendedWorld.java
  • src/main/java/com/mitchej123/supernova/world/SupernovaWorld.java