MERICLE 的自定义配方
项目描述
CustomRecipes 是一款轻量级、对开发者友好的 Minecraft Spigot 插件,使服务器管理员能够使用简单的 JSON 配置文件轻松地在 Minecraft 服务器中添加自定义合成配方。该插件在复杂的配方管理系统和用户友好的配置之间架起桥梁,提供了一种清晰直观的方式来扩展 Minecraft 的合成系统。
核心目的
本插件解决了 Minecraft 服务器管理员在不具备复杂编程知识的情况下添加自定义合成配方的常见需求。它提供了一种基于 JSON 的简单配方创建方法,既易于人类阅读又便于维护:
- 基于文件的配置 - 在各个 JSON 文件中定义配方
- 热重载功能 - 无需重启服务器即可添加配方
- ZenScript 风格的语法 - 为经验丰富的用户提供熟悉的格式
- 零依赖 - 独立插件,无外部要求
主要特性
基于 JSON 的配方系统
- 配方存储在
recipes/ 文件夹中的各个 .json 文件里
- 全面的错误处理与详细的日志记录,便于故障排除
- 首次运行时自动生成示例配方
全面的配方支持
- 有形状配方 (Shaped Recipes):位置相关的合成图案(类似原版工具)
- 无形状配方 (Shapeless Recipes):顺序无关的材料组合(类似原版染料)
- 物品标签支持:使用 Minecraft 的物品标签(例如
#minecraft:sand)以接受多种材料变体
高级物品自定义
- 自定义显示名称:使用
& 格式化代码完全支持颜色
- 丰富的背景文本 (Lore):支持颜色格式化的多行物品描述
- 附魔应用:自动将附魔应用于合成出的物品
- 灵活的输出数量:支持生成多个物品的配方
配方管理
- 通过
/customrecipes reload 命令实现的热重载系统
- 带有详细错误报告的配方验证
- 自动注册到 Bukkit 的合成系统
- 冲突检测与解决
对开发者友好的架构
- 模块化设计,关注点清晰分离
- 可扩展的结构,便于未来功能添加
- 采用现代 Java 实践,利用 Java 21 特性
命令
/customrecipes - 显示插件信息
/customrecipes reload - 无需重启服务器重新加载所有配方
配方格式示例
有形状配方(位置重要)
{
"type": "shaped",
"name": "reinforced_sword",
"result": {
"item": "minecraft:diamond_sword",
"count": 1,
"display_name": "&bReinforced Sword",
"lore": ["&7Enhanced with special materials"],
"enchantments": {"sharpness": 2, "unbreaking": 1}
},
"pattern": [
["minecraft:diamond", "minecraft:diamond", "minecraft:diamond"],
["minecraft:air", "minecraft:stick", "minecraft:air"],
["minecraft:air", "minecraft:stick", "minecraft:air"]
]
}
无形状配方(顺序不重要)
{
"type": "shapeless",
"name": "dirt_diamonds",
"result": {
"item": "minecraft:diamond",
"count": 4,
"display_name": "&aDirt Diamond"
},
"ingredients": [
"minecraft:dirt", "minecraft:dirt",
"minecraft:dirt", "minecraft:stick"
]
}
服务器影响
- 性能:高效的配方注册,运行时开销极小
- 兼容性:适用于 Spigot、Paper 和基于 Bukkit 的服务器
- 可扩展性:可处理大量自定义配方而不会影响性能
- 数据:基于文件的配置,存储占用极小
安装
- 下载插件 JAR 文件
- 放入服务器的
plugins/ 文件夹
- 重启服务器
- 将 JSON 配方文件添加到
plugins/CustomRecipes/recipes/
- 使用
/customrecipes reload 加载新配方
MERICLE'S CUSTOM RECIPES
Project Description
CustomRecipes is a lightweight, developer-friendly Minecraft Spigot plugin that enables server administrators to easily add custom crafting recipes to their Minecraft servers using simple JSON configuration files. The plugin bridges the gap between complex recipe management systems and user-friendly configuration, providing a clean and intuitive way to extend Minecraft's crafting system.
Core Purpose
This plugin addresses the common need for Minecraft server administrators to add custom crafting recipes without requiring complex programming knowledge. It provides a simple, JSON-based approach to recipe creation that's both human-readable and easy to maintain:
- File-driven configuration - Recipes defined in individual JSON files
- Hot-reload capability - Add recipes without server restarts
- ZenScript-inspired syntax - Familiar format for experienced users
- Zero dependencies - Standalone plugin with no external requirements
Key Features
JSON-Based Recipe System
- Recipes stored in individual
.json files in the recipes/ folder
- Comprehensive error handling with detailed logging for troubleshooting
- Automatic example recipe generation on first run
Comprehensive Recipe Support
- Shaped Recipes: Position-dependent crafting patterns (like vanilla tools)
- Shapeless Recipes: Order-independent ingredient combinations (like vanilla dyes)
- Item Tag Support: Uses Minecraft's item tags (e.g.,
#minecraft:sand) to accept multiple material variants
Advanced Item Customization
- Custom display names: Full color code support using
& formatting
- Rich lore text: Multi-line item descriptions with color formatting
- Enchantment application: Automatic enchantment application to crafted items
- Flexible output quantities: Support for recipes producing multiple items
Recipe Management
- Hot-reload system with
/customrecipes reload command
- Recipe validation with detailed error reporting
- Automatic registration with Bukkit's crafting system
- Conflict detection and resolution
Developer-Friendly Architecture
- Modular design with clean separation of concerns
- Extensible structure for future feature additions
- Modern Java practices utilizing Java 21 features
Commands
/customrecipes - Show plugin information
/customrecipes reload - Reload all recipes without server restart
Recipe Format Examples
Shaped Recipe (position matters)
{
"type": "shaped",
"name": "reinforced_sword",
"result": {
"item": "minecraft:diamond_sword",
"count": 1,
"display_name": "&bReinforced Sword",
"lore": ["&7Enhanced with special materials"],
"enchantments": {"sharpness": 2, "unbreaking": 1}
},
"pattern": [
["minecraft:diamond", "minecraft:diamond", "minecraft:diamond"],
["minecraft:air", "minecraft:stick", "minecraft:air"],
["minecraft:air", "minecraft:stick", "minecraft:air"]
]
}
Shapeless Recipe (order doesn't matter)
{
"type": "shapeless",
"name": "dirt_diamonds",
"result": {
"item": "minecraft:diamond",
"count": 4,
"display_name": "&aDirt Diamond"
},
"ingredients": [
"minecraft:dirt", "minecraft:dirt",
"minecraft:dirt", "minecraft:stick"
]
}
Server Impact
- Performance: Efficient recipe registration with minimal runtime overhead
- Compatibility: Works with Spigot, Paper, and Bukkit-based servers
- Scalability: Handles numerous custom recipes without performance impact
- Data: Minimal storage footprint with file-based configuration
Installation
- Download the plugin JAR file
- Place in your server's
plugins/ folder
- Restart the server
- Add JSON recipe files to
plugins/CustomRecipes/recipes/
- Use
/customrecipes reload to load new recipes
评论 0
登录后参与评分
还没有评论,来抢沙发吧