Package net.fabricmc.loom.spec
Record Class EnvironmentSpec
java.lang.Object
java.lang.Record
net.fabricmc.loom.spec.EnvironmentSpec
- All Implemented Interfaces:
Serializable
public record EnvironmentSpec(String minecraftVersion, MinecraftVersionMeta versionMeta, EnvironmentSpec.LoaderSpec loader, EnvironmentSpec.MappingDefinition mappings, List<EnvironmentSpec.PipelineStep> pipeline)
extends Record
implements Serializable
环境规格:配置期唯一被读的「小数据」.
本类型是把环境供给从配置期搬到执行期的**接缝**。当前配置期存在的环是:
配置本项目 → 需要 mapped MC jar(mod 重映射的 classpath)
→ jar 需任务产出 → 任务需所有项目配置完成 → 回到起点
破环的办法不是「让配置期更快地生产 jar」,而是把「依赖图需要的」与「产物需要的」分开: 前者只需要**配方**,后者才是重活。本类型承载前者。
为什么 mappings 是配方而不是产物
mappings 描述「用哪套基础映射、什么迁移规则、目标命名空间」,而不是算好的映射文件。
所以它不需要任何产物存在就能构造——这正是环被切断的地方。
不可序列化的部分
versionMeta 是已解析的版本元数据对象。它由版本清单与 minecraft_info.json
派生,二者都通过 SpecStore 按内容身份缓存,因此重复构造的成本是一次 JSON 反序列化,
而不是「网络 + 全文解析」。这也是本类型可以安全地被配置缓存序列化的前提。
边界
本类型**不含**产物路径、不含任务引用、不含Project。产物由 L3 流水线的任务声明,
通过 Provider 接线给下游,配置期不触碰文件系统。- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final record加载器规格.static final record映射配方:**怎么算**,而不是**算出来的东西**.static enum流水线步骤:平台差异的表达处. -
Constructor Summary
ConstructorsConstructorDescriptionEnvironmentSpec(String minecraftVersion, MinecraftVersionMeta versionMeta, EnvironmentSpec.LoaderSpec loader, EnvironmentSpec.MappingDefinition mappings, List<EnvironmentSpec.PipelineStep> pipeline) Creates an instance of aEnvironmentSpecrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.Returns 流水线中最后一个产出可被依赖的 jar 的步骤.final inthashCode()Returns a hash code value for this object.loader()Returns the value of theloaderrecord component.mappings()Returns the value of themappingsrecord component.Returns the value of theminecraftVersionrecord component.booleanReturns 该平台是否需要在重映射之前先做映射迁移.pipeline()Returns the value of thepipelinerecord component.final StringtoString()Returns a string representation of this record class.Returns the value of theversionMetarecord component.
-
Constructor Details
-
EnvironmentSpec
public EnvironmentSpec(String minecraftVersion, MinecraftVersionMeta versionMeta, EnvironmentSpec.LoaderSpec loader, EnvironmentSpec.MappingDefinition mappings, List<EnvironmentSpec.PipelineStep> pipeline) Creates an instance of aEnvironmentSpecrecord class.- Parameters:
minecraftVersion- the value for theminecraftVersionrecord componentversionMeta- the value for theversionMetarecord componentloader- the value for theloaderrecord componentmappings- the value for themappingsrecord componentpipeline- the value for thepipelinerecord component
-
-
Method Details
-
needsMappingMigration
public boolean needsMappingMigration()Returns 该平台是否需要在重映射之前先做映射迁移..Forge 系的最终映射依赖「打补丁后的中间产物」,因此迁移是一个独立的流水线节点, 它的输入是
EnvironmentSpec.PipelineStep.APPLY_LOADER_PATCHES的输出——这是 DAG,不是环。- Returns:
- 该平台是否需要在重映射之前先做映射迁移
-
finalJarStep
Returns 流水线中最后一个产出可被依赖的 jar 的步骤..供 L1 接线时判断「应当把哪个步骤的输出挂进 configuration」。
- Returns:
- 流水线中最后一个产出可被依赖的 jar 的步骤
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
minecraftVersion
Returns the value of theminecraftVersionrecord component.- Returns:
- the value of the
minecraftVersionrecord component
-
versionMeta
Returns the value of theversionMetarecord component.- Returns:
- the value of the
versionMetarecord component
-
loader
Returns the value of theloaderrecord component.- Returns:
- the value of the
loaderrecord component
-
mappings
Returns the value of themappingsrecord component.- Returns:
- the value of the
mappingsrecord component
-
pipeline
Returns the value of thepipelinerecord component.- Returns:
- the value of the
pipelinerecord component
-