Compatibility
Minecraft: Java Edition
Platforms
Supported environments
Tags
Creators
Details
Changelog
Fall Potion – Final Implementation for 1.21.11
Overview
Due to significant API changes in Minecraft 26.1 (1.21.11), it is impossible to implement an effect whose intensity scales linearly with the amplifier parameter using mixins, events, or dynamic attribute modifiers. Therefore, a static effect class generation approach is adopted: create a separate effect class for each level (0 to 255), each with fixed attribute values (damage multiplier, gravity, safe fall distance).
Implementation Details
1. Effect Class Generation (Python Script)
- Generates 256 classes:
FallEffect0–FallEffect255 - Each class contains:
FALL_DAMAGE_MULTIPLIER: increment =1 + 2 * level(level 0 → 2×, level 1 → 4×, level 255 → 512×)GRAVITY: increment =0.02 * (level + 1)SAFE_FALL_DISTANCE: based on level range- Level 0: unchanged (3.0)
- Levels 1–3: target -2.5 (modifier -5.5)
- Levels ≥4: target -3.0 (modifier -6.0)
2. Effect Registration
ModEffects.javaregisters all 256 effects.- Registry names:
fall-potion:fall_effect_<level>
3. Potions
- Only two brewable potions are kept:
- Type I → uses
fall_effect_0 - Type II → uses
fall_effect_1
- Type I → uses
- Brewing recipes are the same as vanilla (Awkward Potion + Feather → Levitation Potion → Fermented Spider Eye → Fall Potion I; + Glowstone Dust → Fall Potion II).
4. Command Usage
Players can obtain any level of the effect via the /effect command, e.g.:
/effect give @p fall-potion:fall_effect_50 60 1 true
Level 50 corresponds to 101× damage multiplier, gravity +1.02, safe fall distance -3.0.
5. Language Files
- All effects share the same display name:
Fall Curse(English) /坠落诅咒(Chinese) - Potion names and tipped arrow names remain unchanged (Type I / II).
6. Textures
- All effects share the same icon (copy
fall_effect_i.pngtofall_effect_0.png–fall_effect_255.png).
Advantages
- Stable and reliable: no mixins, no reflection; uses only vanilla attribute modifiers.
- Persistent: effects are saved in NBT and survive world reloads.
- High‑level support: up to level 255 can be applied via commands with linear scaling.
Disadvantages
- Generates many class files (256), increasing JAR size and compilation time.
- Command must specify the exact effect ID instead of a single ID +
amplifier.
Maintenance
- To adjust formulas, modify the Python script and regenerate effect classes.
- If Fabric API adds dynamic attribute support in the future, consider refactoring to a single effect class.
Resource Generation Scripts
All Python scripts (effect class generation, ModEffects.java generation, language file generation, texture copying) are provided and can be rerun as needed.
Last updated: 2026-05-23


