No Crop Trample
一款只做一件事的小模组:防止农田在被实体踩踏后 revert 为泥土。不再因为一个不小心的跳跃、游荡的僵尸或一支乱飞的箭而毁掉你的麦田。
适用于 Fabric 和 NeoForge 平台上的 Minecraft 26.1.x。
为什么制作这个模组
Minecraft 26.1 是全新版本,那些流行的旧版防踩踏模组尚未移植。本模组填补了这一空白,提供一个极简且加载快速的实现方案——不添加新方块、不添加新物品,仅修复该问题。
功能说明
- 默认禁用所有实体的农田踩踏行为——包括玩家、怪物和投射物。
- 提供一个简单的 JSON 配置开关,如果你希望关闭此功能可自行调整。
- 摔落伤害仍然正常生效。仅跳过导致农田破坏的逻辑路径。
底层原理
- Fabric:通过一个微小的 mixin 包裹
FarmlandBlock.fallOn 中的 turnToDirt(...) 调用,使用 MixinExtras 的 @WrapOperation(随 Fabric Loader 捆绑提供,无需额外依赖)。
- NeoForge:订阅内置的
BlockEvent.FarmlandTrampleEvent 事件并取消它。
两条路径都经过同一个受配置影响的决策流程,因此未来可以在不破坏兼容性的前提下,按实体类型添加切换选项(如仅玩家、仅怪物、仅投射物)。
配置
编辑 config/nocroptramplelite.json(首次启动时自动生成):
{
"preventTrampling": true
}
| 键名 |
默认值 |
说明 |
preventTrampling |
true |
设为 true 时,任何实体都无法踩踏农田。设为 false 可恢复原版行为。 |
修改配置后需重启 Minecraft(或专用服务器)以使更改生效。
与模组农作物的兼容性
自动支持以下情况:
- 种植在原版农田上的模组农作物——最常见场景(如 Farmer's Delight、大多数魔法作物模组等)。
- 继承自原版
FarmlandBlock 的模组农田——保护机制通过继承自然生效。
- 重写
fallOn 但调用 super.fallOn(...) 的模组农田——super 调用会重新进入受保护的路径。
不影响以下情况:
- 完全替换
fallOn 并自带独立踩踏逻辑的模组农田(较少见)。
- 完全不继承
FarmlandBlock 的自定义“农田”方块。
- 盆栽式种植器(Botany Pots、Garden Cloches 等)——它们本身就不存在踩踏问题。
要求
- Minecraft 26.1.x
- Java 25
- Fabric Loader 0.18.4+ 并安装 Fabric API,或 NeoForge 26.1+
许可证
CC0-1.0 — 公有领域,你可以随意使用它。
源码
No Crop Trample
A small mod that does one thing: stops farmland from reverting to dirt when entities land on it. No more destroyed wheat fields from a careless jump, a wandering zombie, or a stray arrow.
Targets Minecraft 26.1.x on both Fabric and NeoForge.
Why this mod exists
Minecraft 26.1 is brand new and the popular legacy trample-prevention mods haven't ported yet. This fills the gap with a minimal, fast-loading implementation — no new blocks, no new items, just the fix.
What it does
- Disables farmland trampling for all entities by default — players, mobs, projectiles.
- One simple JSON config toggle if you want to turn it off.
- Fall damage still applies. Only the farmland-destruction path is skipped.
How it works under the hood
- Fabric: a tiny mixin wraps the
turnToDirt(...) call inside FarmlandBlock.fallOn, using MixinExtras' @WrapOperation (bundled with Fabric Loader, no extra dependency).
- NeoForge: subscribes to the built-in
BlockEvent.FarmlandTrampleEvent and cancels it.
Both paths route through the same config-aware decision, so per-entity-type toggles (player-only, mob-only, projectile-only) can be added in a future release without breaking changes.
Configuration
Edit config/nocroptramplelite.json (created on first launch):
{
"preventTrampling": true
}
| Key |
Default |
Notes |
preventTrampling |
true |
When true, no entity can trample farmland. Set false to restore vanilla behaviour. |
Restart Minecraft (or the dedicated server) after editing for changes to take effect.
Compatibility with modded crops
Works automatically with:
- Modded crops planted on vanilla farmland — most common case (Farmer's Delight, most magic-crop mods, etc.).
- Modded farmland that extends vanilla
FarmlandBlock — inheritance carries the protection through.
- Modded farmland that overrides
fallOn but calls super.fallOn(...) — super call routes back into the protected path.
Does not affect:
- Modded farmland that fully replaces
fallOn with its own trample logic (rare).
- Custom "farmland" blocks that don't extend
FarmlandBlock at all.
- Pot-style growers (Botany Pots, Garden Cloches, etc.) — they don't have trampling to begin with.
Requirements
- Minecraft 26.1.x
- Java 25
- Fabric Loader 0.18.4+ with Fabric API, or NeoForge 26.1+
License
CC0-1.0 — public domain, do whatever you want with it.
Source
评论 0
登录后参与评分
还没有评论,来抢沙发吧