书籍可附魔万物
一个 Minecraft 数据包,允许通过附魔书和铁砧(或 /enchant 命令)将任何附魔应用于任何物品。附魔桌仍保持原版行为。
这意味着你终于可以将耐久度附魔放在打火石上,火焰附加附魔放在铲子上,或者水下速掘附魔放在怪物头颅上。当然,你也可以尝试更实用的组合。
工作原理
通过将所有原版附魔的 supported_items(支持物品)属性覆盖为包含游戏中所有物品的标签来实现。
data/bcea/tags/item/all.json: 列出游戏中每个物品 ID 的物品标签(排除 air)。
data/minecraft/enchantment/*.json: 每个原版附魔定义的完整副本,仅将 supported_items 字段替换为 #bcea:all。其他所有内容(效果、消耗、权重、槽位、primary_items)均保持不变,因此附魔桌的行为未受影响,仅解除铁砧//enchant 的限制。
安装方法
将此文件夹放入世界目录下的 datapacks/ 中(或其资源包风格的 zip 文件),然后运行 /reload 或重启世界。
[!NOTE]
本数据包中的物品和附魔直接从原版客户端 jar 编译而来。因此,对于引入新物品/方块的非原版客户端,此数据包无法开箱即用。
下一节将说明如何为你的目标 Minecraft 版本更新此数据包。未来,我或许会将其自动化为 CI/CD 工作流,以便通过预编译发布支持所有近期 Minecraft 版本。
为新 Minecraft 版本进行更新
物品和附魔列表直接来自原版(或非原版)客户端 jar。本数据包包含两个脚本,用于重新生成数据包内容,从而轻松适配新的游戏版本。
这些脚本需要 Python 3,无需额外依赖。从数据包的根目录运行以下命令,并将原版客户端 jar 的路径作为参数传入:
python3 scripts/update_item_tag.py /path/to/client.jar
python3 scripts/update_enchantments.py /path/to/client.jar
# 可选:创建数据包的 zip 文件:
zip -r books-can-enchant-anything_VERSION.zip data pack.mcmeta pack.png
update_item_tag.py 从 jar 的 assets/minecraft/items/*.json 物品模型列表中重建 data/bcea/tags/item/all.json(每个真实物品都有一个模型;air 被有意排除)。
update_enchantments.py 通过将每个附魔直接从 jar 中复制来重建 data/minecraft/enchantment/*.json,然后仅修改 supported_items(更改为 #bcea:all)和 primary_items(添加,设置为附魔原本的原版 supported_items,如果 jar 中的副本尚不存在该字段)。这样附魔桌仍只显示原版可用的附魔列表,而铁砧//enchant 则完全放开限制。此外,它还会警告数据包中存在但 jar 中缺失的任何附魔 .json,以防上游移除了某个附魔。
Books Can Enchant Anything
A Minecraft data pack that lets any enchantment be applied to any item via enchanted book and anvil (or the /enchant command). Enchanting tables retain their vanilla behavior.
This means you can finally place Unbreaking on a flint and steel, Fire Aspect on a shovel, or Aqua Affinity on a mob head. Or more useful combinations, of course.
How it works
Works by overriding every vanilla enchantment's supported_items attribute to a tag that contains every item in the game.
data/bcea/tags/item/all.json: an item tag listing every item ID in the game (except air).
data/minecraft/enchantment/*.json: a full copy of each vanilla enchantment
definition with only the supported_items field replaced with #bcea:all.
Everything else (effects, costs, weights, slots, primary_items) is untouched,
so enchanting-table behavior is unchanged, only anvil//enchant restrictions
are lifted.
Installation
Drop this folder into your world's datapacks/ directory (or a resource-pack-style
zip of it), then run /reload or restart the world.
[!NOTE]
The items and enchantments in this pack are compiled directly from the vanilla client jar. Therefore, this pack does not work out-of-the-box with modded clients that introduce new items/blocks.
The next section explains how to update this pack for your desired version of Minecraft. In the future, perhaps I will automate this as a CI/CD workflow so that all of the recent Minecraft versions are supported with a pre-compiled release.
Updating for a new Minecraft version
The list of items and enchantments comes directly from a vanilla (or modded) client jar. Two scripts are included to regenerate this pack's contents so it can be easily updated for a new game version.
The scripts require Python 3 and no additional dependencies. Run these commands from the root of this pack's folder, passing the path to a vanilla client jar as an argument:
python3 scripts/update_item_tag.py /path/to/client.jar
python3 scripts/update_enchantments.py /path/to/client.jar
# Optionally create a zip of the pack:
zip -r books-can-enchant-anything_VERSION.zip data pack.mcmeta pack.png
update_item_tag.py rebuilds data/bcea/tags/item/all.json from the jar's assets/minecraft/items/*.json item model list (every real item has one; air is excluded on purpose).
update_enchantments.py rebuilds data/minecraft/enchantment/*.json by copying each enchantment straight from the jar, then only modifying supported_items (changed to #bcea:all) and primary_items (added, set to the enchantment's original vanilla supported_items, if the jar's copy doesn't already have one). This way enchanting tables still only show the vanilla list of available enchants, while anvil//enchant becomes fully permissive. It also warns about any enchantment .json present in the pack but missing from the jar, in case an enchantment was removed upstream.
评论 0
登录后参与评分
还没有评论,来抢沙发吧