Skip to content

Conversation

zardoy
Copy link
Owner

@zardoy zardoy commented Jun 26, 2025

  • Renamed renderer/viewer/lib/worldDataEmitter.ts to WorldView.ts
  • Renamed WorldDataEmitter class to WorldView (kept WorldDataEmitterWorker unchanged)
  • Updated all imports and references throughout the codebase:
    • src/watchOptions.ts
    • src/globals.d.ts
    • src/appViewer.ts
    • renderer/playground/baseScene.ts
    • renderer/viewer/three/panorama.ts
    • renderer/viewer/lib/worldrendererCommon.ts
  • Maintained backward compatibility for WorldDataEmitterWorker class

Summary by CodeRabbit

  • Refactor
    • Updated references and naming from "WorldDataEmitter" to "WorldView" throughout the application for consistency.
    • Adjusted related type annotations and imports to align with the new naming.
    • No changes to application logic or user-facing behavior.

- Renamed renderer/viewer/lib/worldDataEmitter.ts to WorldView.ts
- Renamed WorldDataEmitter class to WorldView (kept WorldDataEmitterWorker unchanged)
- Updated all imports and references throughout the codebase:
  - src/watchOptions.ts
  - src/globals.d.ts
  - src/appViewer.ts
  - renderer/playground/baseScene.ts
  - renderer/viewer/three/panorama.ts
  - renderer/viewer/lib/worldrendererCommon.ts
- Maintained backward compatibility for WorldDataEmitterWorker class
Copy link

codesandbox bot commented Jun 26, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link

coderabbitai bot commented Jun 26, 2025

Walkthrough

The changes systematically rename the WorldDataEmitter class and all its usages to WorldView. All import statements, type annotations, class instantiations, and global type declarations are updated to reflect this new naming. No logic, control flow, or functionality is altered.

Changes

Files/Paths Change Summary
renderer/playground/baseScene.ts, src/appViewer.ts, src/globals.d.ts, src/watchOptions.ts Updated imports, type annotations, and instantiations from WorldDataEmitter to WorldView.
renderer/viewer/lib/WorldView.ts Renamed class WorldDataEmitter to WorldView; updated internal type references accordingly.
renderer/viewer/lib/worldrendererCommon.ts Changed import of WorldDataEmitterWorker to import from WorldView module.
renderer/viewer/three/panorama.ts Updated import and usage from WorldDataEmitter to WorldView.

Sequence Diagram(s)

sequenceDiagram
    participant AppViewer
    participant WorldView
    participant World

    AppViewer->>WorldView: Instantiate WorldView(world, renderDistance, position)
    WorldView->>World: Interact with world data
    AppViewer->>WorldView: Call methods (e.g., update, render)
Loading

Suggested labels

Review effort 3/5

Poem

🐇
A world once emitted, now simply in view,
With names all aligned and type paths anew.
The code hops along, not a logic askew,
Just tidier carrots for rabbits like you!
🥕

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in 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.

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 (3)
renderer/viewer/lib/WorldView.ts (1)

358-358: Add missing newline at end of file.

The file is missing a newline at the end, which violates the ESLint rule @stylistic/eol-last.

Add a newline at the end of the file:

  }
+
src/appViewer.ts (2)

100-100: Fix indentation and approve the type change.

The type change from WorldDataEmitter to WorldView is correct and consistent with the class renaming refactor.

Apply this diff to fix the indentation:

-      worldView: WorldView | undefined
+  worldView: WorldView | undefined

187-187: Fix indentation and approve the constructor change.

The constructor call correctly uses the new WorldView class with the same parameters (world, renderDistance, startPosition).

Apply this diff to fix the indentation:

-          this.worldView = new WorldView(world, renderDistance, startPosition)
+    this.worldView = new WorldView(world, renderDistance, startPosition)
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0b1bc76 and cb6a14b.

📒 Files selected for processing (7)
  • renderer/playground/baseScene.ts (2 hunks)
  • renderer/viewer/lib/WorldView.ts (2 hunks)
  • renderer/viewer/lib/worldrendererCommon.ts (1 hunks)
  • renderer/viewer/three/panorama.ts (2 hunks)
  • src/appViewer.ts (3 hunks)
  • src/globals.d.ts (1 hunks)
  • src/watchOptions.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
`renderer/**/*.ts`: Do not use the global variable `bot` directly in any file un...

renderer/**/*.ts: Do not use the global variable bot directly in any file under the renderer/ directory or its subfolders.
In renderer code, all bot/player state and events must be accessed via explicit interfaces, state managers, or passed-in objects, never by referencing bot directly.
In renderer code (such as in WorldRendererThree), use the playerState property (e.g., worldRenderer.playerState.gameMode) to access player state. The implementation for playerState lives in src/mineflayer/playerState.ts.

📄 Source: CodeRabbit Inference Engine (.cursor/rules/vars-usage.mdc)

List of files the instruction was applied to:

  • renderer/viewer/lib/worldrendererCommon.ts
  • renderer/playground/baseScene.ts
  • renderer/viewer/lib/WorldView.ts
  • renderer/viewer/three/panorama.ts
`src/**/*.ts`: You may use the global variable `bot` directly in any file under ...

src/**/*.ts: You may use the global variable bot directly in any file under the src/ directory.
In src/ code, you may use the global variable appViewer from src/appViewer.ts directly. Do not import appViewer or use window.appViewer; use the global appViewer variable as-is.

📄 Source: CodeRabbit Inference Engine (.cursor/rules/vars-usage.mdc)

List of files the instruction was applied to:

  • src/globals.d.ts
  • src/watchOptions.ts
  • src/appViewer.ts
🧠 Learnings (8)
📓 Common learnings
Learnt from: zardoy
PR: zardoy/minecraft-web-client#373
File: renderer/viewer/three/entities.ts:1120-1120
Timestamp: 2025-06-23T13:33:14.776Z
Learning: In the minecraft-web-client project, files under renderer/ directory must not access the global `bot` variable directly according to .cursor/rules/vars-usage.mdc. The updateNameTagVisibility method in renderer/viewer/three/entities.ts currently violates this rule by accessing bot.teamMap and bot.username. Team information should be passed through entity update events from the world data emitter instead.
Learnt from: zardoy
PR: zardoy/minecraft-web-client#373
File: renderer/viewer/three/entities.ts:1120-1120
Timestamp: 2025-06-23T13:33:14.776Z
Learning: In the minecraft-web-client project, team information for entities should be inlined into entity update events from the world data emitter rather than accessing the global bot object from renderer code. This maintains better separation of concerns between the data layer and renderer.
renderer/viewer/lib/worldrendererCommon.ts (4)
Learnt from: zardoy
PR: zardoy/minecraft-web-client#373
File: renderer/viewer/three/entities.ts:1120-1120
Timestamp: 2025-06-23T13:33:14.776Z
Learning: In the minecraft-web-client project, files under renderer/ directory must not access the global `bot` variable directly according to .cursor/rules/vars-usage.mdc. The updateNameTagVisibility method in renderer/viewer/three/entities.ts currently violates this rule by accessing bot.teamMap and bot.username. Team information should be passed through entity update events from the world data emitter instead.
Learnt from: CR
PR: zardoy/minecraft-web-client#0
File: .cursor/rules/vars-usage.mdc:0-0
Timestamp: 2025-06-23T17:08:19.477Z
Learning: Global variables defined for use in `src/` (such as `appViewer` from `src/appViewer.ts`) should be accessed directly as globals, not imported or accessed via `window`, to ensure consistency and avoid ambiguity.
Learnt from: zardoy
PR: zardoy/minecraft-web-client#373
File: renderer/viewer/three/entities.ts:1120-1120
Timestamp: 2025-06-23T13:33:14.776Z
Learning: In the minecraft-web-client project, team information for entities should be inlined into entity update events from the world data emitter rather than accessing the global bot object from renderer code. This maintains better separation of concerns between the data layer and renderer.
Learnt from: CR
PR: zardoy/minecraft-web-client#0
File: .cursor/rules/vars-usage.mdc:0-0
Timestamp: 2025-06-23T17:08:19.477Z
Learning: In the Mineflayer codebase, maintain a strict separation between game logic (in `src/`) and renderer/view logic (in `renderer/`). The renderer must never access the Mineflayer `bot` global directly; instead, it should interact with game state via explicit interfaces or state managers, such as the `playerState` property.
renderer/playground/baseScene.ts (3)
Learnt from: CR
PR: zardoy/minecraft-web-client#0
File: .cursor/rules/vars-usage.mdc:0-0
Timestamp: 2025-06-23T17:08:19.477Z
Learning: Global variables defined for use in `src/` (such as `appViewer` from `src/appViewer.ts`) should be accessed directly as globals, not imported or accessed via `window`, to ensure consistency and avoid ambiguity.
Learnt from: zardoy
PR: zardoy/minecraft-web-client#373
File: renderer/viewer/three/entities.ts:1120-1120
Timestamp: 2025-06-23T13:33:14.776Z
Learning: In the minecraft-web-client project, files under renderer/ directory must not access the global `bot` variable directly according to .cursor/rules/vars-usage.mdc. The updateNameTagVisibility method in renderer/viewer/three/entities.ts currently violates this rule by accessing bot.teamMap and bot.username. Team information should be passed through entity update events from the world data emitter instead.
Learnt from: zardoy
PR: zardoy/minecraft-web-client#373
File: renderer/viewer/three/entities.ts:1120-1120
Timestamp: 2025-06-23T13:33:14.776Z
Learning: In the minecraft-web-client project, team information for entities should be inlined into entity update events from the world data emitter rather than accessing the global bot object from renderer code. This maintains better separation of concerns between the data layer and renderer.
src/globals.d.ts (5)
Learnt from: CR
PR: zardoy/minecraft-web-client#0
File: .cursor/rules/vars-usage.mdc:0-0
Timestamp: 2025-06-23T17:08:19.477Z
Learning: Global variables defined for use in `src/` (such as `appViewer` from `src/appViewer.ts`) should be accessed directly as globals, not imported or accessed via `window`, to ensure consistency and avoid ambiguity.
Learnt from: zardoy
PR: zardoy/minecraft-web-client#373
File: renderer/viewer/three/entities.ts:1120-1120
Timestamp: 2025-06-23T13:33:14.776Z
Learning: In the minecraft-web-client project, files under renderer/ directory must not access the global `bot` variable directly according to .cursor/rules/vars-usage.mdc. The updateNameTagVisibility method in renderer/viewer/three/entities.ts currently violates this rule by accessing bot.teamMap and bot.username. Team information should be passed through entity update events from the world data emitter instead.
Learnt from: CR
PR: zardoy/minecraft-web-client#0
File: .cursor/rules/vars-usage.mdc:0-0
Timestamp: 2025-06-23T17:08:19.477Z
Learning: Globals that are safe to use without window prefixes are documented in `src/globals.d.ts`.
Learnt from: zardoy
PR: zardoy/minecraft-web-client#373
File: renderer/viewer/three/entities.ts:1120-1120
Timestamp: 2025-06-23T13:33:14.776Z
Learning: In the minecraft-web-client project, team information for entities should be inlined into entity update events from the world data emitter rather than accessing the global bot object from renderer code. This maintains better separation of concerns between the data layer and renderer.
Learnt from: CR
PR: zardoy/minecraft-web-client#0
File: .cursor/rules/vars-usage.mdc:0-0
Timestamp: 2025-06-23T17:08:19.477Z
Learning: In the Mineflayer codebase, maintain a strict separation between game logic (in `src/`) and renderer/view logic (in `renderer/`). The renderer must never access the Mineflayer `bot` global directly; instead, it should interact with game state via explicit interfaces or state managers, such as the `playerState` property.
renderer/viewer/lib/WorldView.ts (3)
Learnt from: zardoy
PR: zardoy/minecraft-web-client#373
File: renderer/viewer/three/entities.ts:1120-1120
Timestamp: 2025-06-23T13:33:14.776Z
Learning: In the minecraft-web-client project, files under renderer/ directory must not access the global `bot` variable directly according to .cursor/rules/vars-usage.mdc. The updateNameTagVisibility method in renderer/viewer/three/entities.ts currently violates this rule by accessing bot.teamMap and bot.username. Team information should be passed through entity update events from the world data emitter instead.
Learnt from: zardoy
PR: zardoy/minecraft-web-client#373
File: renderer/viewer/three/entities.ts:1120-1120
Timestamp: 2025-06-23T13:33:14.776Z
Learning: In the minecraft-web-client project, team information for entities should be inlined into entity update events from the world data emitter rather than accessing the global bot object from renderer code. This maintains better separation of concerns between the data layer and renderer.
Learnt from: CR
PR: zardoy/minecraft-web-client#0
File: .cursor/rules/vars-usage.mdc:0-0
Timestamp: 2025-06-23T17:08:19.477Z
Learning: Global variables defined for use in `src/` (such as `appViewer` from `src/appViewer.ts`) should be accessed directly as globals, not imported or accessed via `window`, to ensure consistency and avoid ambiguity.
src/watchOptions.ts (3)
Learnt from: CR
PR: zardoy/minecraft-web-client#0
File: .cursor/rules/vars-usage.mdc:0-0
Timestamp: 2025-06-23T17:08:19.477Z
Learning: Global variables defined for use in `src/` (such as `appViewer` from `src/appViewer.ts`) should be accessed directly as globals, not imported or accessed via `window`, to ensure consistency and avoid ambiguity.
Learnt from: zardoy
PR: zardoy/minecraft-web-client#373
File: renderer/viewer/three/entities.ts:1120-1120
Timestamp: 2025-06-23T13:33:14.776Z
Learning: In the minecraft-web-client project, files under renderer/ directory must not access the global `bot` variable directly according to .cursor/rules/vars-usage.mdc. The updateNameTagVisibility method in renderer/viewer/three/entities.ts currently violates this rule by accessing bot.teamMap and bot.username. Team information should be passed through entity update events from the world data emitter instead.
Learnt from: CR
PR: zardoy/minecraft-web-client#0
File: .cursor/rules/vars-usage.mdc:0-0
Timestamp: 2025-06-23T17:08:19.477Z
Learning: Globals that are safe to use without window prefixes are documented in `src/globals.d.ts`.
src/appViewer.ts (4)
Learnt from: CR
PR: zardoy/minecraft-web-client#0
File: .cursor/rules/vars-usage.mdc:0-0
Timestamp: 2025-06-23T17:08:19.477Z
Learning: Global variables defined for use in `src/` (such as `appViewer` from `src/appViewer.ts`) should be accessed directly as globals, not imported or accessed via `window`, to ensure consistency and avoid ambiguity.
Learnt from: zardoy
PR: zardoy/minecraft-web-client#373
File: renderer/viewer/three/entities.ts:1120-1120
Timestamp: 2025-06-23T13:33:14.776Z
Learning: In the minecraft-web-client project, files under renderer/ directory must not access the global `bot` variable directly according to .cursor/rules/vars-usage.mdc. The updateNameTagVisibility method in renderer/viewer/three/entities.ts currently violates this rule by accessing bot.teamMap and bot.username. Team information should be passed through entity update events from the world data emitter instead.
Learnt from: zardoy
PR: zardoy/minecraft-web-client#373
File: renderer/viewer/three/entities.ts:1120-1120
Timestamp: 2025-06-23T13:33:14.776Z
Learning: In the minecraft-web-client project, team information for entities should be inlined into entity update events from the world data emitter rather than accessing the global bot object from renderer code. This maintains better separation of concerns between the data layer and renderer.
Learnt from: CR
PR: zardoy/minecraft-web-client#0
File: .cursor/rules/vars-usage.mdc:0-0
Timestamp: 2025-06-23T17:08:19.477Z
Learning: In the Mineflayer codebase, maintain a strict separation between game logic (in `src/`) and renderer/view logic (in `renderer/`). The renderer must never access the Mineflayer `bot` global directly; instead, it should interact with game state via explicit interfaces or state managers, such as the `playerState` property.
renderer/viewer/three/panorama.ts (3)
Learnt from: CR
PR: zardoy/minecraft-web-client#0
File: .cursor/rules/vars-usage.mdc:0-0
Timestamp: 2025-06-23T17:08:19.477Z
Learning: Global variables defined for use in `src/` (such as `appViewer` from `src/appViewer.ts`) should be accessed directly as globals, not imported or accessed via `window`, to ensure consistency and avoid ambiguity.
Learnt from: zardoy
PR: zardoy/minecraft-web-client#373
File: renderer/viewer/three/entities.ts:1120-1120
Timestamp: 2025-06-23T13:33:14.776Z
Learning: In the minecraft-web-client project, files under renderer/ directory must not access the global `bot` variable directly according to .cursor/rules/vars-usage.mdc. The updateNameTagVisibility method in renderer/viewer/three/entities.ts currently violates this rule by accessing bot.teamMap and bot.username. Team information should be passed through entity update events from the world data emitter instead.
Learnt from: CR
PR: zardoy/minecraft-web-client#0
File: .cursor/rules/vars-usage.mdc:0-0
Timestamp: 2025-06-23T17:08:19.477Z
Learning: Globals that are safe to use without window prefixes are documented in `src/globals.d.ts`.
🧬 Code Graph Analysis (4)
renderer/playground/baseScene.ts (1)
renderer/viewer/lib/WorldView.ts (1)
  • WorldView (37-358)
src/watchOptions.ts (1)
renderer/viewer/lib/WorldView.ts (1)
  • WorldView (37-358)
src/appViewer.ts (1)
renderer/viewer/lib/WorldView.ts (1)
  • WorldView (37-358)
renderer/viewer/three/panorama.ts (1)
renderer/viewer/lib/WorldView.ts (1)
  • WorldView (37-358)
🪛 ESLint
renderer/viewer/lib/WorldView.ts

[error] 358-358: Newline required at end of file but not found.

(@stylistic/eol-last)

src/appViewer.ts

[error] 100-100: Expected indentation of 2 spaces but found 6.

(@stylistic/indent)


[error] 187-187: Expected indentation of 4 spaces but found 10.

(@stylistic/indent)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build-and-deploy
🔇 Additional comments (11)
renderer/viewer/lib/worldrendererCommon.ts (1)

18-18: LGTM! Import path correctly updated for the renamed file.

The import path has been properly updated to reflect the file rename from worldDataEmitter.ts to WorldView.ts while maintaining the import of WorldDataEmitterWorker for backward compatibility.

src/globals.d.ts (1)

15-15: LGTM! Global type declaration correctly updated for the renamed class.

The global type declaration has been properly updated to use the new WorldView class name and import path, maintaining consistency with the refactoring.

renderer/viewer/three/panorama.ts (2)

7-7: LGTM! Import correctly updated to use the renamed class.

The import has been properly updated to use WorldView from the new file location, consistent with the refactoring.


189-189: LGTM! Class instantiation correctly updated to use the renamed class.

The instantiation has been properly updated to use WorldView instead of WorldDataEmitter while maintaining the same constructor parameters.

renderer/playground/baseScene.ts (2)

17-17: LGTM! Import correctly updated to use the renamed class.

The import has been properly updated to use WorldView from the new file location, consistent with the refactoring.


181-181: LGTM! Class instantiation correctly updated to use the renamed class.

The instantiation has been properly updated to use WorldView instead of WorldDataEmitter while maintaining the same constructor parameters.

renderer/viewer/lib/WorldView.ts (2)

37-37: LGTM! Class name correctly updated as part of the refactoring.

The class has been properly renamed from WorldDataEmitter to WorldView, which is the core change of this refactoring.


41-41: LGTM! Property type correctly updated to match the renamed class.

The emitter property type has been properly updated to use WorldView instead of WorldDataEmitter, maintaining consistency with the class rename.

src/appViewer.ts (1)

1-1: LGTM - Import update aligns with class renaming.

The import statement correctly updates to use the new WorldView class name while maintaining the same module structure.

src/watchOptions.ts (2)

5-5: LGTM - Import update aligns with class renaming.

The import statement correctly updates to use the new WorldView class name while maintaining the same module structure.


120-120: LGTM - Function parameter type correctly updated.

The function parameter type change from WorldDataEmitter to WorldView is consistent with the class renaming refactor. The function body continues to access valid properties like keepChunksDistance on the renamed class.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants