哭泣苦力怕
面向 Minecraft 26.1.x,适用于 Fabric 和 NeoForge 的苦力怕 × 哭泣天使杂交模组。
盯着它:它会冻结。移开视线:它会冲刺。抓住你:会爆炸——但只伤害你,不破坏地形。想建什么就建什么,想在哪建就在哪建,别再害怕那 嘶嘶 声了。
功能介绍
- 被观察时冻结。 只要哭泣苦力怕处于你前方 120° 锥形视野内 且 你有视线接触,它就会完全停止移动。不会前进引信倒计时,也不会进行路径规划,彻底定格在原地。移开视线、断开视线接触或躲到墙后——它会重新投入狩猎。
- 比原版更快(
movementSpeed 为 0.40,而原版仅为 0.25——大约相当于蜘蛛的速度)。当你不再注视时,它会激进地拉近距离。
- 仅对玩家造成爆炸伤害。 无方块破坏。不会对其他生物、你的动物、物品展示框、潜影盒或任何其他东西造成附带伤害。只有你会受伤。保留原版伤害缩放机制,因此一只被闪电击中的哭泣苦力怕可以在零距离一击秒杀未穿甲的玩家。
- 默认替换原版苦力怕。 所有自然生成的苦力怕都会变成哭泣苦力怕。支持从 0%(仅通过刷怪蛋生成)到 100%(完全替换)进行调节。
- 雕像外观。 通过实体着色 API 添加细微的更暗、略微去饱和的色调——并非 独立的纹理,因此已安装的资源包(如 Faithful、Sphax 等)仍会应用其高清苦力怕纹理,只是亮度变暗。
- 泪痕。 每只眼睛下方绘制半透明叠加层作为泪痕效果。可切换开启/关闭。
- 近距离安全网。 进入近战范围时,无论视线角度如何,它都会冻结,因此近身遭遇战并不总是以爆炸告终。
- 可选的心形粒子。 用于“我看到你在看我”的喜剧提示(默认关闭——如果你的风格如此,可在配置中启用)。
配置
配置文件位于 config/weepingcreeper.json(首次启动时创建):
{
"replacementChance": 1.0,
"movementSpeed": 0.4,
"lookArcDegrees": 120.0,
"proximityFreezeRadius": 1.5,
"followRange": 64.0,
"tearsEnabled": true,
"heartParticlesEnabled": false,
"heartIntervalTicks": 60,
"tintBrightness": 0.55,
"desaturation": 0.25,
"explosionRadius": 3.0,
"chargedExplosionRadius": 6.0
}
| Key |
Default |
Notes |
replacementChance |
1.0 |
变成哭泣苦力怕的原版苦力怕生成比例。0.0 = 从不替换;1.0 = 始终替换。 |
movementSpeed |
0.4 |
移动速度属性。原版苦力怕为 0.25。 |
lookArcDegrees |
120.0 |
被视为“正在注视”的前方锥形宽度。 |
proximityFreezeRadius |
1.5 |
在此距离内的任何玩家都会使苦力怕冻结,无论视线角度如何。0 表示禁用。 |
followRange |
64.0 |
检测 / 追击范围。原版苦力怕约为 16。 |
tearsEnabled |
true |
面部泪痕叠加层。 |
heartParticlesEnabled |
false |
在被观察时于苦力怕上方生成心形粒子。具有喜剧效果,默认关闭。 |
heartIntervalTicks |
60 |
启用时心形粒子之间的间隔刻数。20 = 1 秒。 |
tintBrightness |
0.55 |
苦力怕纹理的统一亮度乘数。1.0 = 无变化。 |
desaturation |
0.25 |
为了呈现雕像外观而减少各通道的绿色值。0.0 = 仅均匀变暗。 |
explosionRadius |
3.0 |
造成伤害的半径。与原版苦力怕相同。 |
chargedExplosionRadius |
6.0 |
被闪电击中时的半径。与原版充能苦力怕相同。 |
tearsEnabled、heartParticlesEnabled 以及着色值在渲染时实时生效。其他值需要重启游戏。
底层工作原理
- 自定义实体 (
WeepingCreeperEntity extends Creeper) —— 继承标准苦力怕 AI、膨胀计时器和充能变种。通过 EntityJoinLevelEvent (NeoForge) / ServerEntityEvents.ENTITY_LOAD (Fabric) 在生成时替换原版苦力怕。
- 视线检测: 玩家视角向量与玩家眼睛到苦力怕中心向量之间的点积,与
cos(arc / 2) 进行比较,再加上原版的 hasLineOfSight() 检查。
- 冻结机制:
customServerAiStep 停止导航,清除目标,将水平速度归零,并且每个刻都硬重置膨胀引信至 0。引信重置使用了微小的 mixin 访问器 (CreeperAccessor),因为 swell 字段是私有的,而仅调用 setSwellDir(-1) 每个刻只能递减一次——对于已经处于爆炸中途的苦力怕来说太慢了。
- 自定义爆炸: 另一个微小的 mixin (
CreeperTickMixin) 包装了 Creeper#tick 内部私有的 Creeper#explodeCreeper() 调用。对于哭泣苦力怕,重定向到 WeepingCreeperEntity#explodeWeeping(),该函数触发仅 cosmetic 的爆炸(Level.ExplosionInteraction.NONE = 无方块破坏),并仅对半径内的玩家应用原版苦力怕伤害缩放。原版苦力怕不受影响。
- 着色: 使用每通道 ARGB 乘数覆盖
LivingEntityRenderer#getModelTint(state)。保持原版苦力怕纹理路径,以便资源包重新贴图仍能通过着色生效。
这两个 mixin 针对原版 Creeper.class 中非常小的字节码足迹。应该与任何不重定向相同私有调用的内容兼容良好。
要求
- Minecraft 26.1.x
- Java 25
- Fabric Loader 0.18.4+ 搭配 Fabric API,或 NeoForge 26.1+
许可证
CC0-1.0 — 公共领域,您可以随意使用它。
源码
Weeping Creeper
A creeper × Weeping Angel crossbreed for Minecraft 26.1.x on Fabric and NeoForge.
Stare at it: it freezes. Look away: it sprints. Catches you: explodes — but only damages you, not the terrain. Build whatever you want, wherever you want, and stop fearing the psssss.
What it does
- Freezes when observed. Any time a weeping creeper falls within your 120° front cone and has line-of-sight, it stops moving completely. No fuse advance, no path-tick, frozen in place. Look away, break line-of-sight, or duck behind a wall — it resumes the hunt.
- Faster than vanilla (
movementSpeed 0.40 vs vanilla 0.25 — about a spider). When you're not watching, it closes the gap aggressively.
- Player-only explosion. No block damage. No collateral damage to other mobs, your animals, your itemframes, your shulker boxes, your everything. Just you. Vanilla damage scaling preserved, so a charged weeping creeper one-shots an unarmoured player at point-blank.
- Replaces vanilla creepers by default. Every natural creeper spawn becomes a weeping creeper. Tunable from 0% (only spawn from spawn eggs) to 100% (full replacement).
- Statue aesthetic. Subtle darker, slightly desaturated tint via the entity-tint API — not a separate texture, so installed resource packs (Faithful, Sphax, etc.) still apply their HD creeper textures, just dimmed.
- Tear streaks below each eye, drawn as a translucent overlay layer. Toggleable.
- Proximity safety net. Walk into melee range and it freezes regardless of look angle, so close encounters don't always end in detonation.
- Optional heart particles for an "I see you seeing me" comedic cue (off by default — enable in config if that's your tone).
Configuration
Config at config/weepingcreeper.json (created on first launch):
{
"replacementChance": 1.0,
"movementSpeed": 0.4,
"lookArcDegrees": 120.0,
"proximityFreezeRadius": 1.5,
"followRange": 64.0,
"tearsEnabled": true,
"heartParticlesEnabled": false,
"heartIntervalTicks": 60,
"tintBrightness": 0.55,
"desaturation": 0.25,
"explosionRadius": 3.0,
"chargedExplosionRadius": 6.0
}
| Key |
Default |
Notes |
replacementChance |
1.0 |
Fraction of vanilla creeper spawns that become weeping creepers. 0.0 = never replace; 1.0 = always. |
movementSpeed |
0.4 |
Movement speed attribute. Vanilla creeper is 0.25. |
lookArcDegrees |
120.0 |
Front cone width that counts as "looking at". |
proximityFreezeRadius |
1.5 |
Any player within this distance freezes the creeper regardless of look angle. 0 to disable. |
followRange |
64.0 |
Detection / pursuit range. Vanilla creeper is around 16. |
tearsEnabled |
true |
Tears overlay on the face. |
heartParticlesEnabled |
false |
Spawn a heart particle above the creeper while observed. Comedic, off by default. |
heartIntervalTicks |
60 |
Ticks between hearts when enabled. 20 = 1 second. |
tintBrightness |
0.55 |
Uniform brightness multiplier on the creeper texture. 1.0 = no change. |
desaturation |
0.25 |
Per-channel green reduction for the statue look. 0.0 = uniform darken only. |
explosionRadius |
3.0 |
Player-damage radius. Same as vanilla creeper. |
chargedExplosionRadius |
6.0 |
Radius when struck by lightning. Same as vanilla charged. |
tearsEnabled, heartParticlesEnabled, and the tint values take effect live on render. Other values require restart.
How it works under the hood
- Custom entity (
WeepingCreeperEntity extends Creeper) — inherits the standard creeper AI, swell timer, and charged variant. Spawn-replaces vanilla creepers via EntityJoinLevelEvent (NeoForge) / ServerEntityEvents.ENTITY_LOAD (Fabric).
- Look detection: dot product between the player's look vector and the player-eye-to-creeper-center vector, vs
cos(arc / 2), plus a vanilla hasLineOfSight() check.
- The freeze:
customServerAiStep stops navigation, clears the target, zeroes horizontal velocity, and hard-resets the swell fuse to 0 each tick. The swell reset uses a tiny mixin accessor (CreeperAccessor) because the swell field is private and setSwellDir(-1) alone only decrements one per tick — too slow against an already-mid-explosion creeper.
- Custom explosion: another tiny mixin (
CreeperTickMixin) wraps the private Creeper#explodeCreeper() invocation inside Creeper#tick. For weeping creepers, redirects to WeepingCreeperEntity#explodeWeeping() which fires a cosmetic-only explosion (Level.ExplosionInteraction.NONE = no block damage) and applies vanilla creeper damage scaling only to players in radius. Vanilla creepers are unaffected.
- Tint: overrides
LivingEntityRenderer#getModelTint(state) with a per-channel ARGB multiplier. Keeps the vanilla creeper texture path so resource pack retextures still apply through the tint.
Both mixins target very small bytecode footprints in vanilla Creeper.class. Should play nice with anything that doesn't itself redirect the same private invocation.
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
登录后参与评分
还没有评论,来抢沙发吧