使用 Fabric 在运行时构建数据包和资源包。
Packwright 让 Fabric 模组能够使用纯 Java 构建器来生成打包资源,而无需维护庞大的 JSON 文件集合。
它支持包括以下在内的资源和数据:
- 方块和物品模型
- 方块状态(Blockstates)
- 语言文件
- 战利品表(Loot tables)
- 合成配方(Recipes)
- 进度(Advancements)
- 标签(Tags)
- 谓词(Predicates)
- 物品修饰符(Item modifiers)
- 附魔(Enchantments)
- 对话(Dialogs)
- 实体变体(Entity variants)
- 世界生成,包括生物群系、维度、特性、雕刻器、材质规则、结构和噪声设置
内容模组可以直接从 Java 代码中生成其几乎所有的资源,仅保留常规的模组元数据以及任何选择正常捆绑的资源。
Packwright 是 ARRP —— Advanced Runtime Resource Packs —— 的一个经过大量重写的分支,该项目最初由 HalfOf2/Devan-Kerman 创建。它保留了 ARRP 的核心概念,同时为现代 Minecraft 版本替换了构建器 API、编解码器(codecs)、注册表和世界生成功能的支持。
添加 Packwright
dependencies {
modImplementation("net.vampirestudios:packwright:1.0.0+build.1-<minecraft-version>")
}
此依赖声明适用于 Groovy 和 Kotlin Gradle DSL。
快速开始
RuntimeResourcePack pack = RuntimeResourcePack.create("mymod:pack");
pack.addLootTable(
Identifier.of("mymod", "blocks/ruby_ore"),
LootTable.block()
.pool(Pool.of()
.rolls(1)
.entry(Entry.item("mymod:ruby"))
.condition(Condition.survivesExplosion()))
);
PackwrightCallback.BEFORE_VANILLA.register(resources -> resources.add(pack));
生成的包也可以导出到磁盘作为标准的、可直接使用的数据包或资源包。
请参阅 dump() 方法以及 src/test/java/test/ 下的示例。完整的自定义维度示例可在 EmberWastesWorldgen 和 SkyIslandsWorldgen 中找到,同时也提供了其他资源类型的示例。
配置
Packwright 在首次启动时会创建 config/packwright.properties 文件。
每个设置也可以通过以下方式针对单个运行进行覆盖:
-Dpackwright.<key>=<value>
| Key |
默认值 |
描述 |
threads |
可用处理器核心数的一半 |
用于资源生成的工作线程数 |
dump_on_close |
false |
关闭时导出包的内容 |
dump_directory |
packwright.debug |
用于生成包导出的目录 |
debug_performance |
false |
记录锁等待和性能信息 |
pretty_json |
true |
对生成的 JSON 进行格式化输出 |
常见问题
Packwright 与常规资源包兼容吗?
是的。Packwright 通过 Minecraft 的标准包系统注入生成的包。
生成的包直接放置在 Minecraft 内置资源的上方,允许它们覆盖原版资产。当其他模组提供的资源包或玩家选择的资源包具有更高优先级时,它们仍然可以覆盖 Packwright 生成的资产。
如何从 ARRP 迁移?
首先进行以下替换:
net.vampirestudios.arrp 或 net.devtech.arrp → net.vampirestudios.packwright
RRPCallback → PackwrightCallback
rrp:pregen 入口点 → packwright:pregen
现有的 rrp.properties 和 arrp.properties 配置文件会自动迁移。
由于 Packwright 大幅重写了 ARRP 的构建器 API,某些生成资源的代码可能需要进行额外的更改。有关完整列表,请参阅更新日志和迁移文档。
Build data packs and resource packs at runtime with Fabric.
Packwright lets Fabric mods generate pack resources using plain Java builders instead of maintaining large collections of JSON files.
It supports assets and data including:
- Block and item models
- Blockstates
- Language files
- Loot tables
- Recipes
- Advancements
- Tags
- Predicates
- Item modifiers
- Enchantments
- Dialogs
- Entity variants
- World generation, including biomes, dimensions, features, carvers, material rules, structures, and noise settings
A content mod can generate nearly all of its resources directly from Java, leaving only its regular mod metadata and any resources it chooses to bundle normally.
Packwright is a heavily rewritten fork of ARRP — Advanced Runtime Resource Packs — originally created by HalfOf2/Devan-Kerman. It retains ARRP’s core concept, while replacing the builder API, codecs, registries, and world-generation support for modern Minecraft versions.
Adding Packwright
dependencies {
modImplementation("net.vampirestudios:packwright:1.0.0+build.1-<minecraft-version>")
}
This dependency declaration works with both the Groovy and Kotlin Gradle DSLs.
Quick start
RuntimeResourcePack pack = RuntimeResourcePack.create("mymod:pack");
pack.addLootTable(
Identifier.of("mymod", "blocks/ruby_ore"),
LootTable.block()
.pool(Pool.of()
.rolls(1)
.entry(Entry.item("mymod:ruby"))
.condition(Condition.survivesExplosion()))
);
PackwrightCallback.BEFORE_VANILLA.register(resources -> resources.add(pack));
Generated packs can also be dumped to disk as standard, ready-to-use data packs or resource packs.
See the dump() methods and the examples under src/test/java/test/. Complete custom-dimension examples are available in EmberWastesWorldgen and SkyIslandsWorldgen, alongside examples for other resource types.
Configuration
Packwright creates config/packwright.properties on first launch.
Every setting can also be overridden for an individual run using:
-Dpackwright.<key>=<value>
| Key |
Default |
Description |
threads |
Half of the available processor cores |
Worker threads used for resource generation |
dump_on_close |
false |
Dump a pack’s contents when it is closed |
dump_directory |
packwright.debug |
Directory used for generated pack dumps |
debug_performance |
false |
Log lock-wait and performance information |
pretty_json |
true |
Pretty-print generated JSON |
FAQ
Is Packwright compatible with regular resource packs?
Yes. Packwright injects generated packs through Minecraft’s normal pack system.
Generated packs are placed directly above Minecraft’s built-in resources, allowing them to override vanilla assets. Resource packs supplied by other mods or selected by the player can still override Packwright-generated assets when they have a higher priority.
How do I migrate from ARRP?
Start by making the following replacements:
net.vampirestudios.arrp or net.devtech.arrp → net.vampirestudios.packwright
RRPCallback → PackwrightCallback
rrp:pregen entrypoint → packwright:pregen
Existing rrp.properties and arrp.properties configuration files are migrated automatically.
Because Packwright substantially rewrites ARRP’s builder APIs, some generated-resource code may require additional changes. See the changelog and migration documentation for the complete list.
评论 0
登录后参与评分
还没有评论,来抢沙发吧