Skip to content

Improve sky block deletion to preserve other enabled sky blocks#378

Open
tracygardner wants to merge 1 commit intomainfrom
claude/fix-sky-block-deletion-JLTBM
Open

Improve sky block deletion to preserve other enabled sky blocks#378
tracygardner wants to merge 1 commit intomainfrom
claude/fix-sky-block-deletion-JLTBM

Conversation

@tracygardner
Copy link
Contributor

Summary

Enhanced the sky block deletion logic to intelligently handle cases where multiple set_sky_color blocks exist in the workspace. Instead of always clearing the sky to black when a sky block is deleted, the system now checks for other enabled sky blocks and reapplies one if available.

Key Changes

  • Added new handleSkyBlockDeletion() function in blockmesh.js that:

    • Only clears the sky if the deleted block was the active one controlling it
    • Searches for other enabled set_sky_color blocks in the workspace
    • Automatically reapplies the sky from another enabled block if one exists
    • Falls back to black sky only if no other sky blocks remain
  • Updated handleBlockDelete() and handleMeshLifecycleChange() in blocks.js to call the new function instead of unconditionally clearing and resetting the sky

Implementation Details

The new function checks the meshBlockIdMap["sky"] to determine if the deleted block was actually controlling the sky, preventing unnecessary operations. It then queries all blocks in the workspace to find remaining enabled sky blocks, maintaining a better user experience when working with multiple sky color definitions.

https://claude.ai/code/session_01BD9b5z9rN2dsaNPR9TiHsy

When multiple set_sky_color blocks exist, deleting or disabling one
unconditionally cleared the sky regardless of whether it was the
active block. Now only the active block (tracked by meshBlockIdMap)
triggers a sky change.

If the active sky block is deleted/disabled and another enabled sky
block remains, that block's color is automatically reapplied instead
of falling back to black.

https://claude.ai/code/session_01BD9b5z9rN2dsaNPR9TiHsy
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