Skip to content

Conversation

@Tetrino
Copy link

@Tetrino Tetrino commented Sep 7, 2025

When BlockState is called on a block that is within a chunk that has yet to be loaded, it will always return nil. This results in a situation wherein the height found by the elevation check will always return -63Y in these cases.

This commmit attempts to fix this by forcing an asynchronous chunk load of the destination chunk before elevation is calculated.

This is most apparent in ChunkyBorder, wherein a worldwrap teleport would attempt to position the player in a chunk that had yet to be loaded, or even exist, always teleporting them to -63Y

See: pop4959/ChunkyBorder#91

When `BlockState` is called on a block that is within a chunk that has yet to be
loaded, it will always return `nil`. This results in a situation wherein the height
found by the elevation check will always return -63Y in these cases.

This commmit attempts to fix this by forcing an asynchronous chunk load of the
destination chunk before elevation is calculated.

This is most apparent in ChunkyBorder, wherein a worldwrap teleport would attempt
to position the player in a chunk that had yet to be loaded, or even exist, always
teleporting them to -63Y

See: pop4959/ChunkyBorder#91
@Tetrino
Copy link
Author

Tetrino commented Sep 7, 2025

Of note but not within scope of this commit is that isSolid() is currently deprecated and at some point, these functions should be refactored to rely on isSolidBlock(BlockView, BlockPos) .

@pop4959 pop4959 added bug Something isn't working fabric Issues related to the Fabric platform forge Issues related to the Forge platform neoforge Issues related to the NeoForge platform labels Sep 9, 2025
Copy link
Contributor

@Warriorrrr Warriorrrr left a comment

Choose a reason for hiding this comment

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

I don't believe this to be the correct solution to this problem, world.getHeight and world.getBlockState both already load the chunk if it isn't loaded already, there's also no guarantee that the chunk future will finish at any time.

I've previously added the getElevationAtAsync method which you could override on the fabric/(neo)forge platforms, chunkyborder already uses that to avoid doing a sync chunk load.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working fabric Issues related to the Fabric platform forge Issues related to the Forge platform neoforge Issues related to the NeoForge platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants