? 熔炉 NBT 配方
? 用于处理带有高级 NBT / 组件支持的自定义熔炉配方的 Minecraft 数据包库!
允许使用 NBT 标签 / 组件创建复杂的熔炼配方。?️
? 使用方法
? 函数标签
该库提供了几个函数标签,可用于添加自定义配方:
? 熔炼、烧炼、熏制
使用的函数标签如下:
#furnace_nbt_recipes:v1/smelting_recipes: ? 在普通熔炉中的配方#furnace_nbt_recipes:v1/blasting_recipes: ⚒️ 在高炉中的配方(例如矿石)#furnace_nbt_recipes:v1/smoking_recipes: ? 在烟箱中的配方(例如食物)
? 在这些函数标签中的任意一个中,必须添加对自定义函数的调用,以处理配方。
✅ 每一行都应检查 #found 分数是否为 0,且输入项是否匹配你的配方。
? 如果匹配,它将在 container.3 槽位执行战利品表命令。
⚡ 来自 SimplEnergy 的示例:
# 将 'Raw Simplunium' 熔炼为 'Simplunium Ingot'
execute if score #found furnace_nbt_recipes.data matches 0 store result score #found furnace_nbt_recipes.data if data storage furnace_nbt_recipes:main input{"components": {"minecraft:custom_data": {"simplenergy": {"raw_simplunium": true}}}} run loot replace block ~ ~ ~ container.3 loot simplenergy:i/simplunium_ingot
#furnace_nbt_recipes:v1/disable_cooking
? 由于该库依赖于假配方,我们需要防止原版物品被熔炼 ⚠️
因此,你应该使用此函数标签来禁用它们,语法如下 ⬇️:
# 例如,如果自定义配方以命令方块为基础物品:
execute if score #reset furnace_nbt_recipes.data matches 0 store success score #reset furnace_nbt_recipes.data if data storage furnace_nbt_recipes:main input{"id":"minecraft:command_block"}
♻️ 与配方标签一样,它针对每种原料和熔炉类型运行一次,其结果会被所有持有该原料的熔炉复用:仅根据 input 和 #type 进行判断。
#furnace_nbt_recipes:v1/recipes_used
⚡ 配置玩家从熔炉取出物品时的经验值奖励。
? 经验值数量可以根据输入物品和熔炉类型进行自定义(? 普通熔炉,⚒️ 高炉,或 ? 烟箱)。
✨ 来自 SimplEnergy 的示例:
# 熔炼 'Raw Simplunium' 给予 0.8 经验值
execute if score #found furnace_nbt_recipes.data matches 0 store result score #found furnace_nbt_recipes.data if data storage furnace_nbt_recipes:main input{"components": {"minecraft:custom_data": {"simplenergy": {"raw_simplunium": true}}}} run function simplenergy:calls/furnace_nbt_recipes/xp_reward/0.8
#furnace_nbt_recipes:v1/configure_furnace
⚡ 仅在库开始跟踪熔炉时配置一次熔炉,这样配置后的熔炉后续无需额外开销。
? 它以熔炉标记实体的身份,在熔炉处运行,并设置 furnace_nbt_recipes.speed,单位为千分之一:1000 是原版速度,8000 烹饪速度快八倍,而 1200 烹饪速度快 1.2 倍。
? 使用千分之一的存在是为了让熔炉能够以小于一个刻的速度进行烹饪;剩余部分会在刻之间累积,因此即使是 1050 在整个配方过程中也能保持精确。
? 进度箭头在任何速度下都保持平滑,因为库将进度缩放到了它所持有的时钟上,而不是配方持续时间上。
✨ 示例,一个快八倍的电动熔炉:
# 作为标记实体运行,位于熔炉处:检查识别你方块的任意条件
execute if entity @e[tag=simplenergy.electric_smelter,distance=..1] run scoreboard players set @s furnace_nbt_recipes.speed 8000
? 如果熔炉内已经有一个实体,可以通过该实体进行跟踪,而不是使用标记实体:向其添加 furnace_nbt_recipes.furnace 标签,设置其 furnace_nbt_recipes.speed,并杀死库在其 0.75 格范围内已放置的任何标记实体。
? 配方格式
? 对于你制作的每个自定义配方,都需要添加一个配方,将其基础物品原料作为输入,并将结果的基础物品作为输出。
⏱️ cookingtime 字段是必需的,游戏会将其除以燃料的速度乘数:写入 200,普通熔炉需要十秒,而高炉或烟箱在使用原版燃料时需要五秒。
⚠️ 这部分非常混乱,我不希望人们使用这个库,所以这里提供 SimplEnergy 的示例。
⚙️ 烹饪驱动机制
? 库掌控着熔炉时钟:它将烹饪时间设定得足够高,使得原版配方永远无法自行完成,并在配方达到完整持续时间后替换为你的结果。
⛽ 速度来自燃料本身,无论是什么:具有 speed_multiplier 为 10 的自定义燃料,其烹饪速度正好快十倍,这与原版配方完全一致。
? 原版拒绝点燃输出槽中包含的物品与其自身配方结果无法堆叠的熔炉。库为其提供一个刻的空闲插槽,使其自行点燃并正常燃烧燃料,然后将物品放回。
? 两个自定义结果永远不会合并:只要输出槽中持有不同的物品,或者持有相同但没有空间容纳结果的物品,熔炉就会停止而不是将它们堆叠,直到槽位清空后恢复。
? 测试
? tests/ 中的 Ward 测试针对构建好的整合包运行:uvx "mcward[cli]" test -p build/FurnaceNbtRecipes_datapack.zip -p tests -v 26.3 "furnace_nbt_recipes_test:*"
? 对于 26.4 快照版本,请使用 -v 26.4-snapshot-7。首次运行时会启动一个 Ward 服务器并保持在线状态,以便后续运行只需一秒即可完成;使用 uvx "mcward[cli]" stop --all 可停止该服务器。
⭐ Star History
? Furnace NBT Recipes
? Minecraft datapack library for handling custom furnace recipes with advanced NBT / component support!
Enables creation of complex smelting recipes using NBT tags / components. ?️
? How to Use
? Function Tags
The library provides several function tags that you can use to add your custom recipes:
? Smelting, Blasting, Smoking
The function tags are the following:
#furnace_nbt_recipes:v1/smelting_recipes: ? Recipes in a classic furnace#furnace_nbt_recipes:v1/blasting_recipes: ⚒️ Recipes in a blast furnace (e.g. ores)#furnace_nbt_recipes:v1/smoking_recipes: ? Recipes in a smoker (e.g. food)
? In any of these function tags, you must add a call to a function you created that will handle the recipe.
✅ Each line should check if the #found score is 0 and the input matches your recipe.
? If so, it will run a loot table command in the container.3 slot.
⚡ Taken example from SimplEnergy:
# Smelt 'Raw Simplunium' into 'Simplunium Ingot'
execute if score #found furnace_nbt_recipes.data matches 0 store result score #found furnace_nbt_recipes.data if data storage furnace_nbt_recipes:main input{"components": {"minecraft:custom_data": {"simplenergy": {"raw_simplunium": true}}}} run loot replace block ~ ~ ~ container.3 loot simplenergy:i/simplunium_ingot
#furnace_nbt_recipes:v1/disable_cooking
? As the library stands on fake recipes, we need to prevent the default vanilla items from smelting ⚠️
Therefore, you should use this function tag to disable them with the following syntax ⬇️:
# For instance, if a custom recipe uses command block as a base item:
execute if score #reset furnace_nbt_recipes.data matches 0 store success score #reset furnace_nbt_recipes.data if data storage furnace_nbt_recipes:main input{"id":"minecraft:command_block"}
♻️ Like the recipe tags, it runs once per ingredient and furnace type, and its answer is reused by every furnace holding that ingredient: decide from input and #type only.
#furnace_nbt_recipes:v1/recipes_used
⚡ Configure XP rewards for your custom recipes when a player retrieves items from the furnace.
? The XP amount can be customized based on the input item and furnace type (? regular furnace, ⚒️ blast furnace, or ? smoker).
✨ Taken example from SimplEnergy:
# Give 0.8 XP for smelting 'Raw Simplunium'
execute if score #found furnace_nbt_recipes.data matches 0 store result score #found furnace_nbt_recipes.data if data storage furnace_nbt_recipes:main input{"components": {"minecraft:custom_data": {"simplenergy": {"raw_simplunium": true}}}} run function simplenergy:calls/furnace_nbt_recipes/xp_reward/0.8
#furnace_nbt_recipes:v1/configure_furnace
⚡ Configure a furnace once, the tick the library starts tracking it, so a configured furnace costs nothing extra afterwards.
? It runs as the furnace's marker entity, at the furnace, and sets furnace_nbt_recipes.speed, given per thousand: 1000 is the vanilla pace, 8000 cooks eight times faster, and 1200 cooks 1.2 times faster.
? Thousandths exist so a furnace can cook at a fraction of a tick per tick; the leftover is carried between ticks, so even 1050 stays exact over a whole recipe.
? The progress arrow stays smooth at any speed, because the library scales progress onto the clock it holds rather than onto the recipe duration.
✨ Example, an electric smelter that smelts eight times faster:
# Run as the marker, at the furnace: check whatever identifies your block
execute if entity @e[tag=simplenergy.electric_smelter,distance=..1] run scoreboard players set @s furnace_nbt_recipes.speed 8000
? A block that already has an entity inside the furnace can be tracked through it instead of a marker: add the furnace_nbt_recipes.furnace tag to it, set its furnace_nbt_recipes.speed, and kill any marker the library already placed within 0.75 blocks of it.
? Recipe Format
? For each custom recipe you make, you'll need to add a recipe that take the base item ingredient as ingredient and result the base item of the result.
⏱️ The cookingtime field is mandatory, and the game divides it by the speed multiplier of the fuel: write 200 and a furnace takes ten seconds, while a blast furnace or a smoker on vanilla fuel takes five.
⚠️ This part is really wanky and I don't want people to use this library so here is a link to SimplEnergy's example.
⚙️ How the cooking is driven
? The library owns the furnace clock: it holds the cooking time high enough that the vanilla recipe can never complete on its own, and swaps in your result once the recipe has had its full duration.
⛽ The pace comes from the fuel, whatever it is: a custom fuel with a speed_multiplier of 10 cooks ten times faster, exactly as it would for a vanilla recipe.
? Vanilla refuses to light a furnace whose output slot holds an item its own recipe result cannot stack with. The library hands it a free slot for one tick so it lights itself and burns its fuel normally, then puts the item back.
? Two custom results never merge: while the output slot holds a different item, or the same one without room for the result, the furnace stops instead of stacking them, and resumes once the slot is cleared.
? Tests
? The Ward tests in tests/ run against the built pack: uvx "mcward[cli]" test -p build/FurnaceNbtRecipes_datapack.zip -p tests -v 26.3 "furnace_nbt_recipes_test:*"
? Use -v 26.4-snapshot-7 for the 26.4 snapshot. The first run starts a Ward server that stays up so the next runs take a second, and uvx "mcward[cli]" stop --all stops it.
⭐ Star History
下载 Furnace NBT Recipes
下载 Furnace NBT Recipes
下载 Furnace NBT Recipes
下载 Furnace NBT Recipes
下载 Furnace NBT Recipes
下载 Furnace NBT Recipes
下载 Furnace NBT Recipes
下载 Furnace NBT Recipes
下载 Furnace NBT Recipes
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
数据包
一个 Minecraft 光线投射库,能够精确检测玩家正在查看的方块,包括像台阶和楼梯这样的特殊方块形状。
数据包
> Fokus / Focus API - CoffeeG 的数据包/模组/插件库。
数据包
这是《Minecraft》的一款模组,旨在将游戏体验转变为更接近现实生活的样子。它包含了诸如需求管理(饥饿、健康、能量)、经济系统、工作以及与其他玩家互动的功能。
数据包
添加 Better Villages 与 Immersive Engineering 之间的兼容性
数据包
性能极佳的 AFK/挂机检测 · 玩家在不移动鼠标 3 分钟后进入 AFK 状态(可配置)· 可通过丰富的插件进行扩展!
数据包
作为数据包和资源包,包含《使命召唤》风格的游戏模式和僵尸模式。
评论 0
登录后参与评分
还没有评论,来抢沙发吧