Skip to content

fix: keep cluster bomblets falling outside simulation distance - #78

Merged
XxFran10xX merged 1 commit into
mainfrom
fix/cluster-bomblets-far-from-players
Oct 20, 2026
Merged

XxFran10xX merged 1 commit into
mainfrom
fix/cluster-bomblets-far-from-players

Conversation

@XxFran10xX

Copy link
Copy Markdown
Contributor

Problem

Cluster bomblets were moved by vanilla physics (setVelocity). Entities stop moving more than simulation-distance chunks from every player (6 on Main). A cluster shell that split out there left its 24 bomblets frozen in mid-air:

  • they never touched the ground, so their tick task ran forever;
  • they only exploded once a player came close enough for them to fall, or when the chunk unloaded.

The parent shell already moves itself with teleport each tick, so it was not affected.

Change

DefaultShooter.sendCluster now moves each bomblet itself:

  • Each tick the bomblet moves by its velocity, then the velocity gets armour stand gravity (0.08) and drag (0.98 vertical, 0.91 horizontal). That matches the vanilla fall players saw before. setGravity(false) stops vanilla moving it a second time near players.
  • A block ray trace (fluids included) over each step stops the bomblet on the surface, so a fast bomblet can't pass through a thin roof or end up underground. It still waits out the existing 5-tick arming delay before exploding.
  • hasHit (nearby blocks and entities) and isDead() still detonate it as before. isOnGround() is no longer used, because vanilla no longer updates it.
  • A bomblet still falling after 200 ticks is removed without exploding, so the task can't run forever.

Tests

  • WeaponsCoverageTest:
    • the existing cluster test now checks the first teleported step, landing on a ray-traced surface and the arming delay;
    • new tests cover the per-tick gravity and drag, detonation next to blocks the ray trace didn't catch, and removal at the 200-tick cap without an explosion.
  • mvn verify locally: 1745 tests, 0 failures. The only uncovered lines are the existing Windows-skipped permission tests (VehicleRepository, template loaders, TrackStore); CI covers them on Linux.

Dev test (TFMCDev01, bot in a Fixed Artillery firing clusterbombs)

Dev has simulation-distance 8. For the test I raised the artillery's projectile-velocity to 6 so the split could land beyond it, then restored the config afterwards. The bot counted the explosion particles VF sends to players within 320 blocks.

Shot 2.16.1 (before) This PR
Split 268–279 blocks out (bomblets not ticking) Bomblets hung at y 257.2 for the whole 22 s window; 0 bomblet explosions All 24 fell and exploded on the terrain (y 80–132) 1.5–2.3 s after the split; their tasks ended
Split 94 blocks out (control, ticking) 24 explosions at 7.05 s, y 62.3 24 explosions at 7.02 s, y 63.9

In the control shot, bomblets now stop at the sea surface instead of sinking about a block and a half first.

🤖 Generated with Claude Code

Bomblets were moved by vanilla physics, which stops more than
simulation-distance chunks from every player. A cluster shell that split
out there left its bomblets frozen in mid-air with a task that never
ended, so they exploded only when a player came near or the chunk
unloaded.

Bomblets now move themselves each tick with armour stand gravity and
drag, like the parent shell. A block ray trace stops them on the surface
instead of passing through roofs or into the ground. Any bomblet still
falling after 200 ticks is removed without exploding.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@XxFran10xX

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fdb8f27d-014a-4109-8a35-0d4f63c90b59
📥 Commits

Reviewing files that changed from the base of the PR and between ef414d2 and 71dcfe6.

📒 Files selected for processing: 2
  • src/main/java/net/tfminecraft/vehicleframework/weapons/shooter/DefaultShooter.java
  • src/test/java/net/tfminecraft/vehicleframework/weapons/WeaponsCoverageTest.java

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Improved cluster-bomb bomblet flight and landing behaviour for more consistent movement.
    • Bomblets now detonate reliably when colliding with surfaces or settling after landing.
    • Added handling for detonations near obstacles, including surfaces not directly in their path.
    • Bomblets that remain unresolved for too long are now safely removed without detonating.

Cluster bomblets now use simulated gravity, drag, and ray-traced block collision. They detonate on collision, death, or landing after the arming delay. Bomblets that do not resolve within 200 ticks are removed without exploding. Tests cover movement, collision, detonation, and timeout removal.

Changes: Cluster bomblet physics

Layer / File(s) Summary
Simulate and validate bomblet behaviour
src/main/java/net/tfminecraft/vehicleframework/weapons/shooter/DefaultShooter.java, src/test/java/net/tfminecraft/vehicleframework/weapons/WeaponsCoverageTest.java
DefaultShooter applies custom gravity and drag, ray-traces block collisions, and centralises bomblet removal. Tests cover falling movement, collision handling, the arming delay, detonation, and removal without an explosion after the timeout.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: ryanbarlow97

Merge Risk: ⚪ Minimal · up to 71dcf

No identified issue blocks merging after normal checks.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@github-actions github-actions Bot added the size:M 30-99 effective changed lines (tests excluded in mixed PRs). label Oct 20, 2026
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@XxFran10xX
XxFran10xX merged commit 10ba3f9 into main Oct 20, 2026
3 checks passed
@XxFran10xX
XxFran10xX deleted the fix/cluster-bomblets-far-from-players branch October 20, 2026 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 effective changed lines (tests excluded in mixed PRs).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant