Skip to content
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

Add new cached block loops and builder #139

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

extremeheat
Copy link
Member

Adds cached block lookup API like done in prismarine-viewer for performance (to avoid object creation).

Adds a .getCachedBlock(pos) replacement for .getBlock(pos), and a .buildBlockCache() function that has to be called to build the block cache (ideally after prismarine-world instantiation).

Also add a saveAndQuit() method to save and close timers to not hang tests.

Add saveAndQuit() method
@@ -27,6 +28,11 @@ class World extends EventEmitter {
if (storageProvider && savingInterval !== 0) this.startSaving()
}

setRegistry (registry) {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a bit weird, since prismarine-world needs an instance of prismarine-registry in order to build the block cache (so setRegistry() needs to be called before buildBlockCache()). There is a loader function in prismarine-world, but because of the async/sync setup inside prismarine-world, it's not possible to wrap the class inside the loader function.

A breaking refactor might be needed to fix the async/sync situation

Copy link

Removed dependencies detected. Learn more about Socket for GitHub ↗︎

🚮 Removed packages: buffer-equal@1.0.1

@rom1504
Copy link
Member

rom1504 commented Jan 17, 2024

See #64 regarding sync/async

@rom1504 rom1504 added this to Needs triage in PR Triage Jan 21, 2024
@rom1504 rom1504 moved this from Needs triage to Waiting for user input in PR Triage Feb 26, 2024
@rom1504 rom1504 moved this from Waiting for user input to Almost too old in PR Triage Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
PR Triage
  
Almost too old
Development

Successfully merging this pull request may close these issues.

None yet

2 participants