-
Notifications
You must be signed in to change notification settings - Fork 0
26.2 Architecture and Mixins
This page details the internal software architecture, bytecode mixin injection targets, performance guardrails, and automated testing suites for Max Elytra Fly Speed (MC 26.2).
| Parameter | Technical Details |
|---|---|
| Namespace Package | net.instantgratification.maxelytraflyspeed |
| Mod Initializer | net.instantgratification.maxelytraflyspeed.MaxElytraFlySpeedFabric |
| Client Initializer | net.instantgratification.maxelytraflyspeed.MaxElytraFlySpeedFabricClient |
| Mixin Configuration | src/main/resources/max-elytra-fly-speed.mixins.json |
| Active Mixins |
LivingEntityMixin, FireworkRocketEntityMixin
|
| Hot Path Memory Profile | Zero heap allocations ( |
| Classloader Guard |
ModVersionGuard.checkClass in onInitialize
|
The codebase follows the The Clean "1 File, 1 Purpose" Architecture Law, separating mathematical algorithms, bytecode manipulation, configuration, and client interfaces into dedicated classes:
net.instantgratification.maxelytraflyspeed/
├── MaxElytraFlySpeedFabric.java # Main ModInitializer & GameRule registrations
├── MaxElytraFlySpeedFabricClient.java # ClientModInitializer
├── config/
│ ├── ClothConfigScreenHelper.java # Optional Cloth Config GUI factory
│ └── ModMenuIntegration.java # ModMenuApi implementation
├── mixin/
│ ├── FireworkRocketEntityMixin.java # Bytecode redirection for rocket boost calculations
│ └── LivingEntityMixin.java # Fall-flying drag redirection & velocity clamping
└── util/
├── ElytraDragHelper.java # Pure mathematical drag floor scaling algorithms
├── ModVersionGuard.java # Knot/Fabric ClassLoader validation utility
└── RocketBoostHelper.java # Two-tier rocket propulsion vector math
-
Target Class:
net.minecraft.world.entity.LivingEntity -
Injection Points:
-
@RedirectinupdateFallFlyingMovement:@Redirect( method = "updateFallFlyingMovement", at = @At( value = "INVOKE", target = "Lnet/minecraft/world/phys/Vec3;multiply(DDD)Lnet/minecraft/world/phys/Vec3;" ) ) private Vec3 maxelytraflyspeed$adjustDrag(Vec3 movement, double x, double y, double z) { LivingEntity entity = (LivingEntity) (Object) this; int maxSpeedBps = DynamicGameRuleManager.getInt(entity.level(), MaxElytraFlySpeedFabric.MAX_ELYTRA_FLY_SPEED); return ElytraDragHelper.calculateFallFlyingDrag(movement, maxSpeedBps); }
-
@InjectintravelFallFlying:@Inject( method = "travelFallFlying", at = @At( value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;move(Lnet/minecraft/world/entity/MoverType;Lnet/minecraft/world/phys/Vec3;)V" ) ) private void maxelytraflyspeed$clampMaxSpeed(Vec3 input, CallbackInfo ci) { LivingEntity entity = (LivingEntity) (Object) this; int maxSpeedBps = DynamicGameRuleManager.getInt(entity.level(), MaxElytraFlySpeedFabric.MAX_ELYTRA_FLY_SPEED); double maxSpeedTicks = maxSpeedBps / 20.0; Vec3 velocity = entity.getDeltaMovement(); double currentSpeed = velocity.length(); if (currentSpeed > maxSpeedTicks && currentSpeed > 0.0) { entity.setDeltaMovement(velocity.scale(maxSpeedTicks / currentSpeed)); } }
-
-
Target Class:
net.minecraft.world.entity.projectile.FireworkRocketEntity -
Injection Point:
-
@Redirectintick():@Redirect( method = "tick", at = @At( value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;setDeltaMovement(Lnet/minecraft/world/phys/Vec3;)V" ) ) private void maxelytraflyspeed$scaleRocketBoost(LivingEntity entity, Vec3 newMovement) { Vec3 oldMovement = entity.getDeltaMovement(); int maxSpeedBps = DynamicGameRuleManager.getInt(entity.level(), MaxElytraFlySpeedFabric.MAX_ELYTRA_FLY_SPEED); double maxSpeedTicks = maxSpeedBps / 20.0; int initialBoostSpeedBps = DynamicGameRuleManager.getInt(entity.level(), MaxElytraFlySpeedFabric.ELYTRA_INITIAL_BOOST_SPEED); double initialBoostSpeedTicks = initialBoostSpeedBps / 20.0; int highAccPermille = DynamicGameRuleManager.getInt(entity.level(), MaxElytraFlySpeedFabric.ELYTRA_HIGH_SPEED_ACCELERATION); double highAccFactor = Math.max(0.05, highAccPermille / 100.0); Vec3 lookAngle = entity.getLookAngle(); Vec3 targetMovement = RocketBoostHelper.calculateBoostMovement( oldMovement, lookAngle, initialBoostSpeedTicks, maxSpeedTicks, highAccFactor ); entity.setDeltaMovement(targetMovement); }
-
Flight physics executes 20 times per second for every flying entity in the world:
-
Zero Heap Allocation in Hot Paths:
- All vector calculations in
ElytraDragHelperandRocketBoostHelperreuse native immutableVec3methods (multiply,scale,add,subtract) without instantiating custom tracking wrapper objects.
- All vector calculations in
-
Deterministic
$\mathcal{O}(1)$ Execution:- Drag calculations and rocket convergence require strictly constant-time floating-point operations (
$\approx 0.0001\mu\text{s}$ per check).
- Drag calculations and rocket convergence require strictly constant-time floating-point operations (
-
Strict Null Safety:
- Both helpers validate incoming vectors and safely return
Vec3.ZEROif an unexpectednullmovement or look angle is encountered.
- Both helpers validate incoming vectors and safely return
The mod includes headless JUnit 5 unit tests in src/test/java/ verifying all math, edge cases, and boundary conditions prior to release:
| Test Class | Test Case | Assertion Objective |
|---|---|---|
ElytraDragHelperTest |
testVanillaParityDragAtOrBelow50Bps |
Asserts exact |
ElytraDragHelperTest |
testDynamicDragReductionAbove50Bps |
Asserts relaxed drag at |
ElytraDragHelperTest |
testNullVectorSafety |
Asserts strict null safety returning zero vector without throwing NPE. |
RocketBoostHelperTest |
testInitialBoostSnappyAcceleration |
Asserts snappy |
RocketBoostHelperTest |
testHighSpeedProportionalAcceleration |
Asserts proportional vector difference convergence above |
RocketBoostHelperTest |
testMaxSpeedClamping |
Asserts vector clamping when rocket boost exceeds maximum flight ceiling. |
RocketBoostHelperTest |
testNullVectorSafety |
Asserts strict null safety on movement and look angle parameters. |
📌 Repository Source Disclaimer: The documentation in this Wiki reflects the current source code state in the repository, which may include recent unreleased commits or developmental features ahead of public release builds on CurseForge and Modrinth.
Max Elytra Fly Speed is developed and maintained by Dasik (Rifaditya) under the GNU General Public License v3.0 (GPLv3).
- 🇺🇸 English | 🇨🇳 简体中文 | 🇭🇰 繁體中文
- 🇷🇺 Русский | 🇪🇸 Español | 🇩🇪 Deutsch
- 🇫🇷 Français | 🇧🇷 Português | 🇯🇵 日本語
- 🇮🇩 Bahasa Indonesia | 🇰🇷 한국어
🇺🇸 English
- 📖 26.2 Overview
- 🌀 Kinetic Physics & Drag
- 🚀 Rocket Propulsion & Acceleration
- ⚙️ GameRules & Configuration
- 🧩 Architecture & Mixins