diff --git a/src/main/kotlin/com/github/zly2006/enclosure/ServerMain.kt b/src/main/kotlin/com/github/zly2006/enclosure/ServerMain.kt index 79aa2a7..780cf59 100644 --- a/src/main/kotlin/com/github/zly2006/enclosure/ServerMain.kt +++ b/src/main/kotlin/com/github/zly2006/enclosure/ServerMain.kt @@ -64,6 +64,7 @@ import net.minecraft.util.Identifier import net.minecraft.util.hit.BlockHitResult import net.minecraft.util.hit.HitResult import net.minecraft.util.math.BlockPos +import net.minecraft.util.math.ChunkPos import net.minecraft.world.PersistentState import net.minecraft.world.RaycastContext import net.minecraft.world.World @@ -283,7 +284,7 @@ object ServerMain: ModInitializer { } fun getSmallestEnclosure(world: ServerWorld, pos: BlockPos?): EnclosureArea? { - return (world.getChunk(pos) as? ChunkAccess)?.cache + return (world.getChunkAsView(ChunkPos(pos).x, ChunkPos(pos).z) as? ChunkAccess)?.cache ?.firstOrNull { it.contains(pos!!) } ?.areaOf(pos!!) }