Skip to content

Optimize block iteration to prevent memory leaks#119

Open
LetMePractice wants to merge 1 commit intoclickcrystals-development:mainfrom
LetMePractice:main
Open

Optimize block iteration to prevent memory leaks#119
LetMePractice wants to merge 1 commit intoclickcrystals-development:mainfrom
LetMePractice:main

Conversation

@LetMePractice
Copy link
Contributor

@LetMePractice LetMePractice commented Feb 27, 2026

Type of change

  • Bug fix
  • New feature

Description

Fixes a crash caused by block_in_range and block_in_fov doing way too many block checks.

A script was calling block_in_range ~60 times per second, and each call could go through ~32k blocks. After running for a while the client would lag out and eventually crash.

boxIterator() now starts at the center and spirals out, stopping early instead of scanning the whole box.

block_in_fov now uses raycasting instead of scanning a volume.

This massively reduces the number of block checks per call.

Related issues

Fixes crashes when scripts spam block_in_range or block_in_fov.

Checklist:

  • My code follows the style guidelines of ItziSpyder(ImproperIssues).
  • I have tested the code in both development and production environments.
  • I have joined the ClickCrystals Discord.

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.

1 participant