custom crafter
custom crafter 是适用于 PaperMC 服务器的自定义配方插件,同时也是一个用于从你的插件中定义自定义配方的库(API)。
从你的插件中自由定义自定义配方,为游戏引入新元素。
功能特性
- 原版物品的自定义配方 — 为现有的 Minecraft 物品添加新配方。
- 自定义物品支持 — 使用由你的插件创建的物品作为结果或材料。
- 材料管理命令 — 供服务器管理员管理配方材料。
- 自动集成 — 注册的配方会自动出现在玩家的合成环境中,无需额外设置。
- 原版合成继续正常工作,不受影响。
演示
合成演示视频
- 放置基础方块 (
GOLD_BLOCK)。 - 合成
infinityIronBlockCore(配方定义)。 - 将铁块压缩成
infinityIronBlock(配方定义)。 - 重复执行相同的配方。
- 再次重复。
- 使用
infinityIronBlockExtract提取无限铁块 (配方定义)。

克隆 仓库 并运行以下命令以构建包含上述配方的演示插件,以及几个其他配方:
mvn -pl demo package
生成的 jar 文件已准备好放入服务器的 plugins 目录,输出路径为 demo/target。
支持环境
| Custom_Crafter 版本 | Paper 版本 |
|---|---|
| 5.4.0 (最新) | 1.21.4 ~ 1.21.11, 26.1.x |
| 5.0.13 ~ 5.0.21, 5.1.0 ~ 5.3.0 | 1.21.4 ~ 1.21.11, 26.1.x |
| 5.0.0 ~ 5.0.11 | 1.21.3 |
| 4.3 (旧版) | 1.21.3 |
| 4.2 (旧版) | 1.20.1 ~ 1.20.4 |
最低支持的 Paper 版本在发布之间很少更改,因此建议使用最新版本。
注意: custom crafter 不能在 Spigot/Bukkit 上运行。请使用 PaperMC 或其分支。
使用 API
自 5.0.0 版本起,custom crafter 也可用作 API,允许从你自己的插件中定义和注册自定义配方。
文档
要在本地构建文档:
mvn -pl api dokka:dokka # KDoc
mvn -pl api dokka:javadoc # Javadoc
依赖项
依赖于 CustomCrafterAPI 的插件必须在 plugin.yml 的 depend 下列出 Custom_Crafter:
depend:
- "Custom_Crafter"
最新版本:5.4.0 (Maven Central)
假设运行时存在 CustomCrafter 插件,因此请将其依赖范围设置为仅编译时——如果你的插件是用 Kotlin 编写的,Kotlin 标准库也是如此。
各构建工具中仅编译时范围的名称:
- Maven:
provided - Gradle:
compileOnly
Maven
<!-- CustomCrafterAPI -->
<dependency>
<groupId>io.github.sakaki-aruka</groupId>
<artifactId>custom-crafter-api</artifactId>
<version>5.4.0</version>
<scope>provided</scope>
</dependency>
<!-- kotlin-stdlib -->
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>2.3.0</version>
<scope>provided</scope>
</dependency>
Gradle (Groovy)
dependencies {
compileOnly 'io.github.sakaki-aruka:custom-crafter-api:5.4.0'
compileOnly 'org.jetbrains.kotlin:kotlin-stdlib:2.3.0' // if using Kotlin
}
Gradle (Kotlin DSL)
dependencies {
compileOnly("io.github.sakaki-aruka:custom-crafter-api:5.4.0")
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:2.3.0") // if using Kotlin
}
服务器安装
custom crafter 使用 Kotlin 编写。
- 下载插件 jar 并将下载的文件放入你的
plugins目录。 - 启动或重载服务器。
- 在标准工作台正下方的 3x3 区域内放置基础方块——仅放置一个标准工作台不足以启用自定义配方。默认基础方块是
GOLD_BLOCK。
代码示例
兼容性检查
检查你的插件所依赖的 CustomCrafterAPI 版本是否与服务器上运行的版本兼容:
class YourPlugin : JavaPlugin() {
val dependVersion = Triple(5, 3, 0)
@Override
fun onEnable() {
if (CustomCrafterAPI.MAJOR_VERSION == dependVersion.first
&& CustomCrafterAPI.MINOR_VERSION >= dependVersion.second) {
return
}
Bukkit.pluginManager.disablePlugin(this)
}
}
定义配方
自定义配方由三个部分组成:
- 材料 (
CMatter) — 合成的输入要求。 - 结果 (
ResultSupplier) — 成功合成后产生的物品。 - 配方 (
CRecipe) — 结合材料、结果和形状(形状化/无形状化)进行注册。
1. 材料 (CMatter)
CMatter 定义了物品、数量以及放置位置。请使用 CMatterImpl 或你自己实现的 CMatter。
接受 1 个石头或 1 个圆石:
val matter: CMatter = CMatterImpl(
name = "test-matter",
candidate = setOf(Material.STONE, Material.COBBLESTONE),
amount = 1,
anyAmount = false, // true: 允许在一组物品中满足数量要求
predicates = null // 额外的 NBT 或其他条件
)
对于简单的候选材料集合,of 方法更简洁:
val matter: CMatter = CMatterImpl.of(Material.STONE, Material.COBBLESTONE)
2. 结果 (ResultSupplier)
ResultSupplier 接收合成上下文(Config)并返回输出物品。如果不需要物品结果,可以使用命令执行代替。
val supplier = ResultSupplier { config ->
// 'config' 包含合成上下文:玩家、工作台等
emptyList<ItemStack>()
}
辅助方法涵盖了常见情况:
// 始终返回 1 个石头
val supplier = ResultSupplier.single(ItemStack.of(Material.STONE))
// 根据单次操作中合成的物品数量缩放输出(例如点击-shift)
val supplier2 = ResultSupplier.timesSingle(ItemStack.of(Material.STONE))
3. 配方 (CRecipe)
CRecipeImpl 将材料和结果组合成一个可注册的配方。
val recipe: CRecipe = CRecipeImpl(
name = "test-recipe",
items = mapOf(CoordinateComponent(0, 0) to matter),
containers = null, // 额外条件,例如权限
results = setOf(ResultSupplier.timesSingle(Material.STONE)),
type = CRecipe.Type.NORMAL
)
items: 将网格坐标(CoordinateComponent(x, y))映射到所需的CMatter。type:CRecipe.Type.NORMAL是形状配方,坐标具有意义;CRecipe.Type.AMORPHOUS是无形状配方,坐标值可以是任意的。
许可证
MIT 许可证
版权所有 (c) 2023 - 2026 Sakaki-Aruka
特此免费授予任何获得本软件及相关文档文件(以下简称“本软件”)副本的人不受限制地处理本软件的权利,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或出售本软件副本的权利,并允许有权持有本软件的人这样做,但需遵循以下条件:
上述版权声明和本许可声明应包含在本软件的所有副本或主要部分中。
本软件按“原样”提供,不提供任何形式的明示或暗示保证,包括但不限于对适销性、特定用途适用性和不侵权的保证。在任何情况下,作者或版权持有人均不对因本软件或使用本软件或其他交易引起的任何索赔、损害或其他责任负责,无论是在合同诉讼、侵权诉讼还是其他诉讼中。
custom crafter
custom crafter is a custom recipe plugin for PaperMC servers, and also a library (API) for defining custom recipes from your own plugin.
Define custom recipes freely from your plugin and introduce new elements into the game.
Features
- Custom recipes for vanilla items — add new recipes for existing Minecraft items.
- Custom item support — use items created by your plugin as results or materials.
- Material management commands — for server administrators managing recipe materials.
- Automatic integration — registered recipes appear in players' crafting environment without extra setup.
- Vanilla crafting continues to work unmodified.
Demo
Crafting demo video
- Place base blocks (
GOLD_BLOCK). - Craft
infinityIronBlockCore(recipe definition). - Compress an iron block into
infinityIronBlock(recipe definition). - Repeat with the same recipe.
- Repeat again.
- Extract the infinity iron block with
infinityIronBlockExtract(recipe definition).

Clone the repository and run the following command to build a demo plugin containing the recipes shown above, along with several others:
mvn -pl demo package
The resulting jar, ready to be placed in a server's plugins directory, is written to demo/target.
Supported Environments
| Custom_Crafter Version | Paper Version |
|---|---|
| 5.4.0 (latest) | 1.21.4 ~ 1.21.11, 26.1.x |
| 5.0.13 ~ 5.0.21, 5.1.0 ~ 5.3.0 | 1.21.4 ~ 1.21.11, 26.1.x |
| 5.0.0 ~ 5.0.11 | 1.21.3 |
| 4.3 (legacy) | 1.21.3 |
| 4.2 (legacy) | 1.20.1 ~ 1.20.4 |
The minimum supported Paper version rarely changes between releases, so using the latest release is recommended.
Note: custom crafter does not run on Spigot/Bukkit. Use PaperMC or a Paper fork.
Using the API
Since version 5.0.0, custom crafter also works as an API for defining and registering custom recipes from your own plugin.
Documentation
To build the documentation locally:
mvn -pl api dokka:dokka # KDoc
mvn -pl api dokka:javadoc # Javadoc
Dependency
Plugins depending on CustomCrafterAPI must list Custom_Crafter under depend in plugin.yml:
depend:
- "Custom_Crafter"
Latest version: 5.4.0 (Maven Central)
The CustomCrafter plugin is assumed to be present at runtime, so set its dependency scope to compile-time only — the same applies to the Kotlin stdlib if your plugin is written in Kotlin.
Compile-time-only scope name by build tool:
- Maven:
provided - Gradle:
compileOnly
Maven
<!-- CustomCrafterAPI -->
<dependency>
<groupId>io.github.sakaki-aruka</groupId>
<artifactId>custom-crafter-api</artifactId>
<version>5.4.0</version>
<scope>provided</scope>
</dependency>
<!-- kotlin-stdlib -->
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>2.3.0</version>
<scope>provided</scope>
</dependency>
Gradle (Groovy)
dependencies {
compileOnly 'io.github.sakaki-aruka:custom-crafter-api:5.4.0'
compileOnly 'org.jetbrains.kotlin:kotlin-stdlib:2.3.0' // if using Kotlin
}
Gradle (Kotlin DSL)
dependencies {
compileOnly("io.github.sakaki-aruka:custom-crafter-api:5.4.0")
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:2.3.0") // if using Kotlin
}
Server Installation
custom crafter is written in Kotlin.
- Download the plugin jar and place the downloaded files in your
pluginsdirectory. - Start or reload the server.
- Place base blocks in a 3x3 area directly beneath a standard workbench — a standard workbench alone does not enable custom recipes. The default base block is
GOLD_BLOCK.
Code Samples
Compatibility check
Checks whether the CustomCrafterAPI version your plugin depends on is compatible with the version running on the server:
class YourPlugin : JavaPlugin() {
val dependVersion = Triple(5, 3, 0)
@Override
fun onEnable() {
if (CustomCrafterAPI.MAJOR_VERSION == dependVersion.first
&& CustomCrafterAPI.MINOR_VERSION >= dependVersion.second) {
return
}
Bukkit.pluginManager.disablePlugin(this)
}
}
Defining a recipe
A custom recipe consists of three parts:
- Material (
CMatter) — the input requirements for crafting. - Result (
ResultSupplier) — what a successful craft produces. - Recipe (
CRecipe) — combines materials, results, and shape (shaped/shapeless) for registration.
1. Materials (CMatter)
CMatter defines which item, how many, and where it must be placed. Use CMatterImpl or your own implementation of CMatter.
Accept 1 stone or 1 cobblestone:
val matter: CMatter = CMatterImpl(
name = "test-matter",
candidate = setOf(Material.STONE, Material.COBBLESTONE),
amount = 1,
anyAmount = false, // true: allow the amount to be satisfied across a stack
predicates = null // additional NBT or other conditions
)
For a simple set of candidate materials, of is shorter:
val matter: CMatter = CMatterImpl.of(Material.STONE, Material.COBBLESTONE)
2. Results (ResultSupplier)
A ResultSupplier receives the crafting context (Config) and returns the output items. Command execution can be used instead where no item result is needed.
val supplier = ResultSupplier { config ->
// 'config' holds crafting context: player, workbench, etc.
emptyList<ItemStack>()
}
Helper methods cover common cases:
// Always returns 1 stone
val supplier = ResultSupplier.single(ItemStack.of(Material.STONE))
// Scales output with the number of items crafted in one action (e.g. shift-click)
val supplier2 = ResultSupplier.timesSingle(ItemStack.of(Material.STONE))
3. Recipe (CRecipe)
CRecipeImpl combines materials and results into a registrable recipe.
val recipe: CRecipe = CRecipeImpl(
name = "test-recipe",
items = mapOf(CoordinateComponent(0, 0) to matter),
containers = null, // additional conditions, e.g. permissions
results = setOf(ResultSupplier.timesSingle(Material.STONE)),
type = CRecipe.Type.NORMAL
)
items: maps grid coordinates (CoordinateComponent(x, y)) to the requiredCMatter.type:CRecipe.Type.NORMALis a shaped recipe, where coordinates matter;CRecipe.Type.AMORPHOUSis shapeless, where coordinate values are arbitrary.
License
MIT License
Copyright (c) 2023 - 2026 Sakaki-Aruka
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
下载 custom-crafter-api
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 custom-crafter-api
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 custom-crafter-api
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 custom-crafter-api
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 custom-crafter-api
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 custom-crafter-api
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 custom-crafter-api
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 custom-crafter-api
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 custom-crafter-api
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 custom-crafter-api
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
⚠️ 破坏性变更
CMatter.isValidMatter()、CRecipe.isValidRecipe()、CraftUIDesigner.Baked.isValid()以及AllCandidateUIDesigner.Baked.isValid()不再返回Result<Unit>;它们在失败时直接抛出IllegalStateException,成功时则不返回任何内容。CMatter.firstFailedPredicate()和CRecipe.firstFailedRecipePredicate()现在返回kotlin.Pair<Int, CMatterPredicate>/kotlin.Pair<Int, CRecipePredicate>,而非IndexedValue。AllCandidateUIDesigner.Baked.ungeneratedIconPlaceholderItem的类型从 Kotlin 函数类型(CRecipe) -> ItemStack更改为java.util.function.Function<CRecipe, ItemStack>。Explainer的构造函数参数顺序从(name, verbosity)更改为(verbosity, name),因为在不命名实例的情况下控制日志级别是更常见的用例。
✨ 新功能与增强
- [增强] 通过用普通异常和
java.util.function.Function替换仅 Kotlin 支持的返回类型(Result、IndexedValue)及 Lambda 参数类型,提升了公共 API 的 Java 互操作性。
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
插件
PacketEvents 是一款专为 Minecraft Java 版打造的协议库,旨在简化数据包的处理与传输。
插件
ExyliaPlugins 的库。
插件
通过对话框或铁砧界面帮助你的 Anthme
插件
重新定义服务器上的生物运输方式。使用高度可定制的口袋道具,安全地捕获、存储和释放任何实体。
插件
为基于 Spigot/Paper/Folia 的服务器添加对 Vivecraft 的支持
插件
用于绘制游戏内地图或在浏览器中随探索实时进行地图绘制的实时地图。
评论 0
登录后参与评分
还没有评论,来抢沙发吧