Skip to content

feat: Version-accurate models rendering #294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: next
Choose a base branch
from
Open

Conversation

zardoy
Copy link
Owner

@zardoy zardoy commented Mar 5, 2025

PR Type

Enhancement


Description

  • Added support for version-specific mesher data handling.

  • Updated setMesherData to include version and additional parameters.


Changes walkthrough 📝

Relevant files
Enhancement
mesher.ts
Update mesher data handling for version accuracy                 

renderer/viewer/lib/mesher/mesher.ts

  • Modified setMesherData to accept version parameter.
  • Enhanced mesher data handling with additional arguments.
  • +1/-1     

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • Summary by CodeRabbit

    • Chores
      • Upgraded an asset dependency to a newer version, ensuring access to the latest improvements and stability.
    • Refactor
      • Enhanced the mesher data processing by incorporating additional configuration values, which may improve rendering behavior in specific scenarios.

    Copy link

    codesandbox bot commented Mar 5, 2025

    Review or Edit in CodeSandbox

    Open the branch in Web EditorVS CodeInsiders

    Open Preview

    @zardoy
    Copy link
    Owner Author

    zardoy commented Mar 5, 2025

    /deploy

    Copy link

    coderabbitai bot commented Mar 5, 2025

    Walkthrough

    The changes update the dependency version of the mc-assets package in package.json and modify the parameter list for the setMesherData function within the mesher handling code. The new parameters include a fixed boolean and a version obtained from configuration. This also reflects an update to the corresponding exported function signature in the models file to accommodate the additional arguments.

    Changes

    File(s) Change Summary
    package.json Updated dependency "mc-assets": "^0.2.37" to "mc-assets": "^0.2.42".
    renderer/viewer/lib/mesher/mesher.ts
    ./models
    Modified the invocation and signature of setMesherData/setBlockStatesData by adding two extra arguments: a hardcoded boolean true and data.config.version.

    Sequence Diagram(s)

    Loading
    sequenceDiagram
        participant C as Client Message
        participant H as HandleMessage Function
        participant M as setMesherData Function
        C->>H: Send "mesherData" message with data and config
        H->>M: Call setMesherData(blockstatesModels, blocksAtlas, (outputFormat==='webgpu'), true, version)
    

    Poem

    A rabbit hops through lines of code,
    Skipping bugs down a winding road.
    Dependencies jump to versions anew,
    With extra flags and data in view.
    In mesher realms, the changes sing—
    CodeRabbit cheers, ready to spring!
    🐇💻✨

    ✨ Finishing Touches
    • 📝 Generate Docstrings

    🪧 Tips

    Chat

    There are 3 ways to chat with CodeRabbit:

    • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
      • I pushed a fix in commit <commit_id>, please review it.
      • Generate unit testing code for this file.
      • Open a follow-up GitHub issue for this discussion.
    • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
      • @coderabbitai generate unit testing code for this file.
      • @coderabbitai modularize this function.
    • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
      • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
      • @coderabbitai read src/utils.ts and generate unit testing code.
      • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
      • @coderabbitai help me debug CodeRabbit configuration file.

    Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

    CodeRabbit Commands (Invoked using PR comments)

    • @coderabbitai pause to pause the reviews on a PR.
    • @coderabbitai resume to resume the paused reviews.
    • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
    • @coderabbitai full review to do a full review from scratch and review all the files again.
    • @coderabbitai summary to regenerate the summary of the PR.
    • @coderabbitai generate docstrings to generate docstrings for this PR.
    • @coderabbitai resolve resolve all the CodeRabbit review comments.
    • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
    • @coderabbitai help to get help.

    Other keywords and placeholders

    • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
    • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
    • Add @coderabbitai anywhere in the PR title to generate the title automatically.

    CodeRabbit Configuration File (.coderabbit.yaml)

    • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
    • Please see the configuration documentation for more information.
    • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

    Documentation and Community

    • Visit our Documentation for detailed information on how to use CodeRabbit.
    • Join our Discord Community to get help, request features, and share feedback.
    • Follow us on X/Twitter for updates and announcements.

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Parameter Changes

    The PR adds two new parameters to the setMesherData function call: a boolean value (true) and data.config.version. Verify that the setMesherData function implementation has been updated elsewhere to handle these new parameters correctly.

    setMesherData(data.blockstatesModels, data.blocksAtlas, data.config.outputFormat === 'webgpu', true, data.config.version)

    Copy link

    qodo-merge-pro-for-open-source bot commented Mar 5, 2025

    PR Code Suggestions ✨

    No code suggestions found for the PR.

    @zardoy
    Copy link
    Owner Author

    zardoy commented Mar 5, 2025

    /deploy

    Copy link

    github-actions bot commented Mar 5, 2025

    Deployed to Vercel Preview: https://prismarine-7vgr6r8r1-zaro.vercel.app
    Playground
    Storybook

    Copy link

    @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.

    Actionable comments posted: 0

    🧹 Nitpick comments (1)
    renderer/viewer/lib/mesher/mesher.ts (1)

    96-96: Added version-specific model rendering support.

    The modification adds two new parameters to the setMesherData function call:

    1. A hardcoded boolean value true (presumably a flag for some feature)
    2. data.config.version - The version parameter needed for accurate model rendering

    This change aligns with the PR objective to add version-specific mesher data handling.

    While the code works as intended, consider using a named constant for the hardcoded boolean value to improve code readability and maintainability:

    - setMesherData(data.blockstatesModels, data.blocksAtlas, data.config.outputFormat === 'webgpu', true, data.config.version)
    + const USE_VERSION_SPECIFIC_MODELS = true;
    + setMesherData(data.blockstatesModels, data.blocksAtlas, data.config.outputFormat === 'webgpu', USE_VERSION_SPECIFIC_MODELS, data.config.version)
    📜 Review details

    Configuration used: CodeRabbit UI
    Review profile: CHILL
    Plan: Pro

    📥 Commits

    Reviewing files that changed from the base of the PR and between 1c700aa and ddc2755.

    ⛔ Files ignored due to path filters (1)
    • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
    📒 Files selected for processing (2)
    • package.json (1 hunks)
    • renderer/viewer/lib/mesher/mesher.ts (1 hunks)
    🔇 Additional comments (2)
    package.json (1)

    152-152:

    ✅ Verification successful

    Dependency update for mc-assets package.

    The mc-assets dependency has been updated from a previous version to ^0.2.42. This update appears to support the new version-specific mesher data handling feature introduced in this PR.


    🏁 Script executed:

    #!/bin/bash
    # Check for the changelog or release notes for mc-assets to understand what's new in version 0.2.42
    
    # Try to find information about the package from npm
    echo "Checking mc-assets package information..."
    curl -s https://registry.npmjs.org/mc-assets | jq '.["dist-tags"], .versions["0.2.42"].description'
    
    # Check if the package exists on GitHub
    echo "Checking for repository information..."
    curl -s https://registry.npmjs.org/mc-assets | jq '.repository.url'
    
    # If it's on GitHub, we could fetch release notes, but without knowing the exact repo URL, we'll skip that

    Length of output: 461


    Confirmed Dependency Update for mc-assets to ^0.2.42

    The updated dependency in package.json (line 152) has been verified against the npm registry. The current release, marked as "latest": "0.2.42", and the repository URL (git+https://github.com/zardoy/mc-assets.git) confirm that the package update is valid. The upgrade aligns with the new mesher data handling feature introduced in this PR.

    renderer/viewer/lib/mesher/mesher.ts (1)

    88-90:

    ✅ Verification successful

    Ensure consistent versioning and configuration.

    The code initializes the world with data.config.version if it doesn't exist yet, then updates the configuration. This logic now works with the new version-specific mesher data handling.

    Let's check if there are any potential issues with how version information is handled elsewhere in the codebase:


    🏁 Script executed:

    #!/bin/bash
    # Check how version is used in the World class and other related components
    echo "Checking how version is used in the codebase..."
    
    # Look for World constructor usage with version parameter
    echo "=== World constructor with version parameter ==="
    rg -A 3 -B 3 "new World\([^)]*version" --glob "!node_modules/**"
    
    # Look for config.version usage in the codebase
    echo "=== config.version usage ==="
    rg -A 2 -B 2 "config\.version" --glob "!node_modules/**"
    
    # Check if there are any places that might need to be updated for version-accurate rendering
    echo "=== Places potentially related to mesher data ==="
    rg -A 2 -B 2 "mesherData|blockstatesModels|setMesherData" --glob "!node_modules/**"

    Length of output: 10006


    Consistent version initialization confirmed

    The version is consistently handled across the codebase. The reviewed snippet in renderer/viewer/lib/mesher/mesher.ts:

    world ??= new World(data.config.version)
    world.config = { ...world.config, ...data.config }
    globalThis.world = world

    correctly initializes the world with data.config.version if necessary, and then updates its configuration. Verification shows that the World class and related functions are using the version consistently, including within mesher data handling and config updates.

    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