feat: centralize vanilla movement block semantics - #11
Conversation
|
Warning Review limit reached
Next review available in: 4 seconds You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (13)
📝 WalkthroughWalkthroughThe PR introduces consolidated block movement semantics, adds built-in handlers for special blocks, updates simulator movement logic to use semantic properties, and replaces the previous block metadata provider interface. ChangesMovement semantics
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Simulation
participant DefaultBlockSemantics
participant block.Resolve
Simulation->>DefaultBlockSemantics: request BlockMovementSemantics
DefaultBlockSemantics->>block.Resolve: resolve block movement properties
block.Resolve-->>DefaultBlockSemantics: return MovementSemantics
DefaultBlockSemantics-->>Simulation: provide movement properties
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
simulation.go (1)
1001-1005: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winUse
BlockCollisionsfor cobweb contact detection.The full-block cube at Line 1005 can apply cobweb slowdown when the player intersects an empty part of a semantic cobweb block. Resolve the block-local collision boxes with
WorldProvider.BlockCollisions(pos), translate each box byposVec3(pos), and test those world-space boxes againstbb.Proposed fix
- if bb.IntersectsWith(cube.Box32(0, 0, 0, 1, 1, 1).Translate(posVec3(pos))) { - insideCobweb = true + for _, collision := range s.World.BlockCollisions(pos) { + if bb.IntersectsWith(collision.Translate(posVec3(pos))) { + insideCobweb = true + break + } }Based on learnings,
WorldProvider.BlockCollisions(pos)returns block-local boxes and requires translation before world-space intersection. As per coding guidelines, collision methods must provide consistent collision information.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@simulation.go` around lines 1001 - 1005, Update the cobweb contact logic around blockMovementSemantics and bb.IntersectsWith to use s.WorldProvider.BlockCollisions(pos) instead of a full-block cube. Translate each returned block-local collision box by posVec3(pos), and apply cobweb slowdown only when bb intersects at least one translated box.Sources: Coding guidelines, Learnings
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@simulation.go`:
- Around line 1001-1005: Update the cobweb contact logic around
blockMovementSemantics and bb.IntersectsWith to use
s.WorldProvider.BlockCollisions(pos) instead of a full-block cube. Translate
each returned block-local collision box by posVec3(pos), and apply cobweb
slowdown only when bb intersects at least one translated box.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 61e2de1a-e556-4785-98c0-78d732da403e
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (15)
README.mdblock.goblock/bounce.goblock/climbable.goblock/contact.goblock/friction.goblock/ground.goblock/semantics.goblock_semantics_test.gogo.modinterfaces.goliquid_test.gosimulation.gosimulator.gosimulator_test.go
💤 Files with no reviewable changes (1)
- block.go
Summary
BlockMovementSemanticsProvidercontractValidation
go test -count=1 ./...go test -race -count=1 ./...go vet ./...go mod tidy -diffgit diff --check/review: clean after adjudicating non-actionable base-branch/API observationsThis PR intentionally does not preserve the old
BlockName/BlockFriction/BlockClimbableprovider interface.