Auto Replanter
一个 Minecraft Fabric 模组,在收获作物时自动重新种植,消除了破坏作物后手动重新播种的繁琐工作。
演示
功能
- 自动作物重植:作物被破坏时会立即以 0 年龄重新种植
- 双重工具验证系统:可选择基于标签或特定物品类型的工具要求
- 可配置的工具要求:选择是否需要在自动重植时使用特定工具
- 智能工具损耗:工具会因使用而承受耐久度损耗,并完全支持附魔(如经验修补)
- 潜行模式控制:配置自动重植是始终生效、仅在潜行时生效,还是仅在站立时生效
- 高度可配置:提供丰富的配置选项以自定义行为
- 模组兼容性:适用于任何扩展自 Minecraft
CropBlock 的模组作物
- 配套附魔:可选配套 数据包 用于将自动重植添加为一种附魔效果
安装
- 安装 Fabric Loader
- 下载模组 jar 文件
- 将 jar 文件放入
mods 文件夹
- 启动游戏
配置
模组首次运行时会在 config/autoreplanter.json 创建配置文件。您可以编辑此文件来自定义模组的行为。
配置选项
{
"validToolTags": ["minecraft:hoes", "farmersdelight:tools/knives"],
"validTools": ["minecraft:diamond_hoe", "farmersdelight:flint_knife"],
"enableAutoReplanting": true,
"damageTools": true,
"requireTool": true,
"useValidToolTags": true,
"useValidTools": false,
"onlyDamageOnMatureCrop": true,
"sneakMode": "ALWAYS",
"customBlockReplacements": [
{
"target": "farmersdelight:brown_mushroom_colony",
"replacement": "minecraft:brown_mushroom",
"damageTool": true
},
{
"target": "farmersdelight:red_mushroom_colony",
"replacement": "minecraft:red_mushroom",
"damageTool": true
}
],
"useCustomBlockReplacements": true
}
| 选项 |
类型 |
默认值 |
描述 |
validToolTags |
数组 |
["minecraft:hoes", "farmersdelight:tools/knives"] |
被视为有效重植工具的物品种类列表。仅当 useValidToolTags 为 true 时生效 |
validTools |
数组 |
["minecraft:diamond_hoe", "farmersdelight:flint_knife"] |
被视为有效重植工具的具体物品 ID 列表。仅当 useValidTools 为 true 时生效 |
enableAutoReplanting |
布尔值 |
true |
启用/禁用模组的总开关 |
damageTools |
布尔值 |
true |
工具在使用时是否应承受耐久度损耗 |
requireTool |
布尔值 |
true |
发生自动重植是否需要有效的工具 |
useValidToolTags |
布尔值 |
true |
是否使用基于标签的工具验证。当为 false 时,忽略 validToolTags 列表 |
useValidTools |
布尔值 |
false |
是否使用基于具体物品的工具验证。当为 false 时,忽略 validTools 列表 |
onlyDamageOnMatureCrop |
布尔值 |
true |
工具是否仅在收获成熟作物时才承受损耗 |
sneakMode |
字符串 |
"ALWAYS" |
根据潜行状态控制自动重植的发生时机。选项:"ALWAYS"(始终)、"ONLY_SNEAKING"(仅潜行)、"ONLY_STANDING"(仅站立) |
customBlockReplacements |
数组 |
见下文 |
用于非作物方块的重置规则列表 |
useCustomBlockReplacements |
布尔值 |
true |
是否启用自定义方块替换功能 |
自定义方块替换
模组支持自定义方块替换规则,允许您在破坏非作物方块时自动将其替换为其他方块。这对于像蘑菇群落这样应在收获时重新种植蘑菇的方块非常有用。
每个自定义方块替换规则具有以下结构:
{
"target": "farmersdelight:brown_mushroom_colony",
"replacement": "minecraft:brown_mushroom",
"damageTool": true
}
| 属性 |
类型 |
描述 |
target |
字符串 |
要被替换的方块 ID(即您正在破坏的方块) |
replacement |
字符串 |
破坏后要放置的方块 ID |
damageTool |
布尔值 |
破坏此特定方块是否应对您的工具造成损耗 |
示例配置:
"customBlockReplacements": [
{
"target": "farmersdelight:brown_mushroom_colony",
"replacement": "minecraft:brown_mushroom",
"damageTool": true
},
{
"target": "farmersdelight:red_mushroom_colony",
"replacement": "minecraft:red_mushroom",
"damageTool": false
}
]
工作原理:
- 当您使用有效工具破坏
farmersdelight:brown_mushroom_colony 时,它会自动在其位置放置一个 minecraft:brown_mushroom
- 原始方块的掉落物会被生成,但减去一个替换物品(以模拟将其用于重植)
- 工具损耗会根据每个规则的
damageTool 设置应用
- 所有其他配置选项(工具要求、潜行模式等)仍然适用
注意事项:
- 自定义方块替换独立于作物方块工作
- 必须将
useCustomBlockReplacements 设置为 true 才能使用此功能
- 方块 ID 必须是游戏中存在的有效 ID(包括模组方块)
- 如果替换方块 ID 无效,该规则将被忽略
Auto Replanter 附魔支持
还有一个可选的数据包用于添加附魔支持。如果工具拥有自动重新种植附魔(无论其类型如何,也无论它是否匹配你配置中的标签或物品列表),它始终会被视为有效的自动重新种植工具。这意味着你可以给任何工具附魔“自动重新种植”附魔,即使它未列入 validToolTags 或 validTools 中,该模组也能正常工作。可以被附魔的工具由“自动重新种植附魔”数据包定义。
如果启用了此数据包,模组将自动检测到它,无需进行额外配置。若要强制仅使用附魔并忽略通过上述配置设置定义的有效工具,只需在配置中将 useValidToolTags 和 useValidTools 设置为 false 即可。
“自动重新种植附魔”数据包可在 Modrinth 获取。
注意:
其他配置设置——例如 requireTool、sneakMode 以及工具耐久度——仍然适用。
这提供了更大的灵活性:你可以将附魔赋予自定义工具、模组工具,甚至是配置通常不允许的 vanilla 工具,它们都能无缝配合自动重新种植功能。
使用示例
默认行为
- 使用锄头(来自
minecraft:hoes 标签)或刀(来自 farmersdelight:tools/knives 标签)
- 无论你是否潜行均可工作
- 成熟的作物掉落物品(少掉一粒种子)
- 作物会自动重新种植
- 工具消耗 1 点耐久度
仅潜行模式
设置 "sneakMode": "ONLY_SNEAKING" 以仅在潜行时自动重新种植。这让你能精确控制何时重新种植作物,防止在穿过农田时意外重新种植。
非潜行模式
设置 "sneakMode": "ONLY_STANDING" 以仅在不潜行时自动重新种植。这允许你通过按住潜行来禁用自动重新种植,当你想手动破坏作物而不重新种植时非常有用(例如搬迁农田时)。
仅限基于标签的工具
设置 "useValidTools": false 以仅使用基于标签的验证。validTools 列表将被忽略。
仅限特定工具
设置 "useValidToolTags": false 以仅使用特定物品验证。validToolTags 列表将被忽略。
无需工具
设置 "requireTool": false 以启用自动重新种植,无论使用什么工具(或不使用任何工具)。当此选项禁用时,两种验证系统都会被绕过。
保留工具耐久度
设置 "damageTools": false 以防止工具受到任何耐久度损耗。
仅在收获时损坏工具
设置 "onlyDamageOnMatureCrop": true(默认值)以仅在实际收获成熟作物时损坏工具,而不是在重新种植未成熟作物时。这样可以避免在自动重新种植未完全成熟的作物时造成不必要的工具耐久度损失。
自定义方块采集
使用自定义方块替换来自动重新种植如蘑菇群落等模组方块:
"customBlockReplacements": [
{
"target": "farmersdelight:brown_mushroom_colony",
"replacement": "minecraft:brown_mushroom",
"damageTool": true
}
]
使用默认值时,当你破坏来自 Farmer's Delight 的棕色蘑菇群落(满足触发自动重新种植的有效条件)时,它会自动放置一个棕色蘑菇,并掉落群落正常的战利品(少掉落一个用于重新种植的棕色蘑菇)。
支持的作物
该模组适用于:
- 所有 Minecraft 原版作物(小麦、胡萝卜、土豆、甜菜根等)
- 任何继承自 Minecraft
CropBlock 类的模组作物
- 这包括来自热门模组如 Farmer's Delight 的作物(已测试并可用),并且应该对其他模组如 Croptopia 以及其他许多模组也有效,尽管这些尚未进行测试。
兼容性
- Minecraft 版本: 1.21.1
- 模组加载器: Fabric
- 依赖项: Fabric API
- 兼容模组: 大多数农业和农耕类模组,特别是那些继承自 Minecraft
CropBlock 类的模组。
技术细节
- 使用 Fabric 的
PlayerBlockBreakEvents.BEFORE 拦截作物破坏事件
- 尊重如经验修补之类的附魔效果
- 仅服务端逻辑(在单人游戏和多人游戏中均有效)
- 自动生成和验证配置
- 双工具验证系统支持基于标签和基于物品的匹配
常见问题
问:这在服务器上能用吗?
答:可以!该模组在单人游戏和多人服务器上都有效。
问:我可以不重启游戏就更改配置吗?
答:不可以,你需要重启 Minecraft(或服务器)才能使配置更改生效。
问:它能与模组作物一起使用吗?
答:可以,只要模组作物继承自 Minecraft 的 CropBlock 类,就应该能正常工作。
问:带有经验修补附魔的工具会更耐用吗?
答:是的!该模组使用 Minecraft 内置的耐久度系统,因此所有附魔都能正常工作。
问:我将物品添加到了 validTools 中但它们不起作用。为什么?
答:请确保在你的配置中将 useValidTools 设置为 true。如果它是 false,则 validTools 列表会被忽略。
问:我可以同时使用基于标签和特定物品的验证吗?
答:可以!将 useValidToolTags 和 useValidTools 都设置为 true。只要工具匹配任一系统,即被视为有效。
问:我该如何禁用其中一个验证系统?
答:将 useValidToolTags 或 useValidTools 中的任意一个设置为 false 以禁用相应的验证系统。对应的列表(validToolTags 或 validTools)随后将被忽略。
问:潜行模式之间有什么区别?
A:"ALWAYS" 无论是否潜行都会生效;"ONLY_SNEAKING" 仅在潜行时生效(用于精确控制);"ONLY_STANDING" 仅在不潜行时生效(即通过潜行即可禁用)。
Q:我可以设置无效的潜行模式吗?
A:如果在配置中设置了无效的潜行模式,模组将回退到 "ALWAYS" 的行为。
Q:我可以使用自定义方块替换来替换任何模组添加的方块吗?
A:可以,只要为目标方块和替换方块指定有效的方块 ID 即可。这些方块必须存在于你的游戏中,替换才能生效。
Q:自定义方块替换适用于作物吗?
A:自定义方块替换专为非作物方块设计。常规作物由模组的内置作物重新种植系统处理。如果某个作物方块也在自定义方块替换配置中被定义,则作物破坏逻辑将优先于自定义方块逻辑。
Q:我可以为特定的自定义方块禁用工具耐久损耗吗?
A:可以!在自定义方块替换规则中设置 "damageTool": false,即可防止该特定方块的工具耐久损耗。请注意,作物方块的优先级高于自定义方块,因此如果某个作物方块被定义在自定义方块列表中,其 damageTool 值将被忽略,转而采用作物方块的逻辑。
许可
本项目依据知识共享许可协议授权——详见 LICENCE 文件。
贡献
欢迎贡献!请随时在 GitHub 上提交拉取请求。
支持
如果遇到任何问题或有建议,请:
- 检查配置文件以确保正确设置
- 确保启用了正确的验证布尔值(
useValidToolTags 和 useValidTools)
- 确认你的
sneakMode 设置为有效选项之一
- 在 GitHub Issues 页面报告错误
作者: jackclarke95
版本: 1.3.1
Minecraft: 1.21.1
加载器: Fabric
Auto Replanter
A Minecraft Fabric mod that automatically replants crops when harvested, eliminating the tedious task of manually replanting seeds after breaking crops.
Demo
Features
- Automatic Crop Replanting: Crops are instantly replanted at age 0 when broken
- Dual Tool Validation System: Choose between tag-based and specific item-based tool requirements
- Configurable Tool Requirements: Choose whether specific tools are required for auto-replanting
- Smart Tool Damage: Tools take durability damage with full enchantment support (such as Unbreaking)
- Sneak Mode Control: Configure auto-replanting to work always, only while sneaking, or only while standing
- Highly Configurable: Extensive configuration options to customise behaviour
- Mod Compatibility: Works with any modded crops that extend Minecraft's
CropBlock
- Companion Enchantment: Optional companion enchantment available for adding auto replanting as an enchantment
Installation
- Install Fabric Loader
- Download the mod jar
- Place the jar file in your
mods folder
- Launch the game
Configuration
The mod creates a configuration file at config/autoreplanter.json on first run. You can edit this file to customise the mod's behaviour.
Configuration Options
{
"validToolTags": ["minecraft:hoes", "farmersdelight:tools/knives"],
"validTools": ["minecraft:diamond_hoe", "farmersdelight:flint_knife"],
"enableAutoReplanting": true,
"damageTools": true,
"requireTool": true,
"useValidToolTags": true,
"useValidTools": false,
"onlyDamageOnMatureCrop": true,
"sneakMode": "ALWAYS",
"customBlockReplacements": [
{
"target": "farmersdelight:brown_mushroom_colony",
"replacement": "minecraft:brown_mushroom",
"damageTool": true
},
{
"target": "farmersdelight:red_mushroom_colony",
"replacement": "minecraft:red_mushroom",
"damageTool": true
}
],
"useCustomBlockReplacements": true
}
| Option |
Type |
Default |
Description |
validToolTags |
Array |
["minecraft:hoes", "farmersdelight:tools/knives"] |
List of item tags that are considered valid tools for auto-replanting. Only takes effect when useValidToolTags is true |
validTools |
Array |
["minecraft:diamond_hoe", "farmersdelight:flint_knife"] |
List of specific item IDs that are considered valid tools for auto-replanting. Only takes effect when useValidTools is true |
enableAutoReplanting |
Boolean |
true |
Master switch to enable/disable the mod |
damageTools |
Boolean |
true |
Whether tools should take durability damage when used |
requireTool |
Boolean |
true |
Whether a valid tool is required for auto-replanting to occur |
useValidToolTags |
Boolean |
true |
Whether to use tag-based tool validation. When false, the validToolTags list is ignored |
useValidTools |
Boolean |
false |
Whether to use specific item-based tool validation. When false, the validTools list is ignored |
onlyDamageOnMatureCrop |
Boolean |
true |
Whether tools should only take damage when harvesting mature crops |
sneakMode |
String |
"ALWAYS" |
Controls when auto-replanting occurs based on sneak state. Options: "ALWAYS", "ONLY_SNEAKING", "ONLY_STANDING" |
customBlockReplacements |
Array |
See below |
List of custom block replacement rules for non-crop blocks |
useCustomBlockReplacements |
Boolean |
true |
Whether to enable custom block replacement functionality |
Custom Block Replacements
The mod supports custom block replacement rules that allow you to automatically replace non-crop blocks with other blocks when broken. This is useful for blocks like mushroom colonies that should replant a mushroom when harvested.
Each custom block replacement rule has the following structure:
{
"target": "farmersdelight:brown_mushroom_colony",
"replacement": "minecraft:brown_mushroom",
"damageTool": true
}
| Property |
Type |
Description |
target |
String |
The block ID to be replaced (what you're breaking) |
replacement |
String |
The block ID to place after breaking |
damageTool |
Boolean |
Whether breaking this specific block should damage your tool |
Example Configuration:
"customBlockReplacements": [
{
"target": "farmersdelight:brown_mushroom_colony",
"replacement": "minecraft:brown_mushroom",
"damageTool": true
},
{
"target": "farmersdelight:red_mushroom_colony",
"replacement": "minecraft:red_mushroom",
"damageTool": false
}
]
How It Works:
- When you break a
farmersdelight:brown_mushroom_colony with a valid tool, it will automatically place a minecraft:brown_mushroom in its place
- The original block's drops are spawned, minus one of the replacement item (to simulate using it for replanting)
- Tool damage is applied based on the
damageTool setting for each rule
- All other configuration options (tool requirements, sneak mode, etc.) still apply
Notes:
- Custom block replacements work independently of crop blocks
- The
useCustomBlockReplacements setting must be true for this feature to work
- Block IDs must be valid and exist in your game (including mod blocks)
- If the replacement block ID is invalid, that rule will be ignored
Auto Replanter Enchantment Support
There is an additional, optional datapack to add enchantment support. If a tool has the Auto Replanter Enchantment (regardless of its type or whether it matches your configured tags or item lists), it will always be considered a valid tool for auto-replanting. This means you can enchant any tool with the Auto Replanter enchantment and it will work with the mod, even if it is not listed in validToolTags or validTools. The tools that can be enchanted are defined in the Auto Replanter Enchantment data pack.
If this datapack is enabled, the mod will automatically detect it with no config required. To enforce the enchantmentand ignore any valid tools as defined using the config settings described above, simply set useValidToolTags and useValidTools to false in the config.
The Auto Replanter Enchantment datapack is available on Modrinth
Note:
The other configuration settings—such as requireTool, sneakMode, and tool durability—still apply.
-
If requireTool is set to false, any tool (or even no tool) will work, regardless of enchantment.
-
If requireTool is true, a tool with the Auto Replanter enchantment will always be valid, even if it doesn't match your tags or item lists.
-
The sneak mode and tool damage settings are still respected.
This allows for more flexibility: you can give the enchantment to custom tools, modded tools, or even vanilla tools not normally allowed by your config, and they will work seamlessly with auto-replanting.
Usage Examples
Default Behaviour
- Use a hoe (from the
minecraft:hoes tag) or knife (from the farmersdelight:tools/knives tag)
- Works regardless of whether you're sneaking
- Mature crops drop their items (minus one seed)
- Crop is automatically replanted
- Tool takes 1 durability damage
Sneak-Only Mode
Set "sneakMode": "ONLY_SNEAKING" to only auto-replant while sneaking. This gives you precise control over when crops are replanted, preventing accidental replanting when walking through your farm.
No-Sneak Mode
Set "sneakMode": "ONLY_STANDING" to only auto-replant while not sneaking. This allows you to disable auto-replanting by holding sneak, useful when you want to manually break crops without replanting (e.g., when relocating your farm).
Tag-Based Tools Only
Set "useValidTools": false to only use tag-based validation. The validTools list will be ignored.
Specific Tools Only
Set "useValidToolTags": false to only use specific item validation. The validToolTags list will be ignored.
No Tool Required
Set "requireTool": false to enable auto-replanting regardless of what tool is used (or no tool at all). When this is disabled, both validation systems are bypassed.
Preserve Tool Durability
Set "damageTools": false to prevent tools from taking any durability damage.
Only Damage on Harvest
Set "onlyDamageOnMatureCrop": true (default) to only damage tools when actually harvesting mature crops, not when replanting immature ones. This saves needless tool durability loss when accidentally breaking crops that are not fully grown when they are automatically replanted.
Custom Block Harvesting
Use custom block replacements to automatically replant modded blocks like mushroom colonies:
"customBlockReplacements": [
{
"target": "farmersdelight:brown_mushroom_colony",
"replacement": "minecraft:brown_mushroom",
"damageTool": true
}
]
Using the default values, when you break a brown mushroom colony from Farmer's Delight (having met the valid criteria to trigger automatic replanting), it will automatically place a brown mushroom and drop the colony's normal loot (minus one brown mushroom used for replanting).
Supported Crops
The mod works with:
- All vanilla Minecraft crops (wheat, carrots, potatoes, beetroot, etc.)
- Any modded crops that extend Minecraft's
CropBlock class
- This includes crops from popular mods like Farmer's Delight (tested and working), and should work for other mods such as Croptopia, and many others, though these have not been tested.
Compatibility
- Minecraft Version: 1.21.1
- Mod Loader: Fabric
- Dependencies: Fabric API
- Compatible with: Most farming and agriculture mods, specifically those that extend Minecraft's
CropBlock class.
Technical Details
- Uses Fabric's
PlayerBlockBreakEvents.BEFORE to intercept crop breaking
- Respects enchantments like Unbreaking
- Server-side only logic (works on both single-player and multiplayer)
- Automatic config generation and validation
- Dual tool validation system supports both tag-based and item-specific matching
FAQ
Q: Does this work on servers?
A: Yes! The mod works on both single-player and multiplayer servers.
Q: Can I change the config without restarting?
A: No, you need to restart Minecraft (or the server) for config changes to take effect.
Q: Does this work with modded crops?
A: Yes, as long as the modded crops extend Minecraft's CropBlock class, then this should work.
Q: Will tools with Unbreaking last longer?
A: Yes! The mod uses Minecraft's built-in durability system, so all enchantments work normally.
Q: I added items to validTools but they don't work. Why?
A: Make sure useValidTools is set to true in your config. If it's false, the validTools list is ignored.
Q: Can I use both tag-based and specific item validation?
A: Yes! Set both useValidToolTags and useValidTools to true. A tool will be considered valid if it matches either system.
Q: How do I disable one of the validation systems?
A: Set either useValidToolTags or useValidTools to false to disable that respective validation system. The corresponding list (validToolTags or validTools) will then be ignored.
Q: What's the difference between the sneak modes?
A: "ALWAYS" works regardless of sneaking, "ONLY_SNEAKING" only works while sneaking (for precise control), and "ONLY_STANDING" only works while not sneaking (so you can disable it by sneaking).
Q: Can I set an invalid sneak mode?
A: If you set an invalid sneak mode in the config, the mod will fall back to "ALWAYS" behavior.
Q: Can I use custom block replacements with any modded blocks?
A: Yes, as long as you specify valid block IDs for both the target and replacement blocks. The blocks must exist in your game for the replacement to work.
Q: Do custom block replacements work with crops?
A: Custom block replacements are designed for non-crop blocks. Regular crops are handled by the mod's built-in crop replanting system. If a crop block is also defined in the custom block replacement config, crop breaking logic will take precedence.
Q: Can I disable tool damage for specific custom blocks?
A: Yes! Set "damageTool": false in the custom block replacement rule to prevent tool damage for that specific block. Note that crop blocks take precedence over custom blocks, so if a crop block is defined in the custom blocks, its damageTool value will be ignored in favour of the crop block logic.
Licence
This project is licensed under the Creative Commons Licence - see the LICENCE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request on GitHub.
Support
If you encounter any issues or have suggestions, please:
- Check the configuration file for proper setup
- Ensure the correct validation booleans (
useValidToolTags and useValidTools) are enabled
- Verify your
sneakMode setting is one of the valid options
- Report bugs on the GitHub Issues page
Author: jackclarke95
Version: 1.3.1
Minecraft: 1.21.1
Mod Loader: Fabric
评论 0
登录后参与评分
还没有评论,来抢沙发吧