Add BiomeProvider structure search fast path to CustomWorldChunkManager#13836
Open
diytechy wants to merge 1 commit intoPaperMC:mainfrom
Open
Add BiomeProvider structure search fast path to CustomWorldChunkManager#13836diytechy wants to merge 1 commit intoPaperMC:mainfrom
diytechy wants to merge 1 commit intoPaperMC:mainfrom
Conversation
Adds getStructurePlacementBiome(WorldInfo, int, int) to the Bukkit BiomeProvider API as a default method returning Optional.empty(). Generators may override this to return a cheap 2D biome approximation for structure placement eligibility checks (e.g. land vs ocean for stronghold ring position computation), bypassing expensive 3D pipeline evaluation for standard terrain generation. CustomWorldChunkManager overrides findBiomeHorizontal, setting a ThreadLocal flag while the search runs so getNoiseBiome can call getStructurePlacementBiome() instead of the full getBiome() path. This avoids the extensive pipeline calculation cost for biome placement in more complex terrain generators like Terra. Falls back silently to getBiome() if the provider returns empty, CraftBiome.bukkitToMinecraftHolder returns null, or the generator does not implement getStructurePlacementBiome. Includes one-shot diagnostic logging to confirm the fast path is active and being used during stronghold searches.
Member
|
Do you need the debug logging or was it more for initial confirmation that it works? otherwise I'd just remove it since it ends up being more atomic logging code than implementation |
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.
Adds getStructurePlacementBiome(WorldInfo, int, int) to the Bukkit BiomeProvider API as a default method returning Optional.empty(). Generators may override this to return a cheap 2D biome approximation for structure placement eligibility checks (e.g. land vs ocean for stronghold ring position computation), bypassing expensive 3D pipeline evaluation for standard terrain generation.
CustomWorldChunkManager overrides findBiomeHorizontal, setting a ThreadLocal flag while the search runs so getNoiseBiome can call getStructurePlacementBiome() instead of the full getBiome() path. This avoids the extensive pipeline calculation cost for biome placement in more complex terrain generators like Terra.
Falls back silently to getBiome() if the provider returns empty, CraftBiome.bukkitToMinecraftHolder returns null, or the generator does not implement getStructurePlacementBiome.
Includes one-shot diagnostic logging to confirm the fast path is active and being used during stronghold searches.