IllegalStateException while getting block from world


I get an undocumented error on getBlock. Like there is PositionOutOfBoundsException on javadoc, but no the IllegalStateException that i’m getting.
I get this error:

Caused by: java.lang.IllegalStateException: Unable to retrieve a TileEntity for location: Location{(2694.0, 79.0, -1107.0) in WorldServer{Name=adminworld, DimensionId=2, DimensionType=minecraft:overworld}}
at net.minecraft.block.state.BlockStateContainer$StateImplementation.md32f0dd$lambda$snapshotFor$3$1(
at java.util.Optional.orElseThrow(
at net.minecraft.block.state.BlockStateContainer$StateImplementation.snapshotFor(
at com.myplugin.SpongeWorld.getBlockAt(

This is my code:

world.getBlock(x, y, z).snapshotFor(world.getLocation(x, y, z));

How can i fix it ? And why it appear ?

Are you running your code in a none sync thread?

Edit: already helped you in discord

Yes …

So thanks you, i will do it sync