Skip to content

Vehicles Cleanup#630

Open
strubium wants to merge 3 commits intonextfrom
strubium/jimvech
Open

Vehicles Cleanup#630
strubium wants to merge 3 commits intonextfrom
strubium/jimvech

Conversation

@strubium
Copy link
Copy Markdown
Contributor

📝 Description

Continue to work on the vehicle folder

🎯 Goals

Make the vehicles code better

❌ Non Goals

Make the vehicles achually function better

🚦 Testing

Open game and drive

⏮️ Backwards Compatibility

yes

📚 Related Issues & Documents

N/a

🖼️ Screenshots/Recordings

N/a

📖 Added to documentation?

  • 📜 README.md
  • 📑 Documentation
  • 📓 Javadoc
  • 🍕 Comments
  • 🙅 No documentation needed

@strubium strubium requested a review from Desoroxxx February 14, 2026 19:29
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 14, 2026

Walkthrough

The PR refactors interpolation utilities by moving InterpolationKit to InterpolationUtil in a new package, updates 15+ files to use the new utility, introduces Lombok annotations for boilerplate reduction, optimizes data structures using Vector3F containers, and removes the deprecated QuatUtil class.

Changes

Cohort / File(s) Summary
Interpolation Utility Migration
src/main/java/com/paneedah/mwc/utils/InterpolationUtil.java
Moved and renamed from InterpolationKit in the jimphysics package to InterpolationUtil in the mwc.utils package.
Interpolation Consumer Updates
src/main/java/com/paneedah/mwc/utils/MWCUtil.java, src/main/java/com/paneedah/weaponlib/animation/load/BasicStateAnimator.java, src/main/java/com/paneedah/weaponlib/crafting/ammopress/TESRAmmoPress.java, src/main/java/com/paneedah/weaponlib/crafting/base/GUIContainerStation.java, src/main/java/com/paneedah/weaponlib/vehicle/EntityVehicle.java, src/main/java/com/paneedah/weaponlib/vehicle/HierarchicalPartRenderer.java, src/main/java/com/paneedah/weaponlib/vehicle/RenderVehicle2.java, src/main/java/com/paneedah/weaponlib/vehicle/VehicleCustomGUI.java, src/main/java/com/paneedah/weaponlib/vehicle/collisions/OreintedBB.java, src/main/java/com/paneedah/weaponlib/vehicle/jimphysics/solver/..., src/main/java/com/paneedah/weaponlib/vehicle/network/VehicleSmoothShell.java, src/main/java/com/paneedah/weaponlib/vehicle/smoothlib/...
Updated imports from InterpolationKit to InterpolationUtil and replaced method calls accordingly. MWCUtil additionally simplified getInterpolatedPlayerPos to delegate to the utility.
Lombok Refactoring
src/main/java/com/paneedah/weaponlib/AsyncWeaponState.java, src/main/java/com/paneedah/weaponlib/vehicle/GearShiftPattern.java
Introduced @Getter and @NoArgsConstructor annotations to replace explicit getter methods and constructors. GearShiftPattern also renamed internal field pattern to PATTERN and replaced inline interpolation helpers with InterpolationUtil calls.
Data Structure Refactoring
src/main/java/com/paneedah/weaponlib/EntityBounceable.java
Consolidated per-axis rotation fields into Vector3F-based containers (ROTATION and ROTATION_CHANGE); updated rotation accessors and collision handling to reference new structure.
Utility Cleanup
src/main/java/com/paneedah/weaponlib/MiscUtils.java, src/main/java/com/paneedah/weaponlib/vehicle/jimphysics/QuatUtil.java
Removed deprecated clamp() method from MiscUtils and updated smoothstep to use ClampUtil.clampMinFirst. Removed entire QuatUtil class.
Minor Updates
src/main/java/com/paneedah/weaponlib/vehicle/jimphysics/MechanicalClutch.java, src/main/java/com/paneedah/weaponlib/vehicle/jimphysics/VehiclePhysUtil.java, src/main/java/com/paneedah/weaponlib/vehicle/AccessibleVehicleGUI.java
Simplified getSlippage() calculation, removed blank line, and adjusted formatting.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

Productivity

Suggested reviewers

  • Desoroxxx
🚥 Pre-merge checks | ✅ 2 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Vehicles Cleanup' is a vague and generic term that does not clearly convey the specific changes made in the PR, such as the refactoring of InterpolationKit, Lombok adoption, or utility migration. Consider using a more specific title such as 'Refactor vehicle utilities: migrate to InterpolationUtil and adopt Lombok' to better reflect the substantial code changes.
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed The description is related to the PR objectives (continuing work on vehicle folder, improving code quality) and aligns with the actual changes made (refactoring, cleanups).
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into next

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch strubium/jimvech

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/java/com/paneedah/weaponlib/vehicle/VehicleCustomGUI.java (1)

50-51: ⚠️ Potential issue | 🟡 Minor

Pre-existing bug: key and lock textures appear swapped.

Not introduced by this PR, but worth noting: keyTex is assigned lockT and lockTex is assigned keyT. The parameter names strongly suggest these assignments are reversed.

-        keyTex = lockT;
-        lockTex = keyT;
+        keyTex = keyT;
+        lockTex = lockT;
🧹 Nitpick comments (7)
src/main/java/com/paneedah/weaponlib/EntityBounceable.java (1)

47-51: Instance fields use static final constant naming convention.

ROTATION and ROTATION_CHANGE are mutable instance fields whose contents change every tick via .add() / .multiply() / direct field writes. Java convention reserves SCREAMING_CASE for static final constants — using it here suggests immutability that doesn't exist.

Additionally, MAX_ROTATION_CHANGE doesn't depend on instance state and can be promoted to static final.

Suggested rename
-    private final Vector3F ROTATION = new Vector3F();
-    private final Vector3F ROTATION_CHANGE = new Vector3F();
+    private final Vector3F rotation = new Vector3F();
+    private final Vector3F rotationChange = new Vector3F();
 
     private float rotationSlowdownFactor = 0.99f;
-    private final float MAX_ROTATION_CHANGE = 20f;
+    private static final float MAX_ROTATION_CHANGE = 20f;
src/main/java/com/paneedah/mwc/utils/InterpolationUtil.java (2)

8-33: Consider marking the utility class as final with a private constructor.

InterpolationUtil is a stateless utility class with only static methods. Preventing instantiation and subclassing is idiomatic for such classes.

Proposed fix
-public class InterpolationUtil {
+public final class InterpolationUtil {
+
+    private InterpolationUtil() {
+        // Utility class
+    }

11-17: interpolatedEntityPosition has a hidden dependency on MC.getRenderPartialTicks().

Unlike interpolateValue and interpolateVector, which accept partialTicks as a parameter, interpolatedEntityPosition fetches it internally from the client proxy. This makes the API inconsistent and the method unusable in contexts where a different partial tick value is needed. Consider accepting partialTicks as a parameter for consistency and testability.

Proposed signature change
-    public static Vec3d interpolatedEntityPosition(Entity en) {
-        return new Vec3d(interpolateValue(en.prevPosX, en.posX, MC.getRenderPartialTicks()),
-                interpolateValue(en.prevPosY, en.posY, MC.getRenderPartialTicks()),
-                interpolateValue(en.prevPosZ, en.posZ, MC.getRenderPartialTicks())
+    public static Vec3d interpolatedEntityPosition(Entity en, float partialTicks) {
+        return new Vec3d(interpolateValue(en.prevPosX, en.posX, partialTicks),
+                interpolateValue(en.prevPosY, en.posY, partialTicks),
+                interpolateValue(en.prevPosZ, en.posZ, partialTicks)
         );
-
     }
src/main/java/com/paneedah/weaponlib/vehicle/jimphysics/solver/WheelSolver.java (1)

85-96: Pre-existing: this.solver = solver is a no-op self-assignment.

Both constructors assign this.solver = solver; (lines 91 and 104), but solver is not a constructor parameter — it refers to the field itself (which is null at that point). This is dead code. Since this is a cleanup PR, consider removing these lines; the solver is already set via assignSolver().

Proposed cleanup for both constructors
     public WheelSolver(TyreSize tyreSize, double mass, boolean isDrive) {
 
         this.suspension = new SuspensionSolver(springRate, 1.0);
         this.tyreSize = tyreSize;
 
-        //this.axel = axel;
-        this.solver = solver;
         this.wheelMass = mass;

Same for the second constructor on lines 98–110.

src/main/java/com/paneedah/weaponlib/vehicle/jimphysics/stability/InertialStabilizer.java (1)

68-68: Pre-existing: Debug System.out.println left in production code.

Line 68 prints rotationPitch on every camera update tick. Since this is a cleanup PR, consider removing this debug output.

Proposed fix
-        System.out.println(rotationPitch);
src/main/java/com/paneedah/weaponlib/vehicle/RenderVehicle2.java (1)

88-91: Pre-existing: Profanity in error handler and swallowed exception.

Since this is a cleanup PR, consider cleaning up the catch block — the System.out.println("fuck!") on line 90 is not professional, and e.printStackTrace() should ideally use a proper logger.

src/main/java/com/paneedah/weaponlib/vehicle/GearShiftPattern.java (1)

19-22: Naming: PATTERN uses constant-style casing for a mutable instance field.

SCREAMING_CASE in Java conventionally signals a static final constant. Since PATTERN is a non-static, mutable LinkedList (items added via withBranch), a name like pattern or branches would better communicate its nature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant