Skip to content

Add SelectionCuboid extension#39

Open
BunnyNabbit wants to merge 1 commit intomainfrom
5-selectioncuboid
Open

Add SelectionCuboid extension#39
BunnyNabbit wants to merge 1 commit intomainfrom
5-selectioncuboid

Conversation

@BunnyNabbit
Copy link
Owner

@BunnyNabbit BunnyNabbit commented Dec 16, 2025

Resolves #5

Summary by CodeRabbit

  • New Features
    • Added cuboid selection management – users can now create 3D cuboid selections with configurable coordinates, names, colors, and opacity levels, and remove selections as needed for improved spatial marking and scene management.

✏️ Tip: You can customize this high-level summary in your review settings.

@BunnyNabbit BunnyNabbit added the enhancement New feature or request label Dec 16, 2025
@BunnyNabbit BunnyNabbit linked an issue Dec 16, 2025 that may be closed by this pull request
Comment on lines +33 to +51
export interface selection {
/** A byte. */
id: number
name?: string
startX: number
startY: number
startZ: number
endX: number
endY: number
endZ: number
/** A color component of 0 to 255. */
red?: number
/** A color component of 0 to 255. */
green?: number
/** A color component of 0 to 255. */
blue?: number
/** The opacity from 0 to 255. 255 is fully opaque. */
opacity?: number
}
Copy link
Owner Author

Choose a reason for hiding this comment

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

idk should a class be made? classicborne uses arrays for positions but classicborne-server-protocol uses object fields wizh varying names.
but also, classicborne-server-protocol isn't too low-level, it does prefer floats over fixed-points. Color is sort of fixed point, right? maybe it should instead be 0-1? but whatever. follow what block definition does for fog colors for now

@coderabbitai
Copy link

coderabbitai bot commented Jan 25, 2026

📝 Walkthrough

Walkthrough

A new SelectionCuboid extension is introduced to enable clients to manage selection cuboids through packet-based communication. The extension includes methods for adding and removing selections with configurable properties, and is integrated into the server's extension registry and protocol handler.

Changes

Cohort / File(s) Summary
Server Extension Registry
class/Server.mjs
Added SelectionCuboid extension entry (version 1) to the public extensions array.
SelectionCuboid Implementation
class/extensions/SelectionCuboid.mjs
New extension class with static packet identifiers (0x1a for add, 0x1b for remove) and public methods addSelection() and removeSelection() that construct and send cuboid selection packets.
Type Definitions
class/extensions/extensionTypes.mts
Added SelectionCuboid to defaultExtensions type mapping and introduced a new selection interface with coordinate, identification, and optional color/opacity fields.
Module Export
class/extensions/index.mjs
Exported SelectionCuboid from its module file.
Protocol Handler Integration
class/extensions/packetHandlers/DefineProtocolExtension.mjs
Added import and instantiation logic for SelectionCuboid in the extension protocol handler's switch statement.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A cuboid of selections, so neat and so grand,
With packets that hop through the Minecraft land!
Add, remove, and coordinate with pride,
Now builders can visualize selections worldwide! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add SelectionCuboid extension' accurately and concisely describes the main change: introducing a new SelectionCuboid extension.
Linked Issues check ✅ Passed The PR implements the SelectionCuboid extension with packet handling, type definitions, and public API as specified by the Minecraft Classic Protocol specification.
Out of Scope Changes check ✅ Passed All changes are scoped to implementing the SelectionCuboid extension; no unrelated modifications are present.

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

✨ Finishing touches
  • 📝 Docstrings were successfully generated.

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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

@coderabbitai
Copy link

coderabbitai bot commented Jan 25, 2026

Note

Docstrings generation - SUCCESS
Generated docstrings for this pull request at #43

coderabbitai bot added a commit that referenced this pull request Jan 25, 2026
Docstrings generation was requested by @BunnyNabbit.

* #39 (comment)

The following files were modified:

* `class/Server.mjs`
@sonarqubecloud
Copy link

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SelectionCuboid

1 participant