refactor(world/chunk): make block registry instance-scoped#1171
Open
HashimTheArab wants to merge 22 commits intodf-mc:masterfrom
Open
refactor(world/chunk): make block registry instance-scoped#1171HashimTheArab wants to merge 22 commits intodf-mc:masterfrom
HashimTheArab wants to merge 22 commits intodf-mc:masterfrom
Conversation
… palette/light caches) - Replace global block palette/light lookups with an instance-scoped BlockRegistry passed through chunks/encoding. - Remove global LightBlocks/FilteringBlocks and derive per-runtimeID flags (light, filter, NBT, random tick, liquids) from the active registry. - Eliminate incremental slices.Insert(...) maintenance of parallel runtimeID-indexed slices; derived lookup tables are built in Finalize(). - Fix LightArea baseZ bug and make lighting queries registry-aware. - Make Flat generator resolve runtime IDs against the chunk’s registry (supports custom registries). - Enables running multiple servers/worlds in one process and safely supports per-server custom block registries without global conflicts. - mcdb: make ColumnIterator.Column() lazily load columns; Next() only advances keys and clears the cached column to avoid stale returns.
HashimTheArab
commented
Jan 14, 2026
| registerBlockState(s) | ||
| } | ||
|
|
||
| chunk.RuntimeIDToState = func(runtimeID uint32) (name string, properties map[string]any, found bool) { |
Contributor
Author
There was a problem hiding this comment.
These were moved to BlockRegistryImpl
HashimTheArab
commented
Jan 14, 2026
| stateRuntimeIDs = map[stateHash]uint32{} | ||
| // nbtBlocks holds a list of NBTer implementations for blocks registered that implement the NBTer interface. | ||
| // These are indexed by their runtime IDs. Blocks that do not implement NBTer have a false value in this slice. | ||
| nbtBlocks []bool |
Contributor
Author
There was a problem hiding this comment.
this and the below ones were moved to blockState in BlockRegistryImpl
…orld.DefaultBlockRegistry.BlockByName
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Credit to @olebeck, most of the code was taken from his fork.
Closes #1170